-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add]1. 增加角度裁剪功能,可以在launch文件中配置不显示点云的角度区间;
2. 增加激光扫描方向可设置功能,可以在launch文件中配置; 3. 增加雷达消息的订阅节点; 4. 增加了.gitignore
- Loading branch information
1 parent
9b4ac0b
commit 7e7f67d
Showing
11 changed files
with
194 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.vscode | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
<launch> | ||
<!-- 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="port_name" value ="/dev/ttyUSB0"/> | ||
<param name="frame_id" value="lidar_frame"/> | ||
<param name="product_name" value="LDLiDAR_LD06"/> | ||
<param name="topic_name" value="LiDAR/LD06"/> | ||
<param name="port_name" value ="/dev/ttyUSB0"/> | ||
<param name="frame_id" value="lidar_frame"/> | ||
<!-- 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"/> --> | ||
<param name="laser_scan_dir" type="bool" value="true"/> | ||
<!-- Angle crop setting, Mask data within the set angle range --> | ||
<!-- 1. Enable angle crop fuction: --> | ||
<!-- 1.1. enable angle crop, example: <param name="enable_angle_crop_func" type="bool" value="true"/> --> | ||
<!-- 1.2. disable angle crop, example: <param name="enable_angle_crop_func" type="bool" value="false"/> --> | ||
<param name="enable_angle_crop_func" type="bool" value="false"/> | ||
<!-- 2. Angle cropping interval setting, The distance and intensity data within the set angle range will be set to 0 --> | ||
<!-- angle >= "angle_crop_min" and angle <= "angle_crop_max", unit is degress --> | ||
<param name="angle_crop_min" type="double" value="135.0"/> | ||
<param name="angle_crop_max" type="double" value="225.0"/> | ||
</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"/> | ||
</node> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
<launch> | ||
<!-- 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="port_name" value ="/dev/ttyUSB0"/> | ||
<param name="frame_id" value="lidar_frame"/> | ||
<param name="product_name" value="LDLiDAR_LD19"/> | ||
<param name="topic_name" value="LiDAR/LD19"/> | ||
<param name="port_name" value ="/dev/ttyUSB0"/> | ||
<param name="frame_id" value="lidar_frame"/> | ||
<!-- 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"/> --> | ||
<param name="laser_scan_dir" type="bool" value="true"/> | ||
<!-- Angle crop setting, Mask data within the set angle range --> | ||
<!-- 1. Enable angle crop fuction: --> | ||
<!-- 1.1. enable angle crop, example: <param name="enable_angle_crop_func" type="bool" value="true"/> --> | ||
<!-- 1.2. disable angle crop, example: <param name="enable_angle_crop_func" type="bool" value="false"/> --> | ||
<param name="enable_angle_crop_func" type="bool" value="false"/> | ||
<!-- 2. Angle cropping interval setting, The distance and intensity data within the set angle range will be set to 0 --> | ||
<!-- angle >= "angle_crop_min" and angle <= "angle_crop_max", unit is degress --> | ||
<param name="angle_crop_min" type="double" value="135.0"/> | ||
<param name="angle_crop_max" type="double" value="225.0"/> | ||
</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"/> | ||
</node> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* @file listen_node.cpp | ||
* @author LDRobot ([email protected]) | ||
* @brief | ||
* @version 0.1 | ||
* @date 2022.04.08 | ||
* @note | ||
* @copyright Copyright (c) 2020 SHENZHEN LDROBOT CO., LTD. All rights reserved. | ||
* Licensed under the MIT License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License in the file LICENSE | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
**/ | ||
|
||
#include "listen_node.h" | ||
|
||
#include <ros/ros.h> | ||
#include <sensor_msgs/LaserScan.h> | ||
|
||
#include <string> | ||
#include <stdlib.h> | ||
|
||
#define RADIAN_TO_DEGREES(angle) ((angle)*180000/3141.59) | ||
|
||
void LidarMsgCallback(const sensor_msgs::LaserScan::ConstPtr& data) | ||
{ | ||
unsigned int lens = (data->angle_max - data->angle_min) / data->angle_increment; | ||
ROS_INFO_STREAM("[ldrobot] angle_min: " << RADIAN_TO_DEGREES(data->angle_min) << " " | ||
<< "angle_max: " << RADIAN_TO_DEGREES(data->angle_max)); | ||
|
||
for (unsigned int i = 0; i < lens; i++) { | ||
ROS_INFO_STREAM("[ldrobot] angle: " << RADIAN_TO_DEGREES((data->angle_min + i * data->angle_increment)) << " " | ||
<< "range: " << data->ranges[i] << " " | ||
<< "intensites: " << data->intensities[i]); | ||
} | ||
ROS_INFO_STREAM("----------------------------"); | ||
} | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
ros::init(argc, argv, "ldldiar_listen_node"); | ||
ros::NodeHandle nh; // create a ROS Node | ||
ros::NodeHandle n("~"); | ||
std::string topic_name; | ||
|
||
n.getParam("topic_name", topic_name); | ||
|
||
if (topic_name.empty()) { | ||
ROS_ERROR("[ldrobot] input param <topic_name> is null"); | ||
exit(EXIT_FAILURE); | ||
} else { | ||
ROS_INFO("[ldrobot] input param <topic_name> is %s", topic_name.c_str()); | ||
} | ||
|
||
ros::Subscriber msg_subs = nh.subscribe(topic_name, 1, &LidarMsgCallback); | ||
ROS_INFO("[ldrobot] start ldldiar message subscribe node"); | ||
|
||
ros::Rate loop_rate(10); | ||
while (ros::ok()) { | ||
ros::spinOnce(); | ||
loop_rate.sleep(); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/********************* (C) COPYRIGHT SHENZHEN LDROBOT CO., LTD *******END OF FILE ********/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @file listen_node.h | ||
* @author LDRobot ([email protected]) | ||
* @brief | ||
* @version 0.1 | ||
* @date 2022.04.08 | ||
* @note | ||
* @copyright Copyright (c) 2021 SHENZHEN LDROBOT CO., LTD. All rights reserved. | ||
**/ | ||
|
||
#ifndef __LISTEN_NODE_H__ | ||
#define __LISTEN_NODE_H__ | ||
|
||
|
||
|
||
|
||
|
||
#endif //__LISTEN_NODE_H__ | ||
/********************* (C) COPYRIGHT SHENZHEN LDROBOT CO., LTD *******END OF FILE ********/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters