UGV Rover PI ROS2 9. Web Control Tool
| ||
9. Web Control Tool
This chapter introduces web-based console tools. The robot project uses the Vizanti Web tool, a web-based visualization and control tool designed to make it easier to operate the robot's ROS2 functions. The application tries to replicate the orthographic 2D view of RViz on the browser as precisely as possible. The second objective is to allow reconfiguration, planning and execution of movement and task instructions such as target points and waypoints via custom buttons and parameters.
By default, you have completed the main program and remotely connected to the Docker container according to the content in Chapter 1 UGV Rover PI ROS2 1. Preparation. In the container, start the web application, ip is the IP address of the Raspberry Pi (also the IP address used to log in to the Docker container):
ros2 launch ugv_web_app bringup.launch.py host:=ip
After successful operation, it will appear as shown below:
Then in a computer from the same LAN (it can also be a Raspberry Pi system), open a browser (preferably Google Chrome) and enter Raspberry Pi's IP address + :5100 in the address bar, for example: 192.168.10.212:5100.
At this point, there is no data displayed in the web interface because there is no relevant node to start the robot.
9.1 Control robot movement
9.1.1 Run robot driver node
Open a new Docker container terminal, click the "⭐" symbol in the left sidebar, double-click to open Docker's remote terminal, enter username: root, password: ws.
Start the robot driver node:
ros2 launch ugv_bringup bringup_lidar.launch.py use_rviz:=true
Once launched, a TF coordinate system diagram appears in the web interface, as well as the RViz 2 model interface for the robot.
The following describes common tools for Web interfaces:
- Global Settings: Global settings. You can set the background color and fix the TF coordinate system, and you can reset the camera view to zero and default zoom.
- Rosbridge Connection: Bridge connection. Here shows information such as the connection status and the URL link.
- TF Frame Renderer: TF coordinate system. Render the TF coordinate system, most of the options are the same as in RViz, and you don't need to set them anymore.
9.1.2 Control robot movement
Next, we first add a joystick widget to control the movement of the robot. Click Add Widgets and select Teleop Joystick, a circle button will appear in the web interface, through which you can control the movement of the robot.
9.2 Map
Before starting the mapping node, make sure that the above-mentioned chassis drive node is shut down. You need to refer to UGV Rover PI ROS2 4. 2D Mapping Based on LiDAR or UGV Rover PI ROS2 5. 3D Mapping Based on Depth Camera to start the mapping node.
Once launched, click Add Widgets in the web interface and select Map.
Next, click the Map icon and select Topic as /map, so that you can see the map in the RViz interface.
Finally, you can use the joystick or keyboard to control the movement of the robot to build a map, or you can use the joystick widget added earlier to control the movement of the robot to build a map. After building the map, you can also refer to the instructions in the mapping tutorial to save the map.
Once you've built the map, run the command to start navigation in the Docker container:
ros2 launch ugv_nav nav.launch.py use_rviz:=true
There is no use_localization specified in this command, and the navigation based on the AMCL algorithm is used by default, as detailed in UGV Rover PI ROS2 6. Auto Navigation section.
By setting the Topic in the Map widget to /map, you can see the map saved after completing the previous mapping, which is consistent with the map displayed in the RViz2 interface.
Click Add Widgets in the web interface and select the two widgets 2D Pose Estimate and 2D Nav Goal to add.
You can use 2D Pose Estimate to indicate the position of the robot on the map. The direction of the green arrow is the direction in which the robot's pan-tilt is facing forward.
Select a target location for the robot on the map. You can use the 2D Nav Goal tool to send the target location and direction to the robot. Indicate the location (target point) that the robot wants to automatically navigate to on a map in the web interface, and the direction of the purple arrow is the direction of the robot pan tilt facing forward. Release the mouse after pointing out the target location, and the robot will move to that target location.
From now on, you can control robot movement, mapping and navigation through web control tools. Users can also expand and develop the functions of other components according to their own needs.