UGV Beast PI ROS2 2. RViz View Product Model

From Waveshare Wiki
Jump to: navigation, search
UGV Beast PI ROS2
UGV Beast

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

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

2. Rviz View product model

By default, you have completed the main program and remotely connected to the Docker container according to the content in Chapter 1 UGV Beast PI ROS2 1. Preparation.


2.1 View model joints

In the container, go to the workspace of the ROS 2 project for that product:

cd /home/ws/ugv_ws


Start the Rviz2 model interface:

ros2 launch ugv_description display.launch.py use_rviz:=true

At this time, you can only view the Rviz2 model interface of the product, but you cannot control the movement of the robot by sliding the slider on the control panel. Successfully start the terminal interface of the Rviz2 model. Do not close the interface, and then run the ROS2 robot driver node.


2.2 Run ROS2 robot driver node

We need to 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.

ROS2 newDocker.png

In the container, go to the workspace of the ROS 2 project for that product:

cd /home/ws/ugv_ws

Run the driver robot node, and there will be no information feedback after the node is finished running:

ros2 run ugv_bringup ugv_driver

Then, you can control the pan-tilt rotation by sliding the slider on the control panel in the picture below, and both the model and the product will rotate with your slide.

  • pt_base_link_to_pt_link1: Controls the rotation of the pan servo of the pan-tilt.
  • pt_link1_to_pt_link2: Controls the rotation of the tilt servo of the pan-tilt.
  • Center: Click this button and the pan-tilt will return to the center position.

Beast rviz.png

2.3 Control robot lights

For UGV series products, the driver board integrates 12V switch control interfaces of 2 channels (the actual maximum voltage will change with the battery voltage), which are controlled by the IO4 and IO5 pins of ESP32 through MOS tubes. Each channel has two corresponding interfaces, a total of 4 12V switch control interfaces. According to the default assembly method, IO4 controls the chassis headlight (the light next to the OKA camera), and IO5 controls the headlight (the light on the USB camera pan-tilt). You can control the switching of these two switches and adjust the voltage level by sending the corresponding commands to the sub-controller. However, due to the inherent delay in MOSFET control, there may not be a linear relationship between the PWM output from the ESP32's IO and the actual voltage output.

For products without LEDs, you can expand the 12.6V withstand LED on these two 12V switches (in general, 12V withstand is also acceptable for safety and battery protection, the product's UPS will not charge the battery above 12V). You can also expand other peripherals on the remaining switch control interfaces, such as a 12V withstand water gun gearbox, which can be directly connected to the interface controlled by IO5 to achieve automatic aiming and shooting functionality.

Every time a control node runs, we need to 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.

In the container, go to the workspace of the ROS 2 project for that product:

cd /home/ws/ugv_ws

Run the light control node, and you can see that the three LED lights on the robot are lit up:

ros2 topic pub /ugv/led_ctrl std_msgs/msg/Float32MultiArray "{data: [255, 255]}" -1

data: [0, 0]——The first 0 is the switch that controls the IO4 interface (chassis headlight); the second 0 is the switch that controls the IO5 interface (headlight).

The parameter variable range is 0-255. When the value of this variable is 0, the interface switches controlled by IO4 and IO5 are turned off; when this variable is 255, the voltage output by the interface switches controlled by IO4 and IO5 is close to the BAT voltage of the UPS (current UPS voltage of three lithium batteries connected in series).

Run the command to turn off the LED lights again, and you can see that all three LED lights are turned off:

ros2 topic pub /ugv/led_ctrl std_msgs/msg/Float32MultiArray "{data: [0, 0]}" -1


This tutorial section has shown you how to view the product model joints, run the robot drive nodes, and control the robot lights, and then follow the following tutorial to learn about other ROS 2 controls.