RoArm-M2-S 6. Using Foxglove for Web-Based Control

From Waveshare Wiki
Jump to: navigation, search
RoArm-M2-S 6. Using Foxglove for Web-Based Control
RoArm-M2-S.jpg

I2C, UART
TTL Serial Bus Servo Control Interface,
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

6. Using Foxglove for Web-Based Control

The Web application is based on the components provided by Foxglove. You need to register a Foxglove account first.

6.1 Foxglove Studio Introduction

Foxglove Studio is an open-source software for the visualization, debugging and control of your robots. It provides a user-friendly interface for you to directly interact with your robots. Foxglove Studio supports multiple data types including ROS(Robot Operation System) messages, JSON, CSV, etc. The core features of Foxglove Studio include data visualization, real-time and historical data viewing, layout customization, and more. In addition, Foxglove Studio offers a plug-in system that allows users to add new features and tools as needed.

6.2 Get VM IP Address and Register Foxglove Account

  • Get VM IP Address

Before obtaining the IP address of the virtual machine system, you need to change the network connection method of the virtual machine system, click "Device" → "Network" → "Network" on the top of Oracle VM VirtualBox, change the connection method to "Bridge NIC", and finally click "OK", which cannot be the default "Network Address Translation (NAT)". Click "Device" → "Network" → "Network", change the connection method to "Bridge NIC", and finally click "OK", but not the default "Network Address Translation (NAT)". Otherwise, you will not be able to view the IP address of the virtual machine system.

M2-S-network.png

Press Ctrl+Alt+T to open a new terminal and get IP address:

ifconfig

Get the IP address behind the inet in device enp0s3, e.g. 192.168.10.175, remember this IP address.

M2-Sip.png

  • Register Foxglove Account

Next, using a computer on the same LAN as the virtual machine (which can also be a computer running VirtualBox or a virtual machine system) Foxglover account register page.

6.3 Start Foxglove Web Application

Press Ctrl+Alt+T to open a new terminal, enter the robotic arm ROS2 workspace, and run the ROS2 driving nodes.

cd ~/roarm_ws_em0/
ros2 run roarm_driver roarm_driver

Press Ctrl+Alt+T to open another new terminal, enter the workspace of the robotic arm ROS2, and turn on the relevant nodes of the robotic arm control:

cd ~/roarm_ws_em0/
ros2 launch moveit_servo demo.launch.py

Open a third new terminal, enter the workspace of the robotic arm ROS2 and run the Web Application Control node in ROS2:

cd ~/roarm_ws_em0/
ros2 run roarm_moveit_cmd webappcontrol

Finally, a new terminal is opened. In total, four terminals need to be opened to run different worker nodes, to enter the workspace of the robotic arm ROS2 and to start the Foxglove web application:

cd ~/roarm_ws_em0/
ros2 launch foxglove_bridge foxglove_bridge_launch.xml address:=192.168.10.175

You need to replace the IP address after the address above with the IP address of your own VM system (i.e. the one you got earlier).

6.4 Set Robotic Arm Mode in Foxglove Web

This section requires a computer on the same LAN, preferably one that has just registered a Foxglove account, and Google Chrome is recommended.

  1. In the personal user interface of Foxglove, click on "Open connection", a pop-up window Open a new connection will appear.
    M2-S-FoxgloveWeb.png

  2. In the Open a new connection window, fill in the IP address of the virtual machine you obtained earlier. For example, if the IP address of the virtual machine I obtained is 192.168.10.122, enter the following:
    M2-S-FoxgloveWeb1.png

  3. On the right side of Google Chrome's address bar, there is a triangle icon, and since Google Chrome prohibits unsafe scripts from running by default, you need to manually make it allow unsafe scripts to be loaded.

  4. Click on the window with the name 3D (the window with the grid floor), the control panel of the 3D panel will appear on the left side, click on the "Custom Layers" at the bottom left side of the control panel, expand the column, and then expand the URDFs. If there is no URDF after expanding "Custom Layers", click the three dots to the right of "Custom Layers" and select "Add URDF".
    • URDF (Unified Robot Description Format) is an XML format for the complete description of robot models. It includes tags describing robot links, joints, and other physical properties (e.g., friction, inertia, etc.) URDF is widely used in ROS (Robot Operating System) for 3D model visualization, collision detection, path planning, and other functions.
  5. Fill in the following contents in the URL of URDF, and directly use the URDF file in Foxglove.
    package://roarm_description/urdf/roarm_description_web_app.urdf
    
  6. Also make sure that "/robot_description" in the previous "Topics" list in the "Custom Layers" is closed (see below). Otherwise, you will get the wrong URDF models (this is a bug in the communication between Foxglove and ROS2, importing URDF directly from topics will result in a wrong rotation angle for each model).
    M2-S-FoxgloveWeb3.png

In this way, the model of the real robot is visible in the 3D window, and you can adjust the view in the 3D window with the left, right and center mouse buttons.

6.5 Steering Wheel Control

1. Click "Add Panel" in the upper left corner of the page, select "Remote Manipulation" and a new "Remote Manipulation" window will appear.
400px
2. Click on the "Remote Control" window, a "Remote Control" panel will appear on the left side, in the "Topic" select the topic "/ webappcontrol" in the "Topic". You will see a steering wheel control button in the remote control window. M2-S.png

Note: If your "Topic" do not have "/webappcontrol" topic, you need to manually close the node control setting on the Web application in VM, and then reoperate: ros2 run roarm_moveit_cmd webappcontrol


3. Within the remote control panel on the left side, you can define the function and direction of the upper, lower, left and right buttons of the steering wheel respectively, and then you can control the robotic arm through the steering wheel.

  • Field: Changing the axis of coordinate control
    • linear-x: Movement in the direction of the X-axis;
    • linear-y: Movement in the direction of the Y-axis;
    • linear-z: Movement in the direction of the Z-axis;
  • Value: the values -1 and 1 represent the opposite direction of motion, respectively; other values are invalid.

M2-S 2.png
Since then, you have learned how to use the Foxglove web application to control the robotic arm, and you can follow Foxglove's official tutorials to develop additional functionality.

RoArm-M2-S ROS2 Humble + Moveit2 Tutorial