-
Declared necessary argument and your own
robot_gazebo.urdf.xacro
<xacro:arg name="gpu" default="false"/> <xacro:arg name="organize_cloud" default="false"/> <xacro:property name="gpu" value="$(arg gpu)" /> <xacro:property name="organize_cloud" value="$(arg organize_cloud)" />
-
Include the
velodyne_description
package<xacro:include filename="$(find velodyne_description)/urdf/VLP16.urdf.xacro" />
-
Add LiDAR in the robot
<xacro:VLP-16 parent="base_footprint" name="velodyne" topic="/velodyne_points" organize_cloud="${organize_cloud}" hz="10" samples="440" gpu="${gpu}"> <origin xyz="0 0 0.1" rpy="0 0 0" /> </xacro:VLP-16>
- You could refer to more information from
veloyne_simulator/velodyne_description/urdf/template.urdf.xacro
-
Launch example robot with LiDAR
ros2 launch velodyne_description example.launch.py
-
Launch the LiDAR data process without driver in another terminal
ros2 launch vlp_cartographer vlp_driver.launch.py is_sim:=True
-
A given turtlebot waffle model with VLP-16 is provided in
velodyne_simulator/velodyne_simulator/urdf/sample_robot.urdf.xacro
-
Launch the sample robot
ros2 launch velodyne_description example.launch.py robot:=1
- Connect the LiDAR to power.
- Connect the LiDAR to the computer or router using the provided ethernet cable.
- Connect the LiDAR to the computer using the ethernet cable.
- Open the computer settings and navigate to Network > Wired.
- Set the IPv4 configuration to 'manual' and configure the settings as shown in the image below:
-
Data process as following: raw data -> pointcloud -> laser scan -> slam method
-
Velodyne driver:
velodyne_driver
get the raw data from LiDAR. -
Transform the raw data to pointcloud:
velodyne_pointcloud
-
Transform the pointcloud to laser scan:
velodyne_laserscan
ros2 launch vlp_cartographer vlp_driver.launch.py
- By the above command, the driver, pointcloud and laserscan will be launched.
Topic | Type | Description |
---|---|---|
/velodyne_packets |
velodyne_msgs/VelodyneScan |
raw data |
/velodyne_points |
sensor_msgs/PointCloud2 |
Point cloud message |
/scan |
sensor_msgs/LaserScan |
laser scan message |
-
In another terminal, launch the cartographer node:
ros2 launch vlp_cartographer cartographer_demo.launch.py
-
Build the docker image and workspace
docker compose up --build
-
LiDAR driver
docker exec -it ros2-vlp-ws /home/ros2-essentials/vlp_ws/scripts/lidar-driver-bringup.sh
-
After launching the driver, launch the cartographer in another terminal
docker exec -it ros2-vlp-ws /home/ros2-essentials/vlp_ws/scripts/lidar-slam-bringup.sh