View Node Topics with ROS

From Waveshare Wiki
Jump to: navigation, search

JetBot ROS AI Kit Basic Tutorial

Step 1: Check Node Topics

  • Connect SSH to the robot to open the terminal and enter the following command to enable the robot chassis node.
  • [Note: The robot chassis node cannot be restarted repeatedly, otherwise an error occurs. If the previous chassis node is not closed, it does not need to be restarted.]
roslaunch jetbot_pro jetbot.launch #Start the robot chassis node

Robot Movement Control07.png

  • Open the Ubuntu virtual machine terminal and enter the following command in the terminal to view the topic of the chassis node.
rostopic list.
  • If the content shown in the figure below appears after running the code, it means that the multi-device communication is successful; if it cannot be connected, recheck whether the IP and hostname in the above steps are incorrect or whether they are connected to the same WiFi.

Robot Movement Control08.png

    • /cmd_vel is the topic of robot motion speed and is controlled by itself.
    • /imu is the robot IMU topic.
    • /motor/* topics indicate the actual encoded speed and set the speed of the left and right motors.
    • /odom encodes the odometer for the robot.
    • /odom_combined is the robot fusion odometer, which is obtained by combining the encoded odometer with IMU data.

Step 2: Display data waveform via rqt-plot

  • You can run the following command in the virtual machine terminal to open the data waveform display tool.
rosrun rqt_plot rqt_plot
  • Enter the topic of the motor in /Topic, and click + to add a topic to display the data waveform of the current motor.
  • Use the keyboard or remote control handle to control the movement of the robot to observe the changes of the motor curve. [especially when there is a problem with the motor operation, you can also check the waveform to determine the abnormality.]

Node Topics with ROS01.png

  • In the above figure, /motor/lset and /motor/rset represent the coded speed set by the left and right motors, and /motor/lvel and /motor/rvel represent the coded speed of the left and right motors actually running. This encoding speed indicates the number of pulses output by the encoder in one cycle (20ms).
  • If the data waveform display speed is too fast, you can click the icon to set the range of the X-axis and Y-axis, as shown in the figure below to set the range of the X-axis.

Node Topics with ROS02.png

Step 3: Adjust PID parameters through rqt-reconfigura

  • If the motor display waveform is not ideal, the response speed is slow, etc., you can adjust the motor operation effect by modifying the PID value. Run the following command to start the dynamic parameter adjustment graphical interface.
rosrun rqt_reconfigure rqt_reconfigure

Ode Topics with ROS03.png

  • The PID parameters can be adjusted in combination with the target and the actual waveform to achieve better operating results. The motor speed is adjusted by incremental PID, firstly adjusting Ki, then adjusting Kp, and finally adjusting Kd, or Kd is set to 0.
  • Dynamic parameter adjustment will only affect the running effect of this time, the parameters will not be saved in the parameter file, and will not affect the next startup. If the self-adjusted PID parameters are better, you can save the parameters to the configuration file and modify the jetbot_pro/cfg/pid.cfg file to save the parameters.

[Note: Non-professionals should not adjust the PID parameters at will, otherwise the robot may move abnormally due to unreasonable parameters, strange phenomena may occur, and the drive circuit may even be burned out.]
Ode Topics with ROS04.png

Step 4: View robot odometer information via RVIZ image tool

  • Enter the following command in the virtual machine to start the RVIZ graphics tool.
 rviz

Node Topics with ROS07.png

  • Add TF components as shown below:

Node Topics with ROS08.png

  • Click Fixed Frame and select odem, you can see three TF coordinates, control the car to move forward for a certain distance, and you can see that the base_footprint and base_imu_link coordinates also move at the same time.
  • odom can be understood as the original position of the robot, odom is the origin, base_footprint is the robot coordinates, and base_imu_link is the robot IMU coordinates.
  • Note: If the base_footprint coordinate keeps rotating, it is because the chassis master is not in a static state on the plane when it is started, and the IMU calibration data is inaccurate. Put the car on the plane and do not move, then press the reset button to restart the chassis master for a while and then run the node program.
  • Fixed Frame Select odem, you can see three TF coordinates, control the car to move forward for a certain distance [The premise of controlling the movement of the car is to start the sports topic interface, you can refer to "Step 4" to reopen a terminal and run the control topic], It can be seen that the base_footprint and base_imu_link coordinates are also moved at the same time.

Node Topics with ROS09.png

Step 5: View coordinate relationship through TF tree

  • Re-open a terminal in the virtual machine and run the following command to view the relationship between the three TF coordinates through the TF tree.
rosrun rqt_tf_tree rqt_tf_tree

Node Topics with ROS10.png

  • The odem->base_footprint coordinate transformation is issued by the /robot_pose_ekf node, and the TF transformation is obtained by fusing the encoded odometer and IMU data; base_footprint->base_imu_link is the static coordinate transformation issued by the /base_footprint_to_imu node.

Step 6: View Robot IMU Information via RVIZ Image Tool

  • Run the rviz command in the virtual machine to start the RVIZ graphics tool and add the rviz_plugin_tutorials/Imu component.
rviz

Node Topics with ROS12.png

  • Fixed Frame select base_footprint, Imu Topico select /imu to view IMU information. The picture shows a purple upward arrow. If you tip the car, you can find that the purple arrow will tip too.

Node Topics with ROS13.png