JetRacer ROS AI Kit Tutorial Ⅸ: Enable the Lidar Node

From Waveshare Wiki
Jump to: navigation, search

JetRacer ROS Kit User Guide

Step 1: Enable the Lidar Node

  • Firstly, you need to power on the lidar and make it rotate.
  • Run the following commands to enable the lidar node on the robot.
roslaunch jetracer lidar.launch

JETRACER Enable the Lidar Node01.png

  • If the node can not be enabled, please press the RESET key on the expansion board, and reboot it.
  • If you want to run Is/dev, please check whether the expansion board is connected to Jetson Nano,and whether or not the ttyACM0 and ttyACM11 device is found. [ttyACM0 is for micro-controller communicationn, and ttyACM1 is for lidar communication.]
 ls /dev    

Enable the Lidar Node02.png

Step 2: Check the data and add the component

  • View radar data through the RVIZ tool in a virtual machine. Please enter the following command to open the RVIZ graphical tool interface.
rosrun rviz rviz

Enable the Lidar Node03.png

  • Click "Add" to add the LaserScan component, select the /scan topic for the Topic, and select Laser_frame for the Fixed Frame to see the radar data. The red points in the image are the points scanned by the radar.

Enable the Lidar Node04.png

  • Click "Add" to add the TF component.

Jetracer Enable the Lidar Node.png

  • TF displays two coordinates, where base_footprint is the robot chassis coordinates, laser_frame is the radar coordinates, the radar coordinates, and the chassis coordinates are opposite.

Radar Data Analysis02.png

Step 3: Lidar Data Analysis

  • Run the following command to view the data type of the radar topic /scan.
  rostopic type /scan    

Radar Data Analysis03.png

  • As shown in the figure above, the output type is sensor_msgs/LaserScan, you can enter the following command to view the detailed message structure of LaserScan.
  rosmsg show sensor_msgs/LaserScan  

Radar Data Analysis05.png

  • Among which:
std_msgs/Header header             # Header is also a structure, including seq, stamp, frame_id
      uint32 seq                   # refers to the id that increases in scan order
      time stamp                   # stamp contains the time to start the scan and the time difference from the start of the scan. Note that the scan starts counterclockwise from the front.
string frame_id                    # frame_id is the name of the scanned reference system, which is very important in ROS. The message will be bound to tf to read the data
                                           
float32 angle_min                  # The angle at which to start scanning (rad)
float32 angle_max                  # The angle at which to end the scan (rad)
float32 angle_increment            # The angle to increase with each scan (rad)

float32 time_increment             # measurement interval (second)
float32 scan_time                  # scan interval (second)

float32 range_min                  # Minimum distance (m)
float32 range_max                  # maximum distance (m)

float32[] ranges                   # distance array (m), the length of the array is equal to the scan angle divided by each increment of the angle
float32[] intensities              # device-dependent, intensity array, the same length as ranges
  • Enter the following commands to view the data of the lidar topic "/scan".
rostopic echo /scan  

Jetracer enable Lidar node.png

  • From the data, it can be found that the scanning angle is -3.14 ~ 3.14, that is, a circle of 360 degrees; the radar scanning distance range is 0.15m~12M. The ranges data is the distance data of each angle, and the length of the array is about (angle_max-angle_min)/angle_increment.
  • The A1 radar angle is shown in the figure below. The first data angle of ranges is 0 degrees in the figure (that is, directly in front of the robot), and the last data is 360 degrees.

Radar Data Analysis06.png

Step 4: Filter Lidar Data

  • From the above steps, we know the data format and radar data information sent by the radar, so we can choose to filter the unwanted parts.
  • [Note: Please close the radar node first, otherwise an error will occur if you start the radar node multiple times.]
  • Enter the following command on the robot side to start the radar filter node.
roslaunch jetracer laser_filter.launch        #Start the radar filter node
  • Run the following command on the virtual machine side to open the RVIZ graphical tool interface.
 rosrun rviz rviz    
  • Add LaserScan component, Topic select /filteredscan topic, Fixed Frame select base_footprint; add TF component to display the coordinates of the robot chassis; the red points in the image are the points scanned by the radar. At this time, it can be found that the radar data is only the first half, and the general data behind is filtered out.

Radar Data Analysis08.png

  • Run the following commands to enable the reconfigure parameters interface.
 rosrun rqt_reconfigure rqt_reconfigure    

Radar Data Analysis10.png

  • Among which:
    • laserAngle : Set the effective angle range to detect the angle in front of the robot
    • distance: Set the effective distance, data beyond this distance will be filtered
  • Drag the slider to adjust the parameters, and you can find that the red dot displayed by the radar also changes.