Skip to content

Commit

Permalink
[update]内容更新点如下:
Browse files Browse the repository at this point in the history
1. 增加launch文件启动激光雷达节点并显示数据在Rviz上的功能;
2. 更新README
  • Loading branch information
ldrobotsensor committed Apr 30, 2022
1 parent 426bf63 commit 78da1d3
Show file tree
Hide file tree
Showing 12 changed files with 317 additions and 60 deletions.
3 changes: 2 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"includePath": [
"${workspaceFolder}/**",
"/usr/include/**",
"/opt/ros/kinetic/include/**"
"/opt/ros/kinetic/include/**",
"/opt/ros/noetic/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
Expand Down
80 changes: 58 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ $ sudo chmod 777 /dev/ttyUSB0
<!-- ldldiar message publisher node -->
<node name="LD06" pkg="ldlidar_stl_ros" type="ldlidar_stl_ros_node" output="screen" >
<param name="product_name" value="LDLiDAR_LD06"/>
<param name="topic_name" value="LiDAR/LD06"/>
<param name="topic_name" value="scan"/>
<param name="port_name" value ="/dev/ttyUSB0"/>
<param name="frame_id" value="lidar_frame"/>
<param name="frame_id" value="base_laser"/>
<!-- Set laser scan directon: -->
<!-- 1. Set counterclockwise, example: <param name="laser_scan_dir" type="bool" value="true"/> -->
<!-- 2. Set clockwise, example: <param name="laser_scan_dir" type="bool" value="false"/> -->
Expand All @@ -54,8 +54,11 @@ $ sudo chmod 777 /dev/ttyUSB0
</node>
<!-- ldlidar message subscriber node -->
<node name="ListenLD06" pkg="ldlidar_stl_ros" type="ldlidar_stl_ros_listen_node" output="screen">
<param name="topic_name" value="LiDAR/LD06"/>
<param name="topic_name" value="scan"/>
</node>
<!-- publisher tf transform, parents frame is base_link, child frame is base_laser -->
<!-- args="x y z yaw pitch roll parents_frame_id child_frame_id period_in_ms"-->
<node name="base_to_laser" pkg="tf" type="static_transform_publisher" args="0.0 0.0 0.18 0 0.0 0.0 base_link base_laser 50"/>
</launch>
```
## 2. 编译方法
Expand Down Expand Up @@ -87,30 +90,44 @@ $ catkin_make
### 3.2. 启动激光雷达节点

- 产品型号为 LDROBOT LiDAR LD06

- 启动ld06 lidar node:
``` bash
$ roslaunch ldlidar_stl_ros ld06.launch
```
- 启动ld06 lidar node并显示激光数据在Rviz上:
``` bash
roslaunch ldlidar_stl_ros ld06.launch
# if ROS_DISTRO in 'kinetic' or 'melodic'
$ roslaunch ldlidar_stl_ros viewer_ld06_kinetic_melodic.launch
# if ROS_DISTRO in 'noetic'
$ roslaunch ldlidar_stl_ros viewer_ld06_noetic.launch
```

- 产品型号为 LDROBOT LiDAR LD19

- 启动ld19 lidar node:
``` bash
roslaunch ldlidar_stl_ros ld19.launch
$ roslaunch ldlidar_stl_ros ld19.launch
```
- 启动ld19 lidar node并显示激光数据在Rviz上:
``` bash
# if ROS_DISTRO in 'kinetic' or 'melodic'
$ roslaunch ldlidar_stl_ros viewer_ld19_kinetic_melodic.launch
# if ROS_DISTRO in 'noetic'
$ roslaunch ldlidar_stl_ros viewer_ld19_noetic.launch
```

## 4. 测试

> 代码支持ubuntu16.04 ROS kinetic、ubuntu18.04 ROS melodic、ubuntu20.04 ROS noetic版本下测试,使用rviz可视化。

- 新打开一个终端 (Ctrl + Alt + T),并通过Rviz工具打开readme文件所在目录的rviz文件夹下面的ldlidar.rviz文件
- 新打开一个终端 (Ctrl + Alt + T),并通过Rviz工具打开readme文件所在目录的rviz文件夹下面的rviz配置文件
```bash
rosrun rviz rviz
$ rviz
```

| 产品型号: | Fixed Frame: | Topic: |
| ------------------ | ------------ | ------------- |
| LDROBOT LiDAR LD06 | lidar_frame | /LiDAR/LD06 |
| LDROBOT LiDAR LD19 | lidar_frame | /LiDAR/LD19 |
| LDROBOT LiDAR LD06 | base_laser | /scan |
| LDROBOT LiDAR LD19 | base_laser | /scan |


# Instructions
Expand Down Expand Up @@ -149,9 +166,9 @@ $ sudo chmod 777 /dev/ttyUSB0
<!-- ldldiar message publisher node -->
<node name="LD06" pkg="ldlidar_stl_ros" type="ldlidar_stl_ros_node" output="screen" >
<param name="product_name" value="LDLiDAR_LD06"/>
<param name="topic_name" value="LiDAR/LD06"/>
<param name="topic_name" value="scan"/>
<param name="port_name" value ="/dev/ttyUSB0"/>
<param name="frame_id" value="lidar_frame"/>
<param name="frame_id" value="base_laser"/>
<!-- Set laser scan directon: -->
<!-- 1. Set counterclockwise, example: <param name="laser_scan_dir" type="bool" value="true"/> -->
<!-- 2. Set clockwise, example: <param name="laser_scan_dir" type="bool" value="false"/> -->
Expand All @@ -168,8 +185,11 @@ $ sudo chmod 777 /dev/ttyUSB0
</node>
<!-- ldlidar message subscriber node -->
<node name="ListenLD06" pkg="ldlidar_stl_ros" type="ldlidar_stl_ros_listen_node" output="screen">
<param name="topic_name" value="LiDAR/LD06"/>
<param name="topic_name" value="scan"/>
</node>
<!-- publisher tf transform, parents frame is base_link, child frame is base_laser -->
<!-- args="x y z yaw pitch roll parents_frame_id child_frame_id period_in_ms"-->
<node name="base_to_laser" pkg="tf" type="static_transform_publisher" args="0.0 0.0 0.18 0 0.0 0.0 base_link base_laser 50"/>
</launch>
```
## step 2: build
Expand Down Expand Up @@ -201,25 +221,41 @@ $ catkin_make
### step3.2: start LiDAR node

- The product is LDROBOT LiDAR LD06

- start ld06 lidar node:
``` bash
roslaunch ldlidar_stl_ros ld06.launch
$ roslaunch ldlidar_stl_ros ld06.launch
```
- start ld06 lidar node and show on the Rviz:
``` bash
# if ROS_DISTRO in 'kinetic' or 'melodic'
$ roslaunch ldlidar_stl_ros viewer_ld06_kinetic_melodic.launch
# if ROS_DISTRO in 'noetic'
$ roslaunch ldlidar_stl_ros viewer_ld06_noetic.launch
```

- The product is LDROBOT LiDAR LD19

- start ld19 lidar node:
``` bash
roslaunch ldlidar_stl_ros ld19.launch
$ roslaunch ldlidar_stl_ros ld19.launch
```
- start ld19 lidar node and show on the Rviz:
``` bash
# if ROS_DISTRO in 'kinetic' or 'melodic'
$ roslaunch ldlidar_stl_ros viewer_ld19_kinetic_melodic.launch
# if ROS_DISTRO in 'noetic'
$ roslaunch ldlidar_stl_ros viewer_ld19_noetic.launch
```

## step 4: test

> The code was tested under ubuntu16.04 ROS kinetic、ubuntu18.04 ROS melodic、ubuntu20.04 ROS noetic, using rviz visualization.

- new a terminal (Ctrl + Alt + T) and use Rviz tool,open the `ldlidar.rviz` file below the rviz folder of the readme file directory
- new a terminal (Ctrl + Alt + T) and use Rviz tool,open the rviz config file below the rviz folder of the readme file directory
```bash
rosrun rviz rviz
$ rviz
```

| Product: | Fixed Frame: | Topic: |
| ------------------ | ------------ | ------------- |
| LDROBOT LiDAR LD06 | lidar_frame | /LiDAR/LD06 |
| LDROBOT LiDAR LD19 | lidar_frame | /LiDAR/LD19 |
| LDROBOT LiDAR LD06 | base_laser | /scan |
| LDROBOT LiDAR LD19 | base_laser | /scan |
9 changes: 6 additions & 3 deletions launch/ld06.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- ldldiar message publisher node -->
<node name="LD06" pkg="ldlidar_stl_ros" type="ldlidar_stl_ros_node" output="screen" >
<param name="product_name" value="LDLiDAR_LD06"/>
<param name="topic_name" value="LiDAR/LD06"/>
<param name="topic_name" value="scan"/>
<param name="port_name" value ="/dev/ttyUSB0"/>
<param name="frame_id" value="lidar_frame"/>
<param name="frame_id" value="base_laser"/>
<!-- Set laser scan directon: -->
<!-- 1. Set counterclockwise, example: <param name="laser_scan_dir" type="bool" value="true"/> -->
<!-- 2. Set clockwise, example: <param name="laser_scan_dir" type="bool" value="false"/> -->
Expand All @@ -21,6 +21,9 @@
</node>
<!-- ldlidar message subscriber node -->
<node name="ListenLD06" pkg="ldlidar_stl_ros" type="ldlidar_stl_ros_listen_node" output="screen">
<param name="topic_name" value="LiDAR/LD06"/>
<param name="topic_name" value="scan"/>
</node>
<!-- publisher tf transform, parents frame is base_link, child frame is base_laser -->
<!-- args="x y z yaw pitch roll parents_frame_id child_frame_id period_in_ms"-->
<node name="base_to_laser" pkg="tf" type="static_transform_publisher" args="0.0 0.0 0.18 0 0.0 0.0 base_link base_laser 50"/>
</launch>
9 changes: 6 additions & 3 deletions launch/ld19.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- ldldiar message publisher node -->
<node name="LD19" pkg="ldlidar_stl_ros" type="ldlidar_stl_ros_node" output="screen" >
<param name="product_name" value="LDLiDAR_LD19"/>
<param name="topic_name" value="LiDAR/LD19"/>
<param name="topic_name" value="scan"/>
<param name="port_name" value ="/dev/ttyUSB0"/>
<param name="frame_id" value="lidar_frame"/>
<param name="frame_id" value="base_laser"/>
<!-- Set laser scan directon: -->
<!-- 1. Set counterclockwise, example: <param name="laser_scan_dir" type="bool" value="true"/> -->
<!-- 2. Set clockwise, example: <param name="laser_scan_dir" type="bool" value="false"/> -->
Expand All @@ -21,6 +21,9 @@
</node>
<!-- ldlidar message subscriber node -->
<node name="ListenLD19" pkg="ldlidar_stl_ros" type="ldlidar_stl_ros_listen_node" output="screen">
<param name="topic_name" value="LiDAR/LD19"/>
<param name="topic_name" value="scan"/>
</node>
<!-- publisher tf transform, parents frame is base_link, child frame is base_laser -->
<!-- args="x y z yaw pitch roll parents_frame_id child_frame_id period_in_ms"-->
<node name="base_to_laser" pkg="tf" type="static_transform_publisher" args="0.0 0.0 0.18 0 0.0 0.0 base_link base_laser 50"/>
</launch>
4 changes: 4 additions & 0 deletions launch/viewer_ld06_kinetic_melodic.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<launch>
<include file="$(find ldlidar_stl_ros)/launch/ld06.launch" />
<node name="rviz_show_ldlidar" pkg="rviz" type="rviz" args="-d $(find ldlidar_stl_ros)/rviz/ldlidar_kinetic_melodic.rviz" required="true"/>
</launch>
4 changes: 4 additions & 0 deletions launch/viewer_ld06_noetic.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<launch>
<include file="$(find ldlidar_stl_ros)/launch/ld06.launch" />
<node name="rviz_show_ldlidar" pkg="rviz" type="rviz" args="-d $(find ldlidar_stl_ros)/rviz/ldlidar_noetic.rviz" required="true"/>
</launch>
4 changes: 4 additions & 0 deletions launch/viewer_ld19_kinetic_melodic.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<launch>
<include file="$(find ldlidar_stl_ros)/launch/ld19.launch" />
<node name="rviz_show_ldlidar" pkg="rviz" type="rviz" args="-d $(find ldlidar_stl_ros)/rviz/ldlidar_kinetic_melodic.rviz" required="true"/>
</launch>
4 changes: 4 additions & 0 deletions launch/viewer_ld19_noetic.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<launch>
<include file="$(find ldlidar_stl_ros)/launch/ld19.launch" />
<node name="rviz_show_ldlidar" pkg="rviz" type="rviz" args="-d $(find ldlidar_stl_ros)/rviz/ldlidar_noetic.rviz" required="true"/>
</launch>
74 changes: 46 additions & 28 deletions rviz/ldlidar.rviz → rviz/ldlidar_kinetic_melodic.rviz
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
Panels:
- Class: rviz/Displays
Help Height: 121
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Grid1
- /Status1
- /LaserScan1
- /Axes1
Splitter Ratio: 0.5
Tree Height: 551
Tree Height: 565
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /Interact1
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Expand Down Expand Up @@ -50,14 +48,41 @@ Visualization Manager:
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 100
Plane Cell Count: 20
Reference Frame: <Fixed Frame>
Value: true
- Class: rviz/Axes
Enabled: false
Length: 1
Name: Axes
Radius: 0.100000001
Reference Frame: <Fixed Frame>
Value: false
- Class: rviz/TF
Enabled: true
Frame Timeout: 15
Frames:
All Enabled: true
base_laser:
Value: true
base_link:
Value: true
Marker Scale: 1
Name: TF
Show Arrows: true
Show Axes: true
Show Names: true
Tree:
base_link:
base_laser:
{}
Update Interval: 0
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 0
Min Value: 0
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Expand All @@ -68,33 +93,26 @@ Visualization Manager:
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Max Intensity: 246
Max Intensity: 245
Min Color: 0; 0; 0
Min Intensity: 25
Min Intensity: 22
Name: LaserScan
Position Transformer: XYZ
Queue Size: 100
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.00999999978
Style: Points
Topic: /LiDAR/LD06
Topic: /scan
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Class: rviz/Axes
Enabled: true
Length: 1
Name: Axes
Radius: 0.100000001
Reference Frame: <Fixed Frame>
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Default Light: true
Fixed Frame: lidar_frame
Fixed Frame: base_laser
Frame Rate: 30
Name: root
Tools:
Expand All @@ -115,7 +133,7 @@ Visualization Manager:
Views:
Current:
Class: rviz/Orbit
Distance: 13.4815817
Distance: 7.74400043
Enable Stereo Rendering:
Stereo Eye Separation: 0.0599999987
Stereo Focal Distance: 1
Expand All @@ -125,23 +143,23 @@ Visualization Manager:
X: 0
Y: 0
Z: 0
Focal Shape Fixed Size: false
Focal Shape Fixed Size: true
Focal Shape Size: 0.0500000007
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.00999999978
Pitch: 1.56979632
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 3.16039586
Yaw: 3.13039947
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 902
Height: 846
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd0000000400000000000001c5000002fffc0200000007fc00000028000002ff000000f50100001dfa000000000100000002fb000000100044006900730070006c0061007900730100000000ffffffff0000016a00fffffffb0000001200530065006c0065006300740069006f006e0100000000000001c50000007200fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001c20000015000000185000000ecfb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c000002610000000100000162000002fffc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730100000028000002ff000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007450000003bfc0100000002fb0000000800540069006d00650100000000000007450000030000fffffffb0000000800540069006d0065010000000000000450000000000000000000000412000002ff00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
QMainWindow State: 000000ff00000000fd00000004000000000000016a000002c4fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006100fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000028000002c4000000d700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002c4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730100000028000002c4000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b00000030000fffffffb0000000800540069006d006501000000000000045000000000000000000000022b000002c400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
Expand All @@ -150,6 +168,6 @@ Window Geometry:
collapsed: false
Views:
collapsed: false
Width: 1861
X: 57
Y: 24
Width: 1200
X: 344
Y: 32
Loading

0 comments on commit 78da1d3

Please sign in to comment.