Update LSLiDAR driver and AGV configs
1. LSLiDAR driver: - Fixed packet header check in serial parser - Updated angle compensation for M10 series - Fixed angle discontinuity bug - Added optional PointCloud2 publishing - Added optional LaserScan publishing - Added support for ROS 2 Humble - Added support for dual-echo LiDARs - Added TXT-based config loading 2. RViz: - Updated gmapping.rviz file for SLAM display 3. AGV bringup: - Modified launch file for LSN10P integration
This commit is contained in:
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import LifecycleNode
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
|
||||
import lifecycle_msgs.msg
|
||||
import os
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
driver_dir_1 = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10_1.yaml')
|
||||
driver_dir_2 = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10_2.yaml')
|
||||
|
||||
driver_node_1 = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node', #设置激光数据topic名称
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='lidar_1',
|
||||
parameters=[driver_dir_1],
|
||||
)
|
||||
|
||||
driver_node_2 = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node', #设置激光数据topic名称
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='lidar_2',
|
||||
parameters=[driver_dir_2],
|
||||
)
|
||||
|
||||
rviz_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'rviz', 'lslidar.rviz')
|
||||
|
||||
rviz_node = Node(
|
||||
package='rviz2',
|
||||
namespace='',
|
||||
executable='rviz2',
|
||||
name='rviz2',
|
||||
arguments=['-d', rviz_dir],
|
||||
output='screen')
|
||||
|
||||
return LaunchDescription([
|
||||
driver_node_1,
|
||||
driver_node_2,
|
||||
rviz_node,
|
||||
])
|
||||
|
||||
Regular → Executable
+2
-2
@@ -11,7 +11,7 @@ import os
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
driver_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml')
|
||||
driver_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params','lidar_uart_ros2', 'lsn10p.yaml')
|
||||
|
||||
driver_node = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
@@ -23,6 +23,6 @@ def generate_launch_description():
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
driver_node
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python3
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import LifecycleNode
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
|
||||
import lifecycle_msgs.msg
|
||||
import os
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
rviz2_config = os.path.join(get_package_share_directory('lslidar_driver'),'rviz','lslidar.rviz')
|
||||
|
||||
rviz2_node = Node(
|
||||
package='rviz2',
|
||||
executable='rviz2',
|
||||
name='rviz2',
|
||||
arguments=['-d',rviz2_config],
|
||||
output='screen')
|
||||
|
||||
return LaunchDescription([
|
||||
rviz2_node,
|
||||
])
|
||||
|
||||
Regular → Executable
Regular → Executable
+1
-1
@@ -10,7 +10,7 @@
|
||||
lidar_name: N10_P #雷达选择:M10 M10_P M10_PLUS M10_GPS N10 L10 N10_P
|
||||
angle_disable_min: 0.0 #角度裁剪开始值
|
||||
angle_disable_max: 0.0 #角度裁剪结束值
|
||||
min_range: 0.0 #雷达接收距离最小值
|
||||
min_range: 0.2 #雷达接收距离最小值
|
||||
max_range: 200.0 #雷达接收距离最大值
|
||||
use_gps_ts: false #雷达是否使用GPS授时
|
||||
scan_topic: /scan #设置激光数据topic名称
|
||||
@@ -1,25 +0,0 @@
|
||||
/lidar_1/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser_link #激光坐标
|
||||
group_ip: 224.1.1.2
|
||||
add_multicast: false
|
||||
device_ip: 192.168.1.200 #雷达源ip
|
||||
device_ip_difop: 192.168.1.102 #雷达目的IP
|
||||
msop_port: 2368 #雷达目的端口号
|
||||
difop_port: 2369 #雷达源端口号
|
||||
lidar_name: M10 #雷达选择:M10 M10_P M10_PLUS M10_GPS N10 L10
|
||||
angle_disable_min: 0.0 #角度裁剪开始值
|
||||
angle_disable_max: 90.0 #角度裁剪结束值
|
||||
min_range: 0.0 #雷达接收距离最小值
|
||||
max_range: 200.0 #雷达接收距离最大值
|
||||
use_gps_ts: false #雷达是否使用GPS授时
|
||||
scan_topic: /scan #设置激光数据topic名称
|
||||
interface_selection: serial #接口选择:net 为网口,serial 为串口。
|
||||
serial_port_: /dev/ttyUSB0 #串口连接时的串口号
|
||||
high_reflection: false #M10_P雷达需填写该值,若不确定,请联系技术支持。
|
||||
compensation: true #M10系列是否使用角度补偿功能
|
||||
pubScan: true #是否发布scan话题
|
||||
pubPointCloud2: true #是否发布pointcloud2话题
|
||||
pointcloud_topic: /lslidar_point_cloud #设置激光数据topic名称
|
||||
# pcap: /home/ls/work/2211/M10_P_gps.pcap #雷达是否使用pcap包读取功能
|
||||
# in_file_name: /home/ls/1.txt #雷达是否使用txt文件读取功能
|
||||
@@ -1,25 +0,0 @@
|
||||
/lidar_2/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser_link #激光坐标
|
||||
group_ip: 224.1.1.2
|
||||
add_multicast: false
|
||||
device_ip: 192.168.1.200 #雷达源ip
|
||||
device_ip_difop: 192.168.1.102 #雷达目的IP
|
||||
msop_port: 2368 #雷达目的端口号
|
||||
difop_port: 2369 #雷达源端口号
|
||||
lidar_name: M10_PLUS #雷达选择:M10 M10_P M10_PLUS M10_GPS N10 L10
|
||||
angle_disable_min: 0.0 #角度裁剪开始值
|
||||
angle_disable_max: 90.0 #角度裁剪结束值
|
||||
min_range: 0.0 #雷达接收距离最小值
|
||||
max_range: 200.0 #雷达接收距离最大值
|
||||
use_gps_ts: false #雷达是否使用GPS授时
|
||||
scan_topic: /scan #设置激光数据topic名称
|
||||
interface_selection: net #接口选择:net 为网口,serial 为串口。
|
||||
serial_port_: /dev/ttyUSB0 #串口连接时的串口号
|
||||
high_reflection: false #M10_P雷达需填写该值,若不确定,请联系技术支持。
|
||||
compensation: true #M10系列是否使用角度补偿功能
|
||||
pubScan: true #是否发布scan话题
|
||||
pubPointCloud2: true #是否发布pointcloud2话题
|
||||
pointcloud_topic: /lslidar_point_cloud #设置激光数据topic名称
|
||||
# pcap: /home/ls/work/2211/M10_P_gps.pcap #雷达是否使用pcap包读取功能
|
||||
# in_file_name: /home/ls/1.txt #雷达是否使用txt文件读取功能
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+33
-3
@@ -31,6 +31,14 @@
|
||||
#include "lslidar_driver/lslidar_driver.h"
|
||||
#include <functional>
|
||||
|
||||
int truncated_mode_=0; //多角度屏蔽开关:默认为0,如果需要屏蔽多个角度,则truncated_mode_赋值为1。
|
||||
|
||||
int scan_crop_min[]={0,180}; //雷达屏蔽角度,这里屏蔽角度为135°到225°,
|
||||
//如果要多角度屏蔽,如10~30,50~60,改为:
|
||||
//scan_angle_min[]={10,50};scan_angle_max[]={30,60};
|
||||
int scan_crop_max[]={90,270}; //修改后编译即可
|
||||
|
||||
|
||||
namespace lslidar_driver
|
||||
{
|
||||
|
||||
@@ -82,7 +90,7 @@ namespace lslidar_driver
|
||||
this->declare_parameter<bool>("use_gps_ts", false);
|
||||
this->declare_parameter<bool>("high_reflection", false);
|
||||
this->declare_parameter<bool>("compensation", false);
|
||||
this->declare_parameter<bool>("pubScan", false);
|
||||
this->declare_parameter<bool>("pubScan", true);
|
||||
this->declare_parameter<bool>("pubPointCloud2", false);
|
||||
this->declare_parameter<double>("angle_disable_min", 0.0);
|
||||
this->declare_parameter<double>("angle_disable_max", 0.0);
|
||||
@@ -970,7 +978,9 @@ namespace lslidar_driver
|
||||
if (pubScan)
|
||||
{
|
||||
auto scan = sensor_msgs::msg::LaserScan::UniquePtr(new sensor_msgs::msg::LaserScan());
|
||||
int scan_num = count_num * 2;
|
||||
////int scan_num = count_num * 2;
|
||||
int scan_num = count_num ;
|
||||
|
||||
std::vector<ScanPoint> points;
|
||||
rclcpp::Time start_time;
|
||||
float scan_time;
|
||||
@@ -1017,6 +1027,16 @@ namespace lslidar_driver
|
||||
scan->ranges[point_idx] = (float)dist;
|
||||
scan->intensities[point_idx] = points[i].intensity;
|
||||
}
|
||||
if(truncated_mode_){
|
||||
int len=sizeof(scan_crop_max) / sizeof(scan_crop_max[0]) ;
|
||||
for(int j=0;j<len;++j){
|
||||
if((point_idx>=(scan_crop_min[j]*count_num / 360)) && (point_idx<=(scan_crop_max[j]*count_num / 360))){
|
||||
scan->ranges[point_idx] = std::numeric_limits<float>::infinity();
|
||||
scan->intensities[point_idx] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (points[i + 3000].range == 0.0)
|
||||
{
|
||||
scan->ranges[point_idx + count_num] = std::numeric_limits<float>::infinity();
|
||||
@@ -1027,7 +1047,7 @@ namespace lslidar_driver
|
||||
double dist = points[i+3000].range;
|
||||
scan->ranges[point_idx + count_num] = (float)dist;
|
||||
scan->intensities[point_idx + count_num] = points[i + 3000].intensity;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
scan_pub->publish(std::move(scan));
|
||||
}
|
||||
@@ -1164,6 +1184,16 @@ namespace lslidar_driver
|
||||
scan->ranges[point_idx] = (float)dist;
|
||||
}
|
||||
scan->intensities[point_idx] = points[i].intensity;
|
||||
|
||||
if(truncated_mode_){
|
||||
int len=sizeof(scan_crop_max) / sizeof(scan_crop_max[0]) ;
|
||||
for(int j=0;j<len;++j){
|
||||
if((point_idx>=(scan_crop_min[j]*count_num / 360)) && (point_idx<=(scan_crop_max[j]*count_num / 360))){
|
||||
scan->ranges[point_idx] = std::numeric_limits<float>::infinity();
|
||||
scan->intensities[point_idx] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
scan_pub->publish(std::move(scan));
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
@@ -53,6 +53,6 @@ def generate_launch_description():
|
||||
IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource([os.path.join(
|
||||
get_package_share_directory('lslidar_driver'),'launch'),
|
||||
'/lslidar_launch.py'])
|
||||
'/lsn10p_launch.py'])
|
||||
)
|
||||
])
|
||||
|
||||
@@ -7,6 +7,7 @@ Panels:
|
||||
- /Global Options1
|
||||
- /Status1
|
||||
- /RobotModel1
|
||||
- /LaserScan1
|
||||
Splitter Ratio: 0.5
|
||||
Tree Height: 627
|
||||
- Class: rviz_common/Selection
|
||||
@@ -189,14 +190,14 @@ Visualization Manager:
|
||||
Enabled: true
|
||||
Invert Rainbow: false
|
||||
Max Color: 255; 255; 255
|
||||
Max Intensity: 238
|
||||
Max Intensity: 230
|
||||
Min Color: 0; 0; 0
|
||||
Min Intensity: 6
|
||||
Name: LaserScan
|
||||
Position Transformer: XYZ
|
||||
Selectable: true
|
||||
Size (Pixels): 3
|
||||
Size (m): 0.009999999776482582
|
||||
Size (m): 0.05000000074505806
|
||||
Style: Flat Squares
|
||||
Topic:
|
||||
Depth: 5
|
||||
@@ -211,7 +212,7 @@ Visualization Manager:
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Fixed Frame: odom
|
||||
Fixed Frame: map
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
@@ -254,7 +255,7 @@ Visualization Manager:
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz_default_plugins/Orbit
|
||||
Distance: 6.0411248207092285
|
||||
Distance: 8.487345695495605
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
@@ -290,5 +291,5 @@ Window Geometry:
|
||||
Views:
|
||||
collapsed: true
|
||||
Width: 1200
|
||||
X: 584
|
||||
Y: 77
|
||||
X: 89
|
||||
Y: 85
|
||||
|
||||
Reference in New Issue
Block a user