改了一下ekf的源码,让odom不再完全相信轮式里程计;手贱删了个.git里的文件导致文件全部重新存,看不了diff了
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
# lslidar
|
||||
|
||||
## Description
|
||||
The `lslidar package is a linux ROS2 driver for lslidar M10 ,M10_GPS,M10_P,M10_PLUS and N10.
|
||||
The package is tested on Ubuntu 20.04 with ROS2 indigo.
|
||||
|
||||
## Compling
|
||||
This is a Catkin package. Make sure the package is on `ROS_PACKAGE_PATH` after cloning the package to your workspace. And the normal procedure for compling a catkin package will work.
|
||||
|
||||
```
|
||||
cd your_work_space
|
||||
colcon build
|
||||
source install/setup.bash
|
||||
ros2 launch lslidar_driver lslidar_launch.py
|
||||
```
|
||||
open new terminal
|
||||
ros2 topic pub -1 /lslidar_order std_msgs/msg/Int8 data:\ 1\ (open radar)
|
||||
ros2 topic pub -1 /lslidar_order std_msgs/msg/Int8 data:\ 0\ (close radar)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ros2 launch lslidar_driver lslidar_launch.py
|
||||
|
||||
```
|
||||
|
||||
Note that this launch file launches both the driver, which is the only launch file needed to be used.
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
|
||||
## Bug Report
|
||||
|
||||
Prefer to open an issue. You can also send an E-mail to honghangli@lslidar.com
|
||||
|
||||
|
||||
|
||||
|
||||
RERTION
|
||||
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(lslidar_driver)
|
||||
|
||||
# Default to C++14
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
set(libpcap_LIBRARIES -lpcap)
|
||||
|
||||
#set(FastRTPS_INCLUDE_DIR /opt/ros/foxy/include)
|
||||
#set(FastRTPS_LIBRARY_RELEASE /opt/ros/foxy/lib/libfastrtps.so)
|
||||
|
||||
#find_package(Boost REQUIRED COMPONENTS )
|
||||
find_package(Boost REQUIRED thread)
|
||||
find_package(rclcpp REQUIRED)
|
||||
find_package(PCL REQUIRED)
|
||||
find_package(diagnostic_updater REQUIRED)
|
||||
find_package(lslidar_msgs REQUIRED)
|
||||
find_package(std_msgs REQUIRED)
|
||||
find_package(ament_cmake REQUIRED)
|
||||
find_package(pluginlib REQUIRED)
|
||||
find_package(rclpy REQUIRED)
|
||||
find_package(pcl_conversions REQUIRED)
|
||||
find_package(sensor_msgs REQUIRED)
|
||||
#find_package(PCL REQUIRED COMPONENTS common io)
|
||||
|
||||
include_directories(
|
||||
include
|
||||
${PCL_INCLUDE_DIRS}
|
||||
${PCL_COMMON_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# Node
|
||||
add_executable(lslidar_driver_node src/lslidar_driver_node.cc src/lslidar_driver.cc src/input.cc src/lsiosr.cpp)
|
||||
target_link_libraries(lslidar_driver_node ${rclcpp_LIBRARIES} ${libpcap_LIBRARIES} ${Boost_LIBRARIES} Boost::thread)
|
||||
ament_target_dependencies(lslidar_driver_node rclcpp std_msgs lslidar_msgs sensor_msgs diagnostic_updater pcl_conversions)
|
||||
|
||||
|
||||
install(DIRECTORY launch params rviz
|
||||
DESTINATION share/${PROJECT_NAME})
|
||||
|
||||
install(TARGETS
|
||||
lslidar_driver_node
|
||||
DESTINATION lib/${PROJECT_NAME}
|
||||
)
|
||||
|
||||
ament_export_dependencies(rclcpp pluginlib lslidar_msgs sensor_msgs pcl_conversions)
|
||||
ament_export_include_directories(include ${PCL_COMMON_INCLUDE_DIRS})
|
||||
|
||||
ament_package()
|
||||
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* This file is part of lslidar_ch driver.
|
||||
*
|
||||
* The driver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The driver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the driver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Input -- base class used to access the data independently of
|
||||
* its source
|
||||
*
|
||||
* InputSocket -- derived class reads live data from the device
|
||||
* via a UDP socket
|
||||
*
|
||||
* InputPCAP -- derived class provides a similar interface from a
|
||||
* PCAP dump
|
||||
*/
|
||||
|
||||
#ifndef __LSLIDAR_INPUT_H_
|
||||
#define __LSLIDAR_INPUT_H_
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
#include <netinet/in.h>
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include <lslidar_msgs/msg/lslidar_packet.hpp>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/file.h>
|
||||
#include <signal.h>
|
||||
#include <sensor_msgs/msg/time_reference.hpp>
|
||||
#include <std_msgs/msg/int8.hpp>
|
||||
#include <cmath>
|
||||
|
||||
namespace lslidar_driver
|
||||
{
|
||||
static uint16_t MSOP_DATA_PORT_NUMBER = 2368; // lslidar default data port on PC
|
||||
/**
|
||||
* 从在线的网络数据或离线的网络抓包数据(pcap文件)中提取出lidar的原始数据,即packet数据包
|
||||
* @brief The Input class,
|
||||
*
|
||||
* @param private_nh 一个NodeHandled,用于通过节点传递参数
|
||||
* @param port
|
||||
* @returns 0 if successful,
|
||||
* -1 if end of file
|
||||
* >0 if incomplete packet (is this possible?)
|
||||
*/
|
||||
class Input
|
||||
{
|
||||
public:
|
||||
Input(rclcpp::Node* private_nh, uint16_t port);
|
||||
|
||||
virtual ~Input()
|
||||
{
|
||||
}
|
||||
|
||||
virtual int getPacket(lslidar_msgs::msg::LslidarPacket::UniquePtr &packet) = 0;
|
||||
|
||||
int getRpm(void);
|
||||
int getReturnMode(void);
|
||||
bool getUpdateFlag(void);
|
||||
void clearUpdateFlag(void);
|
||||
void UDP_order(const std_msgs::msg::Int8 msg);
|
||||
void UDP_difop();
|
||||
protected:
|
||||
rclcpp::Node* private_nh_;
|
||||
uint16_t port_;
|
||||
std::string devip_str_;
|
||||
std::string lidar_name;
|
||||
int cur_rpm_;
|
||||
int return_mode_;
|
||||
bool npkt_update_flag_;
|
||||
bool add_multicast;
|
||||
std::string group_ip;
|
||||
int UDP_PORT_NUMBER_DIFOP;
|
||||
int socket_id_difop;
|
||||
int sockfd_;
|
||||
std::string devip_str_difop;
|
||||
};
|
||||
|
||||
/** @brief Live lslidar input from socket. */
|
||||
class InputSocket : public Input
|
||||
{
|
||||
public:
|
||||
InputSocket(rclcpp::Node* private_nh, uint16_t port = MSOP_DATA_PORT_NUMBER);
|
||||
|
||||
virtual ~InputSocket();
|
||||
|
||||
virtual int getPacket(lslidar_msgs::msg::LslidarPacket::UniquePtr &packet);
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
in_addr devip_;
|
||||
in_addr devip_difop;
|
||||
//struct ip_mreq group;
|
||||
|
||||
};
|
||||
class InputPCAP : public Input
|
||||
{
|
||||
public:
|
||||
InputPCAP(rclcpp::Node* private_nh,uint16_t port = MSOP_DATA_PORT_NUMBER, double packet_rate = 0.0,
|
||||
std::string filename="");
|
||||
virtual ~InputPCAP();
|
||||
virtual int getPacket(lslidar_msgs::msg::LslidarPacket::UniquePtr &pkt);
|
||||
private:
|
||||
|
||||
rclcpp::Rate packet_rate_;
|
||||
std::string filename_;
|
||||
pcap_t *pcap_;
|
||||
bpf_program pcap_packet_filter_;
|
||||
char errbuf_[PCAP_ERRBUF_SIZE];
|
||||
bool empty_;
|
||||
bool read_once_;
|
||||
bool read_fast_;
|
||||
double repeat_delay_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __LSLIDAR_INPUT_H
|
||||
@@ -1,88 +0,0 @@
|
||||
/*******************************************************
|
||||
@company: Copyright (C) 2021, Leishen Intelligent System
|
||||
@product: LSM10_N10
|
||||
@filename: lsiosr.cpp
|
||||
@brief:
|
||||
@version: date: author: comments:
|
||||
@v1.0 22-10-24 li new
|
||||
*******************************************************/
|
||||
#ifndef LSIOSR_H
|
||||
#define LSIOSR_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
//波特率
|
||||
#define BAUD_230400 230400
|
||||
#define BAUD_460800 460800
|
||||
#define BAUD_500000 500000
|
||||
#define BAUD_921600 921600
|
||||
|
||||
//奇偶校验位
|
||||
#define PARITY_ODD 'O' //奇数
|
||||
#define PARITY_EVEN 'E' //偶数
|
||||
#define PARITY_NONE 'N' //无奇偶校验位
|
||||
|
||||
//停止位
|
||||
#define STOP_BIT_1 1
|
||||
#define STOP_BIT_2 2
|
||||
|
||||
//数据位
|
||||
#define DATA_BIT_7 7
|
||||
#define DATA_BIT_8 8
|
||||
|
||||
namespace lslidar_driver
|
||||
{
|
||||
class LSIOSR{
|
||||
public:
|
||||
static LSIOSR* instance(std::string name, int speed, int fd = 0);
|
||||
|
||||
~LSIOSR();
|
||||
|
||||
/* 从串口中读取数据 */
|
||||
int read(unsigned char *buffer, int length, int timeout = 30);
|
||||
|
||||
/* 向串口传数据 */
|
||||
int send(const char* buffer, int length, int timeout = 30);
|
||||
|
||||
/* Empty serial port input buffer */
|
||||
void flushinput();
|
||||
|
||||
/* 串口初始化 */
|
||||
int init();
|
||||
|
||||
int close();
|
||||
|
||||
/* 获取串口号 */
|
||||
std::string getPort();
|
||||
|
||||
/* 设置串口号 */
|
||||
int setPortName(std::string name);
|
||||
|
||||
private:
|
||||
LSIOSR(std::string name, int speed, int fd);
|
||||
|
||||
int waitWritable(int millis);
|
||||
int waitReadable(int millis);
|
||||
|
||||
/* 串口配置的函数 */
|
||||
int setOpt(int nBits, uint8_t nEvent, int nStop);
|
||||
|
||||
std::string port_;
|
||||
int baud_rate_;
|
||||
|
||||
int fd_;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
/*
|
||||
* This file is part of lslidar driver.
|
||||
*
|
||||
* The driver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The driver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the driver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LSLIDAR_DRIVER_H
|
||||
#define LSLIDAR_DRIVER_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <netinet/in.h>
|
||||
#include <string>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include <thread>
|
||||
#include "diagnostic_updater/diagnostic_updater.hpp"
|
||||
#include "diagnostic_updater/publisher.hpp"
|
||||
#include "lslidar_msgs/msg/lslidar_packet.hpp"
|
||||
#include "std_msgs/msg/byte.hpp"
|
||||
|
||||
#include "sensor_msgs/msg/point_cloud2.hpp"
|
||||
#include "pcl_conversions/pcl_conversions.h"
|
||||
#include "pcl/point_types.h"
|
||||
|
||||
#include "time.h"
|
||||
#include "input.h"
|
||||
#include "lsiosr.h"
|
||||
#include "sensor_msgs/msg/laser_scan.hpp"
|
||||
namespace lslidar_driver {
|
||||
|
||||
struct PointXYZIT {
|
||||
PCL_ADD_POINT4D;
|
||||
uint8_t intensity;
|
||||
double timestamp;
|
||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW // make sure our new allocators are aligned
|
||||
} EIGEN_ALIGN16;
|
||||
|
||||
typedef struct {
|
||||
double degree;
|
||||
double range;
|
||||
double intensity;
|
||||
} ScanPoint;
|
||||
|
||||
class LslidarDriver: public rclcpp::Node {
|
||||
public:
|
||||
LslidarDriver();
|
||||
LslidarDriver(const rclcpp::NodeOptions& options);
|
||||
~LslidarDriver();
|
||||
|
||||
bool initialize();
|
||||
bool polling();
|
||||
|
||||
typedef std::shared_ptr<LslidarDriver> LslidarDriverPtr;
|
||||
typedef std::shared_ptr<const LslidarDriver> LslidarDriverConstPtr;
|
||||
|
||||
private:
|
||||
uint64_t get_gps_stamp(struct tm t);
|
||||
uint8_t N10_CalCRC8(unsigned char * p, int len);
|
||||
bool loadParameters();
|
||||
bool createRosIO();
|
||||
void open_serial();
|
||||
void lidar_difop();
|
||||
void lidar_order(const std_msgs::msg::Int8::SharedPtr msg);
|
||||
void data_processing(unsigned char *packet_bytes,int len);
|
||||
void data_processing_2(unsigned char *packet_bytes,int len);
|
||||
void difop_processing(unsigned char *packet_bytes);
|
||||
void pubScanThread();
|
||||
void recvThread_crc(int &count,int &link_time);
|
||||
int receive_data(unsigned char *packet_bytes);
|
||||
int getScan(std::vector<ScanPoint> &points, rclcpp::Time &scan_time, float &scan_duration);
|
||||
|
||||
boost::thread *pubscan_thread_ ;
|
||||
boost::shared_ptr<Input> msop_input_;
|
||||
boost::mutex mutex_;
|
||||
boost::mutex pubscan_mutex_;
|
||||
boost::condition_variable pubscan_cond_;
|
||||
int UDP_PORT_NUMBER;
|
||||
int count_num;
|
||||
int package_points;
|
||||
int data_bits_start;
|
||||
int degree_bits_start;
|
||||
int end_degree_bits_start;
|
||||
int rpm_bits_start;
|
||||
int baud_rate_;
|
||||
int points_size_;
|
||||
int idx = 0;
|
||||
int link_time = 0;
|
||||
int fixed_array_length;//cyy_add
|
||||
|
||||
bool use_gps_ts;
|
||||
bool is_start;
|
||||
bool high_reflection;
|
||||
bool compensation;
|
||||
bool first_compensation = true;
|
||||
bool pubScan;
|
||||
bool pubPointCloud2;
|
||||
|
||||
double min_range;
|
||||
double max_range;
|
||||
double angle_disable_min;
|
||||
double angle_disable_max;
|
||||
double angle_able_min;
|
||||
double angle_able_max;
|
||||
double last_degree = 0.0;
|
||||
double degree_compensation = 0.0;
|
||||
|
||||
uint16_t PACKET_SIZE ;
|
||||
uint64_t sweep_end_time_gps;
|
||||
uint64_t sweep_end_time_hardware;
|
||||
uint64_t sub_second;
|
||||
|
||||
std::string frame_id;
|
||||
std::string interface_selection;
|
||||
std::string scan_topic;
|
||||
std::string lidar_name;
|
||||
std::string serial_port_;
|
||||
std::string dump_file;
|
||||
std::string pointcloud_topic;
|
||||
std::string in_file_name;
|
||||
|
||||
tm pTime;
|
||||
rclcpp::Time pre_time_;
|
||||
rclcpp::Time time_;
|
||||
std::vector<ScanPoint> scan_points_;
|
||||
std::vector<ScanPoint> scan_points_bak_;
|
||||
// Diagnostics updater
|
||||
diagnostic_updater::Updater diagnostics;
|
||||
std::shared_ptr<diagnostic_updater::TopicDiagnostic> diag_topic;
|
||||
double diag_min_freq;
|
||||
double diag_max_freq;
|
||||
rclcpp::Publisher<sensor_msgs::msg::LaserScan>::SharedPtr scan_pub;
|
||||
rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr point_cloud_pub;
|
||||
rclcpp::Subscription<std_msgs::msg::Int8>::SharedPtr difop_switch;
|
||||
LSIOSR * serial_;
|
||||
};
|
||||
typedef PointXYZIT VPoint;
|
||||
typedef pcl::PointCloud<VPoint> VPointCloud;
|
||||
|
||||
} // namespace lslidar_driver
|
||||
POINT_CLOUD_REGISTER_POINT_STRUCT(lslidar_driver::PointXYZIT,
|
||||
(float, x, x)(float, y, y)(float, z, z)(
|
||||
std::uint8_t, intensity,
|
||||
intensity)(double, timestamp, timestamp))
|
||||
#endif // _LSLIDAR_DRIVER_H_
|
||||
@@ -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_n10p'), 'params', 'lsx10_1.yaml')
|
||||
driver_dir_2 = os.path.join(get_package_share_directory('lslidar_driver_n10p'), 'params', 'lsx10_2.yaml')
|
||||
|
||||
driver_node_1 = LifecycleNode(package='lslidar_driver_n10p',
|
||||
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_n10p',
|
||||
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,
|
||||
])
|
||||
|
||||
@@ -1,27 +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 = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lidar_net_ros2','lsm10_net.yaml')
|
||||
|
||||
driver_node = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node',
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='',
|
||||
parameters=[driver_dir],
|
||||
)
|
||||
return LaunchDescription([
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -1,27 +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 = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lidar_uart_ros2','lsm10.yaml')
|
||||
|
||||
driver_node = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node',
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='',
|
||||
parameters=[driver_dir],
|
||||
)
|
||||
return LaunchDescription([
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -1,27 +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 = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lidar_net_ros2','lsm10p_net.yaml')
|
||||
|
||||
driver_node = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node',
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='',
|
||||
parameters=[driver_dir],
|
||||
)
|
||||
return LaunchDescription([
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -1,27 +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 = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lidar_uart_ros2','lsm10_p.yaml')
|
||||
|
||||
driver_node = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node',
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='',
|
||||
parameters=[driver_dir],
|
||||
)
|
||||
return LaunchDescription([
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -1,28 +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 = os.path.join(get_package_share_directory('lslidar_driver'), 'params','lidar_uart_ros2', 'lsn10.yaml')
|
||||
|
||||
driver_node = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node', #设置激光数据topic名称
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='',
|
||||
parameters=[driver_dir],
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -1,28 +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 = os.path.join(get_package_share_directory('lslidar_driver'), 'params','lidar_net_ros2', 'lsn10_net.yaml')
|
||||
|
||||
driver_node = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node', #设置激光数据topic名称
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='',
|
||||
parameters=[driver_dir],
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -1,28 +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 = 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',
|
||||
name='lslidar_driver_node', #设置激光数据topic名称
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='',
|
||||
parameters=[driver_dir],
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -1,28 +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 = os.path.join(get_package_share_directory('lslidar_driver'), 'params','lidar_net_ros2', 'lsn10p_net.yaml')
|
||||
|
||||
driver_node = LifecycleNode(package='lslidar_driver',
|
||||
executable='lslidar_driver_node',
|
||||
name='lslidar_driver_node', #设置激光数据topic名称
|
||||
output='screen',
|
||||
emulate_tty=True,
|
||||
namespace='',
|
||||
parameters=[driver_dir],
|
||||
)
|
||||
|
||||
return LaunchDescription([
|
||||
driver_node,
|
||||
])
|
||||
|
||||
@@ -1,26 +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():
|
||||
|
||||
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,
|
||||
])
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<package format="2">
|
||||
<name>lslidar_driver</name>
|
||||
<version>1.2.0</version>
|
||||
<description>ROS device driver for Leishen lidar.</description>
|
||||
<maintainer email="shaohuashu@lslidar.com">Nick Shu</maintainer>
|
||||
<author>Nick Shu</author>
|
||||
<license>GNU General Public License V3.0</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
|
||||
<build_depend>rclcpp</build_depend>
|
||||
<build_depend>std_msgs</build_depend>
|
||||
<build_depend>lslidar_msgs</build_depend>
|
||||
<build_depend>pcl_conversions</build_depend>
|
||||
<build_depend>rclpy</build_depend>
|
||||
<build_depend>libpcap</build_depend>
|
||||
<build_depend>libpcl-all-dev</build_depend>
|
||||
<build_depend>pluginlib</build_depend>
|
||||
<build_depend>sensor_msgs</build_depend>
|
||||
|
||||
<exec_depend>rclcpp</exec_depend>
|
||||
<exec_depend>std_msgs</exec_depend>
|
||||
<exec_depend>lslidar_msgs</exec_depend>
|
||||
<exec_depend>pcl_conversions</exec_depend>
|
||||
<exec_depend>rclpy</exec_depend>
|
||||
<exec_depend>libpcap</exec_depend>
|
||||
<exec_depend>libpcl-all</exec_depend>
|
||||
<exec_depend>pluginlib</exec_depend>
|
||||
<exec_depend>sensor_msgs</exec_depend>
|
||||
|
||||
<depend>diagnostic_updater</depend>
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
@@ -1,22 +0,0 @@
|
||||
/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser #激光坐标
|
||||
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
|
||||
ceil_increase: -1 #Lsm10*时改值应设置为-1
|
||||
angle_disable_min: 0.0 #单角度裁剪开始值
|
||||
angle_disable_max: 0.0 #单角度裁剪结束值
|
||||
truncated_mode_: 0 #多角度裁剪开关:值为0时表示不使用多角度裁剪,默认为0
|
||||
#值为1表示使用多角度裁剪,同时angle_disable_min与angle_disable_max设为 0,角度值在/lslidar_driver.cc中修改
|
||||
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/wheeltec_laser #串口连接时的串口号
|
||||
# pcap: /home/ls/work/2211/M10_P_gps.pcap #雷达是否使用pcap包读取功能
|
||||
@@ -1,22 +0,0 @@
|
||||
/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser #激光坐标
|
||||
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_P #雷达选择:M10 M10_P M10_PLUS M10_GPS N10
|
||||
ceil_increase: -1 #Lsm10*时改值应设置为-1
|
||||
angle_disable_min: 0.0 #单角度裁剪开始值
|
||||
angle_disable_max: 0.0 #单角度裁剪结束值
|
||||
truncated_mode_: 0 #多角度裁剪开关:值为0时表示不使用多角度裁剪,默认为0
|
||||
#值为1表示使用多角度裁剪,同时angle_disable_min与angle_disable_max设为 0,角度值在/lslidar_driver.cc中修改
|
||||
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/wheeltec_laser #串口连接时的串口号
|
||||
# pcap: /home/ls/work/2211/M10_P_gps.pcap #雷达是否使用pcap包读取功能
|
||||
@@ -1,25 +0,0 @@
|
||||
/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser #激光坐标
|
||||
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: N10 #雷达选择:M10 M10_P M10_PLUS M10_GPS N10 L10 N10_P
|
||||
angle_disable_min: 0.0 #角度裁剪开始值
|
||||
angle_disable_max: 0.0 #角度裁剪结束值
|
||||
min_range: 0.2 #雷达接收距离最小值
|
||||
max_range: 200.0 #雷达接收距离最大值
|
||||
use_gps_ts: false #雷达是否使用GPS授时
|
||||
scan_topic: /scan #设置激光数据topic名称
|
||||
interface_selection: net #接口选择:net 为网口,serial 为串口。
|
||||
serial_port_: /dev/wheeltec_laser #串口连接时的串口号
|
||||
high_reflection: false #M10_P雷达需填写该值,若不确定,请联系技术支持。
|
||||
compensation: false #M10系列是否使用角度补偿功能
|
||||
pubScan: true #是否发布scan话题
|
||||
pubPointCloud2: false #是否发布pointcloud2话题
|
||||
pointcloud_topic: /lslidar_point_cloud #设置激光数据topic名称
|
||||
# pcap: /home/ls/1.pcap #雷达是否使用pcap包读取功能
|
||||
# in_file_name: /home/ls/1.txt #雷达是否使用txt文件读取功能
|
||||
@@ -1,25 +0,0 @@
|
||||
/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser #激光坐标
|
||||
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: N10_P #雷达选择:M10 M10_P M10_PLUS M10_GPS N10 L10 N10_P
|
||||
angle_disable_min: 120.0 #角度裁剪开始值
|
||||
angle_disable_max: 230.0 #角度裁剪结束值
|
||||
min_range: 0.2 #雷达接收距离最小值
|
||||
max_range: 200.0 #雷达接收距离最大值
|
||||
use_gps_ts: false #雷达是否使用GPS授时
|
||||
scan_topic: /scan #设置激光数据topic名称
|
||||
interface_selection: net #接口选择:net 为网口,serial 为串口。
|
||||
serial_port_: /dev/wheeltec_laser #串口连接时的串口号
|
||||
high_reflection: false #M10_P雷达需填写该值,若不确定,请联系技术支持。
|
||||
compensation: false #M10系列是否使用角度补偿功能
|
||||
pubScan: true #是否发布scan话题
|
||||
pubPointCloud2: false #是否发布pointcloud2话题
|
||||
pointcloud_topic: /lslidar_point_cloud #设置激光数据topic名称
|
||||
# pcap: /home/ls/1.pcap #雷达是否使用pcap包读取功能
|
||||
# in_file_name: /home/ls/1.txt #雷达是否使用txt文件读取功能
|
||||
@@ -1,28 +0,0 @@
|
||||
/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser #激光坐标
|
||||
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
|
||||
ceil_increase: -1 #Lsm10*时改值应设置为-1
|
||||
angle_disable_min: 0.0 #单角度裁剪开始值
|
||||
angle_disable_max: 0.0 #单角度裁剪结束值
|
||||
truncated_mode_: 0 #多角度裁剪开关:值为0时表示不使用多角度裁剪,默认为0
|
||||
#值为1表示使用多角度裁剪,同时angle_disable_min与angle_disable_max设为 0,角度值在/lslidar_driver.cc中修改
|
||||
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/wheeltec_laser #串口连接时的串口号
|
||||
high_reflection: false #M10_P雷达需填写该值,若不确定,请联系技术支持。
|
||||
compensation: false #M10系列是否使用角度补偿功能
|
||||
pubScan: true #是否发布scan话题
|
||||
pubPointCloud2: false #是否发布pointcloud2话题
|
||||
pointcloud_topic: /lslidar_point_cloud #设置激光数据topic名称
|
||||
# pcap: /home/ls/1.pcap #雷达是否使用pcap包读取功能
|
||||
# in_file_name: /home/ls/1.txt #雷达是否使用txt文件读取功能
|
||||
@@ -1,28 +0,0 @@
|
||||
/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser #激光坐标
|
||||
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_P #雷达选择:M10 M10_P M10_PLUS M10_GPS N10
|
||||
ceil_increase: -1 #Lsm10*时改值应设置为-1
|
||||
angle_disable_min: 0.0 #单角度裁剪开始值
|
||||
angle_disable_max: 0.0 #单角度裁剪结束值
|
||||
truncated_mode_: 0 #多角度裁剪开关:值为0时表示不使用多角度裁剪,默认为0
|
||||
#值为1表示使用多角度裁剪,同时angle_disable_min与angle_disable_max设为 0,角度值在/lslidar_driver.cc中修改
|
||||
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/wheeltec_laser #串口连接时的串口号
|
||||
high_reflection: false #M10_P雷达需填写该值,若不确定,请联系技术支持。
|
||||
compensation: false #M10系列是否使用角度补偿功能
|
||||
pubScan: true #是否发布scan话题
|
||||
pubPointCloud2: false #是否发布pointcloud2话题
|
||||
pointcloud_topic: /lslidar_point_cloud #设置激光数据topic名称
|
||||
# pcap: /home/ls/1.pcap #雷达是否使用pcap包读取功能
|
||||
# in_file_name: /home/ls/1.txt #雷达是否使用txt文件读取功能
|
||||
@@ -1,26 +0,0 @@
|
||||
/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: N10 #雷达选择:M10 M10_P M10_PLUS M10_GPS N10 L10 N10_P
|
||||
angle_disable_min: 0.0 #角度裁剪开始值
|
||||
angle_disable_max: 0.0 #角度裁剪结束值
|
||||
min_range: 0.15 #雷达接收距离最小值
|
||||
max_range: 200.0 #雷达接收距离最大值
|
||||
use_gps_ts: false #雷达是否使用GPS授时
|
||||
scan_topic: /scan #设置激光数据topic名称
|
||||
interface_selection: serial #接口选择:net 为网口,serial 为串口。
|
||||
serial_port_: /dev/ttyCH343USB0 #串口连接时的串口号
|
||||
high_reflection: false #M10_P雷达需填写该值,若不确定,请联系技术支持。
|
||||
compensation: false #M10系列是否使用角度补偿功能
|
||||
pubScan: true #是否发布scan话题
|
||||
pubPointCloud2: false #是否发布pointcloud2话题
|
||||
pointcloud_topic: /lslidar_point_cloud #设置激光数据topic名称
|
||||
fixed_array_length: 450
|
||||
# pcap: /home/ls/1.pcap #雷达是否使用pcap包读取功能
|
||||
# in_file_name: /home/ls/1.txt #雷达是否使用txt文件读取功能
|
||||
@@ -1,25 +0,0 @@
|
||||
/lslidar_driver_node:
|
||||
ros__parameters:
|
||||
frame_id: laser #激光坐标
|
||||
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: N10_P #雷达选择:M10 M10_P M10_PLUS M10_GPS N10 L10 N10_P
|
||||
angle_disable_min: 120.0 #角度裁剪开始值
|
||||
angle_disable_max: 230.0 #角度裁剪结束值
|
||||
min_range: 0.2 #雷达接收距离最小值
|
||||
max_range: 200.0 #雷达接收距离最大值
|
||||
use_gps_ts: false #雷达是否使用GPS授时
|
||||
scan_topic: /scan #设置激光数据topic名称
|
||||
interface_selection: serial #接口选择:net 为网口,serial 为串口。
|
||||
serial_port_: /dev/wheeltec_laser #串口连接时的串口号
|
||||
high_reflection: false #M10_P雷达需填写该值,若不确定,请联系技术支持。
|
||||
compensation: false #M10系列是否使用角度补偿功能
|
||||
pubScan: true #是否发布scan话题
|
||||
pubPointCloud2: false #是否发布pointcloud2话题
|
||||
pointcloud_topic: /lslidar_point_cloud #设置激光数据topic名称
|
||||
# pcap: /home/ls/1.pcap #雷达是否使用pcap包读取功能
|
||||
# in_file_name: /home/ls/1.txt #雷达是否使用txt文件读取功能
|
||||
@@ -1,161 +0,0 @@
|
||||
Panels:
|
||||
- Class: rviz_common/Displays
|
||||
Help Height: 78
|
||||
Name: Displays
|
||||
Property Tree Widget:
|
||||
Expanded:
|
||||
- /Global Options1
|
||||
- /Status1
|
||||
- /LaserScan1
|
||||
Splitter Ratio: 0.3441176414489746
|
||||
Tree Height: 617
|
||||
- Class: rviz_common/Selection
|
||||
Name: Selection
|
||||
- Class: rviz_common/Tool Properties
|
||||
Expanded:
|
||||
- /2D Goal Pose1
|
||||
- /Publish Point1
|
||||
Name: Tool Properties
|
||||
Splitter Ratio: 0.5886790156364441
|
||||
- Class: rviz_common/Views
|
||||
Expanded:
|
||||
- /Current View1
|
||||
Name: Views
|
||||
Splitter Ratio: 0.5
|
||||
Visualization Manager:
|
||||
Class: ""
|
||||
Displays:
|
||||
- Alpha: 0.5
|
||||
Cell Size: 1
|
||||
Class: rviz_default_plugins/Grid
|
||||
Color: 160; 160; 164
|
||||
Enabled: true
|
||||
Line Style:
|
||||
Line Width: 0.029999999329447746
|
||||
Value: Lines
|
||||
Name: Grid
|
||||
Normal Cell Count: 0
|
||||
Offset:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Plane: XY
|
||||
Plane Cell Count: 10
|
||||
Reference Frame: <Fixed Frame>
|
||||
Value: true
|
||||
- Alpha: 1
|
||||
Autocompute Intensity Bounds: true
|
||||
Autocompute Value Bounds:
|
||||
Max Value: 10
|
||||
Min Value: -10
|
||||
Value: true
|
||||
Axis: Z
|
||||
Channel Name: intensity
|
||||
Class: rviz_default_plugins/LaserScan
|
||||
Color: 255; 255; 255
|
||||
Color Transformer: Intensity
|
||||
Decay Time: 0
|
||||
Enabled: true
|
||||
Invert Rainbow: false
|
||||
Max Color: 255; 255; 255
|
||||
Max Intensity: 0
|
||||
Min Color: 0; 0; 0
|
||||
Min Intensity: 0
|
||||
Name: LaserScan
|
||||
Position Transformer: XYZ
|
||||
Selectable: true
|
||||
Size (Pixels): 3
|
||||
Size (m): 0.009999999776482582
|
||||
Style: Flat Squares
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
Filter size: 10
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: scan
|
||||
Use Fixed Frame: true
|
||||
Use rainbow: true
|
||||
Value: true
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Fixed Frame: laser
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
- Class: rviz_default_plugins/Interact
|
||||
Hide Inactive Objects: true
|
||||
- Class: rviz_default_plugins/MoveCamera
|
||||
- Class: rviz_default_plugins/Select
|
||||
- Class: rviz_default_plugins/FocusCamera
|
||||
- Class: rviz_default_plugins/Measure
|
||||
Line color: 128; 128; 0
|
||||
- Class: rviz_default_plugins/SetInitialPose
|
||||
Covariance x: 0.25
|
||||
Covariance y: 0.25
|
||||
Covariance yaw: 0.06853891909122467
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /initialpose
|
||||
- Class: rviz_default_plugins/SetGoal
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /goal_pose
|
||||
- Class: rviz_default_plugins/PublishPoint
|
||||
Single click: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /clicked_point
|
||||
Transformation:
|
||||
Current:
|
||||
Class: rviz_default_plugins/TF
|
||||
Value: true
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz_default_plugins/Orbit
|
||||
Distance: 3.635173797607422
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Focal Point:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Focal Shape Fixed Size: true
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: Current View
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: 0.8653978705406189
|
||||
Target Frame: <Fixed Frame>
|
||||
Value: Orbit (rviz)
|
||||
Yaw: 3.095397710800171
|
||||
Saved: ~
|
||||
Window Geometry:
|
||||
Displays:
|
||||
collapsed: false
|
||||
Height: 846
|
||||
Hide Left Dock: false
|
||||
Hide Right Dock: false
|
||||
QMainWindow State: 000000ff00000000fd000000040000000000000156000002f4fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d000002f4000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002f4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000002f4000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d0065010000000000000450000000000000000000000292000002f400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
Selection:
|
||||
collapsed: false
|
||||
Tool Properties:
|
||||
collapsed: false
|
||||
Views:
|
||||
collapsed: false
|
||||
Width: 1283
|
||||
X: 406
|
||||
Y: 152
|
||||
@@ -1,398 +0,0 @@
|
||||
#include "lslidar_driver/input.h"
|
||||
|
||||
extern volatile sig_atomic_t flag;
|
||||
namespace lslidar_driver
|
||||
{
|
||||
static const size_t packet_size_input = 400;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Input base class implementation
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/** @brief constructor
|
||||
*
|
||||
* @param private_nh ROS private handle for calling node.
|
||||
* @param port UDP port number.
|
||||
*/
|
||||
Input::Input(rclcpp::Node *private_nh, uint16_t port) : private_nh_(private_nh), port_(port) {
|
||||
npkt_update_flag_ = false;
|
||||
cur_rpm_ = 0;
|
||||
return_mode_ = 1;
|
||||
devip_str_difop = std::string("192.168.1.200");
|
||||
devip_str_ = std::string("192.168.1.102");
|
||||
lidar_name = std::string("M10");
|
||||
add_multicast = false;
|
||||
group_ip = std::string("224.1.1.2");
|
||||
UDP_PORT_NUMBER_DIFOP = 2369;
|
||||
|
||||
|
||||
private_nh->declare_parameter<std::string>("device_ip","192.168.1.102");
|
||||
private_nh->declare_parameter<std::string>("device_ip_difop","192.168.1.200");
|
||||
private_nh->declare_parameter<bool>("add_multicast",false);
|
||||
private_nh->declare_parameter<std::string>("group_ip","224.1.1.2");
|
||||
private_nh->declare_parameter<int>("difop_port",2369);
|
||||
|
||||
|
||||
private_nh->get_parameter("lidar_name", lidar_name);
|
||||
private_nh->get_parameter("device_ip", devip_str_);
|
||||
private_nh->get_parameter("add_multicast", add_multicast);
|
||||
private_nh->get_parameter("group_ip", group_ip);
|
||||
private_nh->get_parameter("difop_port", UDP_PORT_NUMBER_DIFOP);
|
||||
private_nh->get_parameter("device_ip_difop", devip_str_difop);
|
||||
|
||||
if (!devip_str_.empty())
|
||||
RCLCPP_INFO(private_nh->get_logger(), "[driver][input] accepting packets from IP address: %s port: %d",
|
||||
devip_str_.c_str(),port);
|
||||
}
|
||||
|
||||
/** @brief constructor
|
||||
*
|
||||
* @param private_nh ROS private handle for calling node.
|
||||
* @param port UDP port number
|
||||
*/
|
||||
InputSocket::InputSocket(rclcpp::Node *private_nh, uint16_t port) : Input(private_nh, port) {
|
||||
sockfd_ = -1;
|
||||
|
||||
if (!devip_str_.empty()) {
|
||||
inet_aton(devip_str_.c_str(), &devip_);
|
||||
inet_aton(devip_str_difop.c_str(), &devip_difop);
|
||||
}
|
||||
|
||||
RCLCPP_INFO(private_nh_->get_logger(), "[driver][socket] Opening UDP socket: port %d", port);
|
||||
sockfd_ = socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd_ == -1) {
|
||||
perror("socket"); // TODO: ROS_ERROR errno
|
||||
return;
|
||||
}
|
||||
|
||||
int opt = 1;
|
||||
if (setsockopt(sockfd_, SOL_SOCKET, SO_REUSEADDR, (const void *) &opt, sizeof(opt))) {
|
||||
perror("setsockopt error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sockaddr_in my_addr; // my address information
|
||||
memset(&my_addr, 0, sizeof(my_addr)); // initialize to zeros
|
||||
my_addr.sin_family = AF_INET; // host byte order
|
||||
my_addr.sin_port = htons(port); // port in network byte order
|
||||
my_addr.sin_addr.s_addr = INADDR_ANY; // automatically fill in my IP
|
||||
|
||||
if (bind(sockfd_, (sockaddr * ) & my_addr, sizeof(sockaddr)) == -1) {
|
||||
perror("bind"); // TODO: ROS_ERROR errno
|
||||
return;
|
||||
}
|
||||
|
||||
if (add_multicast) {
|
||||
struct ip_mreq group;
|
||||
group.imr_multiaddr.s_addr = inet_addr(group_ip.c_str());
|
||||
group.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
if (setsockopt(sockfd_, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &group, sizeof(group)) < 0) {
|
||||
perror("Adding multicast group error ");
|
||||
close(sockfd_);
|
||||
exit(1);
|
||||
} else
|
||||
printf("Adding multicast group...OK.\n");
|
||||
}
|
||||
if (fcntl(sockfd_, F_SETFL, O_NONBLOCK | FASYNC) < 0) {
|
||||
perror("non-block");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief destructor */
|
||||
InputSocket::~InputSocket(void) {
|
||||
(void) close(sockfd_);
|
||||
}
|
||||
|
||||
void Input::UDP_difop()
|
||||
{
|
||||
sockaddr_in server_sai;
|
||||
server_sai.sin_family = AF_INET; // IPV4 协议族
|
||||
server_sai.sin_port = htons(UDP_PORT_NUMBER_DIFOP);
|
||||
server_sai.sin_addr.s_addr = inet_addr(devip_str_.c_str());
|
||||
for (int k = 0; k < 10; k++)
|
||||
{
|
||||
unsigned char data[188]= {0x00};
|
||||
data[0] = 0xA5;
|
||||
data[1] = 0x5A;
|
||||
data[2] = 0x55;
|
||||
data[184] = 0x08;
|
||||
data[185] = 0x01;
|
||||
data[186] = 0xFA;
|
||||
data[187] = 0xFB;
|
||||
int rtn = sendto(sockfd_, data, 188, 0, (struct sockaddr *)&server_sai, sizeof(struct sockaddr));
|
||||
if (rtn < 0) printf("start scan error !\n");
|
||||
else return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Input::UDP_order(const std_msgs::msg::Int8 msg)
|
||||
{
|
||||
int i = msg.data;
|
||||
sockaddr_in server_sai;
|
||||
server_sai.sin_family = AF_INET; // IPV4 协议族
|
||||
server_sai.sin_port = htons(UDP_PORT_NUMBER_DIFOP);
|
||||
server_sai.sin_addr.s_addr = inet_addr(devip_str_.c_str());
|
||||
int rtn = 0;
|
||||
for (int k = 0; k < 10; k++)
|
||||
{
|
||||
unsigned char data[188]= {0x00};
|
||||
data[0] = 0xA5;
|
||||
data[1] = 0x5A;
|
||||
data[2] = 0x55;
|
||||
data[186] = 0xFA;
|
||||
data[187] = 0xFB;
|
||||
if(lidar_name == "M10" || lidar_name == "M10_GPS" || lidar_name == "M10_P"){
|
||||
if (i <= 1){ //雷达启停
|
||||
data[184] = 0x01;
|
||||
data[185] = char(i);
|
||||
}
|
||||
else if (i == 2){ //雷达点云不滤波
|
||||
data[181] = 0x0A;
|
||||
data[184] = 0x06;
|
||||
data[185] = 0x01;
|
||||
}
|
||||
else if (i == 3){ //雷达点云正常滤波
|
||||
data[181] = 0x0B;
|
||||
data[184] = 0x06;
|
||||
data[185] = 0x01;
|
||||
}
|
||||
else if (i == 4){ //雷达近距离滤波
|
||||
data[181] = 0x0C;
|
||||
data[184] = 0x06;
|
||||
data[185] = 0x01;
|
||||
}
|
||||
else if (i == 100){ //接收设备包
|
||||
data[184] = 0x08;
|
||||
data[185] = 0x01;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
else if (lidar_name == "M10_PLUS"){
|
||||
data[184] = 0x0A;
|
||||
data[185] = 0x01;
|
||||
if(i == 5) {
|
||||
data[141] = 0x01;
|
||||
data[142] = 0x2c;
|
||||
}
|
||||
else if(i == 6) {
|
||||
data[141] = 0x01;
|
||||
data[142] = 0x68;
|
||||
}
|
||||
else if(i == 8) {
|
||||
data[141] = 0x01;
|
||||
data[142] = 0xe0;
|
||||
}
|
||||
else if(i == 10) {
|
||||
data[141] = 0x02;
|
||||
data[142] = 0x58;
|
||||
}
|
||||
else if(i == 12) {
|
||||
data[141] = 0x02;
|
||||
data[142] = 0xd0;
|
||||
}
|
||||
else if(i == 15) {
|
||||
data[141] = 0x03;
|
||||
data[142] = 0x84;
|
||||
}
|
||||
else if(i == 20) {
|
||||
data[141] = 0x04;
|
||||
data[142] = 0xb0;
|
||||
}
|
||||
else if(i <= 1) {
|
||||
data[184] = 0x01;
|
||||
data[185] = char(i);
|
||||
}
|
||||
else if(i == 100) { //接收设备包
|
||||
data[184] = 0x08;
|
||||
data[185] = 0x01;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
else if(lidar_name == "N10"){
|
||||
if(i <= 1){
|
||||
data[185] = char(i);
|
||||
data[184] = 0x01;
|
||||
}
|
||||
else if(i>=6 && i<=12){
|
||||
data[172] = char(i);
|
||||
data[184] = 0x0a;
|
||||
data[185] = 0X01;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
rtn = sendto(sockfd_, data, 188, 0, (struct sockaddr *)&server_sai, sizeof(struct sockaddr));
|
||||
if (rtn < 0)
|
||||
{
|
||||
printf("start scan error !\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == 1)
|
||||
usleep(3000000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int InputSocket::getPacket(lslidar_msgs::msg::LslidarPacket::UniquePtr &packet)
|
||||
{
|
||||
int q = 0;
|
||||
struct pollfd fds[1];
|
||||
fds[0].fd = sockfd_;
|
||||
fds[0].events = POLLIN;
|
||||
static const int POLL_TIMEOUT = 2000; // one second (in msec)
|
||||
|
||||
sockaddr_in sender_address{};
|
||||
socklen_t sender_address_len = sizeof(sender_address);
|
||||
while (flag == 1)
|
||||
{
|
||||
// poll() until input available
|
||||
do {
|
||||
int retval = poll(fds, 1, POLL_TIMEOUT);
|
||||
if (retval < 0) // poll() error?
|
||||
{
|
||||
if (errno != EINTR)
|
||||
RCLCPP_ERROR(private_nh_->get_logger(), "[driver][socket] poll() error: %s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
if (retval == 0) // poll() timeout?
|
||||
{
|
||||
RCLCPP_WARN(private_nh_->get_logger(), "lslidar poll() timeout, port: %d",port_);
|
||||
return 0;
|
||||
}
|
||||
if ((fds[0].revents & POLLERR) || (fds[0].revents & POLLHUP) || (fds[0].revents & POLLNVAL)) // device error?
|
||||
{
|
||||
RCLCPP_ERROR(private_nh_->get_logger(),"poll() reports lslidar error");
|
||||
return 0;
|
||||
}
|
||||
} while ((fds[0].revents & POLLIN) == 0);
|
||||
|
||||
// Receive packets that should now be available from the
|
||||
// socket using a blocking read.
|
||||
ssize_t nbytes = recvfrom(sockfd_, &packet->data[0], packet_size_input, 0,
|
||||
(sockaddr *)&sender_address, &sender_address_len);
|
||||
// ROS_DEBUG_STREAM("incomplete lslidar packet read: "
|
||||
// << nbytes << " bytes");
|
||||
q = (int)nbytes;
|
||||
if (nbytes < 0)
|
||||
{
|
||||
if (errno != EWOULDBLOCK)
|
||||
{
|
||||
perror("recvfail");
|
||||
RCLCPP_ERROR(private_nh_->get_logger(),"recvfail");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if ((size_t)nbytes <= packet_size_input || (size_t)nbytes >= 50)
|
||||
{
|
||||
|
||||
// read successful,
|
||||
// if packet is not from the lidar scanner we selected by IP,
|
||||
// continue otherwise we are done
|
||||
if (devip_str_ != "" && sender_address.sin_addr.s_addr != devip_.s_addr)
|
||||
continue;
|
||||
else
|
||||
break; // done
|
||||
}
|
||||
|
||||
}
|
||||
if (flag == 0)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
InputPCAP::InputPCAP(rclcpp::Node *private_nh, uint16_t port, double packet_rate, std::string filename) : Input(private_nh, port),
|
||||
packet_rate_(packet_rate),
|
||||
filename_(filename)
|
||||
{
|
||||
pcap_ = NULL;
|
||||
empty_ = true;
|
||||
read_once_ = false;
|
||||
read_fast_ = false;
|
||||
repeat_delay_ = 0.0;
|
||||
private_nh->get_parameter("read_once", read_once_);
|
||||
private_nh->get_parameter("read_fast", read_fast_);
|
||||
private_nh->get_parameter("repeat_delay", repeat_delay_);
|
||||
|
||||
if (read_once_)
|
||||
RCLCPP_WARN(private_nh_->get_logger(),"Read input file only once.");
|
||||
if (read_fast_)
|
||||
RCLCPP_WARN(private_nh_->get_logger(),"Read input file as quickly as possible.");
|
||||
if (repeat_delay_ > 0.0)
|
||||
RCLCPP_WARN(private_nh_->get_logger(),"Delay %.3f seconds before repeating input file.", repeat_delay_);
|
||||
|
||||
RCLCPP_INFO(private_nh_->get_logger(),"Opening PCAP file %s",filename_.c_str());
|
||||
if ((pcap_ = pcap_open_offline(filename_.c_str(), errbuf_)) == NULL)
|
||||
{
|
||||
RCLCPP_WARN(private_nh_->get_logger(),"Error opening lslidar socket dump file.");
|
||||
return;
|
||||
}
|
||||
std::stringstream filter;
|
||||
if (devip_str_ != "")
|
||||
{
|
||||
filter << "src host " << devip_str_ << "&&";
|
||||
}
|
||||
filter << "udp dst port " << port;
|
||||
pcap_compile(pcap_, &pcap_packet_filter_, filter.str().c_str(), 1, PCAP_NETMASK_UNKNOWN);
|
||||
}
|
||||
|
||||
InputPCAP::~InputPCAP(void)
|
||||
{
|
||||
pcap_close(pcap_);
|
||||
}
|
||||
|
||||
int InputPCAP::getPacket(lslidar_msgs::msg::LslidarPacket::UniquePtr &pkt)
|
||||
{
|
||||
struct pcap_pkthdr *header;
|
||||
const u_char *pkt_data;
|
||||
while (flag == 1)
|
||||
{
|
||||
int res;
|
||||
if ((res = pcap_next_ex(pcap_, &header, &pkt_data)) >= 0)
|
||||
{
|
||||
// skip packets not for the correct port and from the selected IP address
|
||||
if (!devip_str_.empty() && (0 == pcap_offline_filter(&pcap_packet_filter_, header, pkt_data)))
|
||||
continue;
|
||||
|
||||
if (read_fast_ == false)
|
||||
packet_rate_.sleep();
|
||||
mempcpy(&pkt->data[0], pkt_data + 42, packet_size_input);
|
||||
empty_ = false;
|
||||
return 0;
|
||||
}
|
||||
if (empty_)
|
||||
{
|
||||
RCLCPP_WARN(private_nh_->get_logger(),"Error %d reading lslidar packet: %s", res, pcap_geterr(pcap_));
|
||||
return -1;
|
||||
}
|
||||
if (read_once_)
|
||||
{
|
||||
RCLCPP_WARN(private_nh_->get_logger(),"end of file reached -- done reading.");
|
||||
return -1;
|
||||
}
|
||||
if (repeat_delay_ > 0.0)
|
||||
{
|
||||
RCLCPP_WARN(private_nh_->get_logger(),"end of file reached -- delaying %.3f seconds.", repeat_delay_);
|
||||
usleep(rint(repeat_delay_ * 1000000.0));
|
||||
}
|
||||
RCLCPP_WARN(private_nh_->get_logger(),"replayding lsliar dump file");
|
||||
|
||||
pcap_close(pcap_);
|
||||
pcap_ = pcap_open_offline(filename_.c_str(), errbuf_);
|
||||
empty_ = true;
|
||||
}
|
||||
if (flag == 0)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -1,400 +0,0 @@
|
||||
/*******************************************************
|
||||
@company: Copyright (C) 2022, Leishen Intelligent System
|
||||
@product: LSM10 and N10
|
||||
@filename: lsiosr.cpp
|
||||
@brief:
|
||||
@version: date: author: comments:
|
||||
@v1.0 21-2-4 yao new
|
||||
*******************************************************/
|
||||
#include "lslidar_driver/lsiosr.h"
|
||||
|
||||
namespace lslidar_driver {
|
||||
|
||||
LSIOSR * LSIOSR::instance(std::string name, int speed, int fd)
|
||||
{
|
||||
static LSIOSR obj(name, speed, fd);
|
||||
return &obj;
|
||||
}
|
||||
|
||||
LSIOSR::LSIOSR(std::string port, int baud_rate, int fd):port_(port), baud_rate_(baud_rate), fd_(fd)
|
||||
{
|
||||
printf("port = %s, baud_rate = %d\n", port.c_str(), baud_rate);
|
||||
}
|
||||
|
||||
LSIOSR::~LSIOSR()
|
||||
{
|
||||
close();
|
||||
}
|
||||
/* 串口配置的函数 */
|
||||
int LSIOSR::setOpt(int nBits, uint8_t nEvent, int nStop)
|
||||
{
|
||||
struct termios newtio, oldtio;
|
||||
/*保存测试现有串口参数设置,在这里如果串口号等出错,会有相关的出错信息*/
|
||||
if (tcgetattr(fd_, &oldtio) != 0)
|
||||
{
|
||||
perror("SetupSerial 1");
|
||||
return -1;
|
||||
}
|
||||
bzero(&newtio, sizeof(newtio));
|
||||
/*步骤一,设置字符大小*/
|
||||
newtio.c_cflag |= CLOCAL; //如果设置,modem 的控制线将会被忽略。如果没有设置,则 open()函数会阻塞直到载波检测线宣告 modem 处于摘机状态为止。
|
||||
newtio.c_cflag |= CREAD; //使端口能读取输入的数据
|
||||
/*设置每个数据的位数*/
|
||||
switch (nBits)
|
||||
{
|
||||
case 7:
|
||||
newtio.c_cflag |= CS7;
|
||||
break;
|
||||
case 8:
|
||||
newtio.c_cflag |= CS8;
|
||||
break;
|
||||
}
|
||||
/*设置奇偶校验位*/
|
||||
switch (nEvent)
|
||||
{
|
||||
case 'O': //奇数
|
||||
newtio.c_iflag |= (INPCK | ISTRIP);
|
||||
newtio.c_cflag |= PARENB; //使能校验,如果不设PARODD则是偶校验
|
||||
newtio.c_cflag |= PARODD; //奇校验
|
||||
break;
|
||||
case 'E': //偶数
|
||||
newtio.c_iflag |= (INPCK | ISTRIP);
|
||||
newtio.c_cflag |= PARENB;
|
||||
newtio.c_cflag &= ~PARODD;
|
||||
break;
|
||||
case 'N': //无奇偶校验位
|
||||
newtio.c_cflag &= ~PARENB;
|
||||
break;
|
||||
}
|
||||
/*设置波特率*/
|
||||
switch (baud_rate_)
|
||||
{
|
||||
case 230400:
|
||||
cfsetispeed(&newtio, B230400);
|
||||
cfsetospeed(&newtio, B230400);
|
||||
break;
|
||||
case 460800:
|
||||
cfsetispeed(&newtio, B460800);
|
||||
cfsetospeed(&newtio, B460800);
|
||||
break;
|
||||
case 500000:
|
||||
cfsetispeed(&newtio, B500000);
|
||||
cfsetospeed(&newtio, B500000);
|
||||
break;
|
||||
case 921600:
|
||||
cfsetispeed(&newtio, B921600);
|
||||
cfsetospeed(&newtio, B921600);
|
||||
break;
|
||||
default:
|
||||
cfsetispeed(&newtio, B460800);
|
||||
cfsetospeed(&newtio, B460800);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* 设置停止位
|
||||
* 设置停止位的位数, 如果设置,则会在每帧后产生两个停止位, 如果没有设置,则产生一个
|
||||
* 停止位。一般都是使用一位停止位。需要两位停止位的设备已过时了。
|
||||
* */
|
||||
if (nStop == 1)
|
||||
newtio.c_cflag &= ~CSTOPB;
|
||||
else if (nStop == 2)
|
||||
newtio.c_cflag |= CSTOPB;
|
||||
/*设置等待时间和最小接收字符*/
|
||||
newtio.c_cc[VTIME] = 0;
|
||||
newtio.c_cc[VMIN] = 0;
|
||||
/*处理未接收字符*/
|
||||
tcflush(fd_, TCIFLUSH);
|
||||
/*激活新配置*/
|
||||
if ((tcsetattr(fd_, TCSANOW, &newtio)) != 0)
|
||||
{
|
||||
perror("serial set error");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LSIOSR::flushinput() {
|
||||
tcflush(fd_, TCIFLUSH);
|
||||
}
|
||||
|
||||
/* 从串口中读取数据 */
|
||||
int LSIOSR::read(unsigned char *buffer, int length, int timeout)
|
||||
{
|
||||
memset(buffer, 0, length);
|
||||
|
||||
int totalBytesRead = 0;
|
||||
int rc;
|
||||
int unlink = 0;
|
||||
unsigned char* pb = buffer;
|
||||
|
||||
if (timeout > 0)
|
||||
{
|
||||
rc = waitReadable(timeout);
|
||||
if (rc <= 0)
|
||||
{
|
||||
return (rc == 0) ? 0 : -1;
|
||||
}
|
||||
|
||||
int retry = 3;
|
||||
while (length > 0)
|
||||
{
|
||||
rc = ::read(fd_, pb, (size_t)length);
|
||||
|
||||
if (rc > 0)
|
||||
{
|
||||
length -= rc;
|
||||
pb += rc;
|
||||
totalBytesRead += rc;
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (rc < 0)
|
||||
{
|
||||
printf("error \n");
|
||||
retry--;
|
||||
if (retry <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
unlink++;
|
||||
rc = waitReadable(20);
|
||||
if(unlink > 10)
|
||||
return -1;
|
||||
|
||||
if (rc <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = ::read(fd_, pb, (size_t)length);
|
||||
|
||||
if (rc > 0)
|
||||
{
|
||||
totalBytesRead += rc;
|
||||
}
|
||||
else if ((rc < 0) && (errno != EINTR) && (errno != EAGAIN))
|
||||
{
|
||||
printf("read error\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return totalBytesRead;
|
||||
}
|
||||
|
||||
int LSIOSR::waitReadable(int millis)
|
||||
{
|
||||
if (fd_ < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int serial = fd_;
|
||||
|
||||
fd_set fdset;
|
||||
struct timeval tv;
|
||||
int rc = 0;
|
||||
|
||||
while (millis > 0)
|
||||
{
|
||||
if (millis < 5000)
|
||||
{
|
||||
tv.tv_usec = millis % 1000 * 1000;
|
||||
tv.tv_sec = millis / 1000;
|
||||
|
||||
millis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = 5;
|
||||
|
||||
millis -= 5000;
|
||||
}
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(serial, &fdset);
|
||||
|
||||
rc = select(serial + 1, &fdset, NULL, NULL, &tv);
|
||||
if (rc > 0)
|
||||
{
|
||||
rc = (FD_ISSET(serial, &fdset)) ? 1 : -1;
|
||||
break;
|
||||
}
|
||||
else if (rc < 0)
|
||||
{
|
||||
rc = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int LSIOSR::waitWritable(int millis)
|
||||
{
|
||||
if (fd_ < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int serial = fd_;
|
||||
|
||||
fd_set fdset;
|
||||
struct timeval tv;
|
||||
int rc = 0;
|
||||
|
||||
while (millis > 0)
|
||||
{
|
||||
if (millis < 5000)
|
||||
{
|
||||
tv.tv_usec = millis % 1000 * 1000;
|
||||
tv.tv_sec = millis / 1000;
|
||||
|
||||
millis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = 5;
|
||||
|
||||
millis -= 5000;
|
||||
}
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(serial, &fdset);
|
||||
|
||||
rc = select(serial + 1, NULL, &fdset, NULL, &tv);
|
||||
if (rc > 0)
|
||||
{
|
||||
rc = (FD_ISSET(serial, &fdset)) ? 1 : -1;
|
||||
break;
|
||||
}
|
||||
else if (rc < 0)
|
||||
{
|
||||
rc = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* 向串口中发送数据 */
|
||||
int LSIOSR::send(const char* buffer, int length, int timeout)
|
||||
{
|
||||
if (fd_ < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((buffer == 0) || (length <= 0))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int totalBytesWrite = 0;
|
||||
int rc;
|
||||
char* pb = (char*)buffer;
|
||||
|
||||
|
||||
if (timeout > 0)
|
||||
{
|
||||
rc = waitWritable(timeout);
|
||||
if (rc <= 0)
|
||||
{
|
||||
return (rc == 0) ? 0 : -1;
|
||||
}
|
||||
|
||||
int retry = 3;
|
||||
while (length > 0)
|
||||
{
|
||||
rc = write(fd_, pb, (size_t)length);
|
||||
if (rc > 0)
|
||||
{
|
||||
length -= rc;
|
||||
pb += rc;
|
||||
totalBytesWrite += rc;
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
retry--;
|
||||
if (retry <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rc = waitWritable(50);
|
||||
if (rc <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = write(fd_, pb, (size_t)length);
|
||||
if (rc > 0)
|
||||
{
|
||||
totalBytesWrite += rc;
|
||||
}
|
||||
else if ((rc < 0) && (errno != EINTR) && (errno != EAGAIN))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return totalBytesWrite;
|
||||
}
|
||||
|
||||
int LSIOSR::init()
|
||||
{
|
||||
int error_code = 0;
|
||||
|
||||
fd_ = open(port_.c_str(), O_RDWR|O_NOCTTY|O_NDELAY);
|
||||
if (0 < fd_)
|
||||
{
|
||||
error_code = 0;
|
||||
setOpt(DATA_BIT_8, PARITY_NONE, STOP_BIT_1);//设置串口参数
|
||||
//printf("open_port %s OK !\n", port_.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
error_code = -1;
|
||||
}
|
||||
|
||||
return error_code;
|
||||
}
|
||||
|
||||
int LSIOSR::close()
|
||||
{
|
||||
::close(fd_);
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string LSIOSR::getPort()
|
||||
{
|
||||
return port_;
|
||||
}
|
||||
|
||||
int LSIOSR::setPortName(std::string name)
|
||||
{
|
||||
port_ = name;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* This file is part of lslidar driver.
|
||||
*
|
||||
* The driver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The driver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the driver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "rclcpp/rclcpp.hpp"
|
||||
#include "lslidar_driver/lslidar_driver.h"
|
||||
|
||||
using namespace lslidar_driver;
|
||||
volatile sig_atomic_t flag = 1;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
rclcpp::init(argc, argv);
|
||||
auto node = std::make_shared<lslidar_driver::LslidarDriver>();
|
||||
|
||||
while (rclcpp::ok() && node->polling()) {
|
||||
rclcpp::spin_some(node);
|
||||
}
|
||||
//rclcpp::spin(node);
|
||||
rclcpp::shutdown();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(lslidar_msgs)
|
||||
|
||||
# Default to C99
|
||||
if(NOT CMAKE_C_STANDARD)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
endif()
|
||||
|
||||
# Default to C++14
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
# find dependencies
|
||||
find_package(ament_cmake REQUIRED)
|
||||
find_package(std_msgs REQUIRED)
|
||||
find_package(sensor_msgs REQUIRED)
|
||||
find_package(builtin_interfaces REQUIRED)
|
||||
find_package(rosidl_default_generators REQUIRED)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
endif()
|
||||
|
||||
rosidl_generate_interfaces(lslidar_msgs
|
||||
"msg/LslidarDifop.msg"
|
||||
"msg/LslidarPacket.msg"
|
||||
"msg/LslidarPoint.msg"
|
||||
"msg/LslidarScan.msg"
|
||||
"msg/LslidarSweep.msg"
|
||||
DEPENDENCIES builtin_interfaces std_msgs
|
||||
)
|
||||
|
||||
ament_package()
|
||||
@@ -1,2 +0,0 @@
|
||||
int64 temperature
|
||||
int64 rpm
|
||||
@@ -1,5 +0,0 @@
|
||||
# Raw Leishen LIDAR packet.
|
||||
|
||||
builtin_interfaces/Time stamp # packet timestamp
|
||||
uint8[2000] data # packet contents
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# Time when the point is captured
|
||||
float32 time
|
||||
|
||||
# Converted distance in the sensor frame
|
||||
float64 x
|
||||
float64 y
|
||||
float64 z
|
||||
|
||||
# Raw measurement from Leishen M10
|
||||
float64 azimuth
|
||||
float64 distance
|
||||
float64 intensity
|
||||
@@ -1,6 +0,0 @@
|
||||
# Altitude of all the points within this scan
|
||||
float64 altitude
|
||||
|
||||
# The valid points in this scan sorted by azimuth
|
||||
# from 0 to 359.99
|
||||
LslidarPoint[] points
|
||||
@@ -1,4 +0,0 @@
|
||||
std_msgs/Header header
|
||||
|
||||
# The 0th scan is at the bottom
|
||||
LslidarScan[16] scans
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<package format="3">
|
||||
<name>lslidar_msgs</name>
|
||||
<version>1.2.0</version>
|
||||
<description>ROS message definitions for Leishen LIDARs.</description>
|
||||
<maintainer email="shaohuashu@lslidar.com">Nick Shu</maintainer>
|
||||
<author>Nick Shu</author>
|
||||
<license>GNU General Public License V3.0</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
<buildtool_depend>rosidl_default_generators</buildtool_depend>
|
||||
|
||||
<exec_depend>rosidl_default_runtime</exec_depend>
|
||||
<exec_depend>builtin_interfaces</exec_depend>
|
||||
|
||||
<depend>std_msgs</depend>
|
||||
<test_depend>ament_lint_auto</test_depend>
|
||||
<test_depend>ament_lint_common</test_depend>
|
||||
|
||||
<member_of_group>rosidl_interface_packages</member_of_group>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
@@ -1,20 +0,0 @@
|
||||
版本变更
|
||||
/***************************************************************
|
||||
初始版本: LSLIDAR_M10_N10_V2.5.0_221104_ROS2
|
||||
变更内容:
|
||||
1.实现M10/M10_P/M10_PLUS/N10/M10_GPS网口和串口传输数据生成点云功能
|
||||
2.实现点云角度裁剪和距离过滤功能
|
||||
3.可以通过lslidar_order话题控制雷达启停
|
||||
4.支持读取pcap包
|
||||
|
||||
更改日期: 2022-11-04
|
||||
***************************************************************/
|
||||
|
||||
/***************************************************************
|
||||
初始版本: LSLIDAR_M10_N10_V2.5.0_221111_ROS2
|
||||
变更内容:
|
||||
1.针对M10和M10_GPS雷达出货后发现的点云问题进行驱动补救
|
||||
|
||||
更改日期: 2022-11-11
|
||||
***************************************************************/
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#CP2102 串口号0002 设置别名为wheeltec_controller
|
||||
echo 'KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60",ATTRS{serial}=="0002", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_controller"' >/etc/udev/rules.d/wheeltec_controller.rules
|
||||
#CH9102,同时系统安装了对应驱动 串口号0002 设置别名为wheeltec_controller
|
||||
echo 'KERNEL=="ttyCH343USB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4",ATTRS{serial}=="0002", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_controller"' >/etc/udev/rules.d/wheeltec_controller2.rules
|
||||
#CH9102,同时系统没有安装对应驱动 串口号0002 设置别名为wheeltec_controller
|
||||
echo 'KERNEL=="ttyACM*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4",ATTRS{serial}=="0002", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_controller"' >/etc/udev/rules.d/wheeltec_controller3.rules
|
||||
|
||||
#CP2102 串口号0001 设置别名为wheeltec_lidar
|
||||
echo 'KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60",ATTRS{serial}=="0001", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_lidar"' >/etc/udev/rules.d/wheeltec_lidar.rules
|
||||
#CH9102,同时系统安装了对应驱动 串口号0001 设置别名为wheeltec_lidar
|
||||
echo 'KERNEL=="ttyCH343USB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4",ATTRS{serial}=="54B8001974", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_lidar"' >/etc/udev/rules.d/wheeltec_lidar2.rules
|
||||
#CH9102,同时系统没有安装对应驱动 串口号0001 设置别名为wheeltec_lidar
|
||||
echo 'KERNEL=="ttyACM*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4",ATTRS{serial}=="0001", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_lidar"' >/etc/udev/rules.d/wheeltec_lidar3.rules
|
||||
|
||||
#CP2102 串口号0003 设置别名为wheeltec_FDI_IMU_GNSS
|
||||
echo 'KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60",ATTRS{serial}=="0003", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_FDI_IMU_GNSS"' >/etc/udev/rules.d/wheeltec_fdi_imu_gnss.rules
|
||||
#CH9102,同时系统安装了对应驱动 串口号0003 设置别名为wheeltec_FDI_IMU_GNSS
|
||||
echo 'KERNEL=="ttyCH343USB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4",ATTRS{serial}=="0003", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_FDI_IMU_GNSS"' >/etc/udev/rules.d/wheeltec_fdi_imu_gnss2.rules
|
||||
#CH9102,同时系统没有安装对应驱动 串口号0003 设置别名为wheeltec_FDI_IMU_GNSS
|
||||
echo 'KERNEL=="ttyACM*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4",ATTRS{serial}=="0003", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_FDI_IMU_GNSS"' >/etc/udev/rules.d/wheeltec_fdi_imu_gnss3.rules
|
||||
|
||||
echo 'SUBSYSTEM=="video4linux",ATTR{name}=="GENERAL WEBCAM",ATTR{index}=="0",MODE:="0777",SYMLINK+="RgbCam"' >>/etc/udev/rules.d/camera.rules
|
||||
echo 'SUBSYSTEM=="video4linux",ATTR{name}=="GENERAL WEBCAM: GENERAL WEBCAM",ATTR{index}=="0",MODE:="0777",SYMLINK+="RgbCam"' >>/etc/udev/rules.d/camera.rules
|
||||
echo 'SUBSYSTEM=="video4linux",ATTR{name}=="Astra Pro HD Camera: Astra Pro ",ATTR{index}=="0",MODE:="0777",SYMLINK+="Astra_Pro"' >>/etc/udev/rules.d/camera.rules
|
||||
echo 'SUBSYSTEM=="video4linux",ATTR{name}=="USB 2.0 Camera: USB Camera",ATTR{index}=="0",MODE:="0777",SYMLINK+="Astra_Dabai"' >>/etc/udev/rules.d/camera.rules
|
||||
echo 'SUBSYSTEM=="video4linux",ATTR{name}=="USB 2.0 Camera",ATTR{index}=="0",MODE:="0777",SYMLINK+="Astra_Gemini"' >>/etc/udev/rules.d/camera.rules
|
||||
echo 'SUBSYSTEM=="video4linux",ATTR{name}=="Intel(R) RealSense(TM) Depth Ca",ATTR{index}=="0",MODE:="0777",SYMLINK+="realsense"' >>/etc/udev/rules.d/camera.rules
|
||||
|
||||
service udev reload
|
||||
sleep 2
|
||||
service udev restart
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.5 KiB |
@@ -1,62 +0,0 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import launch_ros.actions
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import (DeclareLaunchArgument, GroupAction,
|
||||
IncludeLaunchDescription, SetEnvironmentVariable)
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
|
||||
def generate_launch_description():
|
||||
Lslidar_dir = get_package_share_directory('lslidar_driver')
|
||||
Lslidar_launch_dir = os.path.join(Lslidar_dir, 'launch')
|
||||
|
||||
|
||||
Ld14_dir = get_package_share_directory('ldlidar_sl_ros2')
|
||||
Ld14_launch_dir = os.path.join(Ld14_dir, 'launch')
|
||||
|
||||
Ld06_dir = get_package_share_directory('ldlidar_stl_ros2')
|
||||
Ld06_launch_dir = os.path.join(Ld14_dir, 'launch')
|
||||
|
||||
|
||||
Lsm10_m10_uart = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Lslidar_launch_dir, 'lsm10_uart_launch.py')),)
|
||||
|
||||
Lsm10_m10_net = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Lslidar_launch_dir, 'lsm10_net_launch.py')),)
|
||||
|
||||
Lsm10_m10p_uart = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Lslidar_launch_dir, 'lsm10p_uart_launch.py')),)
|
||||
|
||||
Lsm10_m10p_net = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Lslidar_launch_dir, 'lsm10p_net_launch.py')),)
|
||||
|
||||
Lsn10 = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Lslidar_launch_dir, 'lsn10_launch.py')),)
|
||||
Lsn10p = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Lslidar_launch_dir, 'lsn10p_launch.py')),)
|
||||
|
||||
Lsn10_net = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Lslidar_launch_dir, 'lsn10_net_launch.py')),)
|
||||
Lsn10p_net = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Lslidar_launch_dir, 'lsn10p_net_launch.py')),)
|
||||
|
||||
Ld14 = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Ld14_launch_dir, 'ld14.launch.py')),)
|
||||
Ld06 = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(Ld06_launch_dir, 'ld06.launch.py')),)
|
||||
|
||||
# Create the launch description and populate
|
||||
ld = LaunchDescription()
|
||||
'''
|
||||
Please select your lidar here, options include:
|
||||
Lsm10_m10p_uart、Lsm10_m10p_net、Lsm10_m10_uart、Lsm10_m10_net、Lsn10、Lsn10p,Lsn10_net、Lsn10p_net,ld14、Ld06.
|
||||
1.If you are using LS* lidar (including lsn10, lsm10*), please don't forget to
|
||||
modify the tf conversion parameters of robot_mode_description.launch.py
|
||||
according to the user guide file.
|
||||
2.If you are using m10 lidar, please pay attention to distinguish whether it is m10p or not.
|
||||
'''
|
||||
ld.add_action(Lsn10)
|
||||
|
||||
return ld
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(cyy_navigation2)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
# find dependencies
|
||||
find_package(ament_cmake REQUIRED)
|
||||
find_package(nav2_bringup REQUIRED)
|
||||
install(
|
||||
DIRECTORY launch param maps
|
||||
DESTINATION share/${PROJECT_NAME}
|
||||
)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
# the following line skips the linter which checks for copyrights
|
||||
# comment the line when a copyright and license is added to all source files
|
||||
set(ament_cmake_copyright_FOUND TRUE)
|
||||
# the following line skips cpplint (only works in a git repo)
|
||||
# comment the line when this package is in a git repo and when
|
||||
# a copyright and license is added to all source files
|
||||
set(ament_cmake_cpplint_FOUND TRUE)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
endif()
|
||||
|
||||
ament_package()
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<!--
|
||||
This Behavior Tree follows a dynamic pose to a certain distance
|
||||
-->
|
||||
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<RateController hz="1.0">
|
||||
<Sequence>
|
||||
<GoalUpdater input_goal="{goal}" output_goal="{updated_goal}">
|
||||
<ComputePathToPose goal="{updated_goal}" path="{path}" planner_id="GridBased"/>
|
||||
</GoalUpdater>
|
||||
<TruncatePath distance="1.0" input_path="{path}" output_path="{truncated_path}"/>
|
||||
</Sequence>
|
||||
</RateController>
|
||||
<KeepRunningUntilFailure>
|
||||
<FollowPath path="{truncated_path}" controller_id="FollowPath"/>
|
||||
</KeepRunningUntilFailure>
|
||||
</PipelineSequence>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,46 +0,0 @@
|
||||
<!--
|
||||
This Behavior Tree replans the global path once every 15 seconds or if the path becomes invalid. It also has
|
||||
recovery actions specific to planning / control as well as general system issues.
|
||||
This will be continuous if a kinematically valid planner is selected.
|
||||
-->
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<RecoveryNode number_of_retries="6" name="NavigateRecovery">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<RateController hz="2.0">
|
||||
<RecoveryNode number_of_retries="1" name="ComputePathToPose">
|
||||
<Fallback>
|
||||
<ReactiveSequence>
|
||||
<Inverter>
|
||||
<PathExpiringTimer seconds="10" path="{path}"/>
|
||||
</Inverter>
|
||||
<Inverter>
|
||||
<GlobalUpdatedGoal/>
|
||||
</Inverter>
|
||||
<IsPathValid path="{path}"/>
|
||||
</ReactiveSequence>
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
</Fallback>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</RecoveryNode>
|
||||
</RateController>
|
||||
<RecoveryNode number_of_retries="1" name="FollowPath">
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
</RecoveryNode>
|
||||
</PipelineSequence>
|
||||
<ReactiveFallback name="RecoveryFallback">
|
||||
<GoalUpdated/>
|
||||
<RoundRobin name="RecoveryActions">
|
||||
<Sequence name="ClearingActions">
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</Sequence>
|
||||
<Spin spin_dist="1.57"/>
|
||||
<Wait wait_duration="5"/>
|
||||
<BackUp backup_dist="0.30" backup_speed="0.05"/>
|
||||
</RoundRobin>
|
||||
</ReactiveFallback>
|
||||
</RecoveryNode>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,38 +0,0 @@
|
||||
|
||||
<!--
|
||||
This Behavior Tree replans the global path periodically at 1 Hz through an array of poses continuously
|
||||
and it also has recovery actions specific to planning / control as well as general system issues.
|
||||
-->
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<RecoveryNode number_of_retries="6" name="NavigateRecovery">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<RateController hz="0.333">
|
||||
<RecoveryNode number_of_retries="1" name="ComputePathThroughPoses">
|
||||
<ReactiveSequence>
|
||||
<RemovePassedGoals input_goals="{goals}" output_goals="{goals}" radius="0.7"/>
|
||||
<ComputePathThroughPoses goals="{goals}" path="{path}" planner_id="GridBased"/>
|
||||
</ReactiveSequence>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</RecoveryNode>
|
||||
</RateController>
|
||||
<RecoveryNode number_of_retries="1" name="FollowPath">
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
</RecoveryNode>
|
||||
</PipelineSequence>
|
||||
<ReactiveFallback name="RecoveryFallback">
|
||||
<GoalUpdated/>
|
||||
<RoundRobin name="RecoveryActions">
|
||||
<Sequence name="ClearingActions">
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</Sequence>
|
||||
<Spin spin_dist="1.57"/>
|
||||
<Wait wait_duration="5"/>
|
||||
<BackUp backup_dist="0.30" backup_speed="0.05"/>
|
||||
</RoundRobin>
|
||||
</ReactiveFallback>
|
||||
</RecoveryNode>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,36 +0,0 @@
|
||||
|
||||
<!--
|
||||
This Behavior Tree replans the global path periodically at 1 Hz and it also has
|
||||
recovery actions specific to planning / control as well as general system issues.
|
||||
This will be continuous if a kinematically valid planner is selected.
|
||||
-->
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<RecoveryNode number_of_retries="6" name="NavigateRecovery">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<RateController hz="1.0">
|
||||
<RecoveryNode number_of_retries="1" name="ComputePathToPose">
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</RecoveryNode>
|
||||
</RateController>
|
||||
<RecoveryNode number_of_retries="1" name="FollowPath">
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
</RecoveryNode>
|
||||
</PipelineSequence>
|
||||
<ReactiveFallback name="RecoveryFallback">
|
||||
<GoalUpdated/>
|
||||
<RoundRobin name="RecoveryActions">
|
||||
<Sequence name="ClearingActions">
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</Sequence>
|
||||
<Spin spin_dist="1.57"/>
|
||||
<Wait wait_duration="5"/>
|
||||
<BackUp backup_dist="0.30" backup_speed="0.05"/>
|
||||
</RoundRobin>
|
||||
</ReactiveFallback>
|
||||
</RecoveryNode>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,47 +0,0 @@
|
||||
|
||||
<!--
|
||||
This BT has all the functionalities of navigate_to_pose_w_replanning_and_recovery.xml,
|
||||
with an additional feature to cancel the control closer to the goal proximity and
|
||||
make the robot wait for a specific time, to see if the obstacle clears out before
|
||||
navigating along a significantly longer path to reach the goal location.
|
||||
-->
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<RecoveryNode number_of_retries="6" name="NavigateRecovery">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<RateController hz="1.0">
|
||||
<RecoveryNode number_of_retries="1" name="ComputePathToPose">
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</RecoveryNode>
|
||||
</RateController>
|
||||
<ReactiveSequence name="MonitorAndFollowPath">
|
||||
<PathLongerOnApproach path="{path}" prox_len="3.0" length_factor="2.0">
|
||||
<RetryUntilSuccessful num_attempts="1">
|
||||
<SequenceStar name="CancelingControlAndWait">
|
||||
<CancelControl name="ControlCancel"/>
|
||||
<Wait wait_duration="5"/>
|
||||
</SequenceStar>
|
||||
</RetryUntilSuccessful>
|
||||
</PathLongerOnApproach>
|
||||
<RecoveryNode number_of_retries="1" name="FollowPath">
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
</RecoveryNode>
|
||||
</ReactiveSequence>
|
||||
</PipelineSequence>
|
||||
<ReactiveFallback name="RecoveryFallback">
|
||||
<GoalUpdated/>
|
||||
<RoundRobin name="RecoveryActions">
|
||||
<Sequence name="ClearingActions">
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</Sequence>
|
||||
<Spin spin_dist="1.57"/>
|
||||
<Wait wait_duration="5"/>
|
||||
<BackUp backup_dist="0.30" backup_speed="0.05"/>
|
||||
</RoundRobin>
|
||||
</ReactiveFallback>
|
||||
</RecoveryNode>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,44 +0,0 @@
|
||||
|
||||
<!--
|
||||
This Behavior Tree replans the global path only if the path becomes invalid and it also has
|
||||
recovery actions specific to planning / control as well as general system issues.
|
||||
This will be continuous if a kinematically valid planner is selected.
|
||||
-->
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<RecoveryNode number_of_retries="6" name="NavigateRecovery">
|
||||
<PipelineSequence>
|
||||
<RateController hz="1.0" name="RateControllerComputePathToPose">
|
||||
<RecoveryNode number_of_retries="1" name="RecoveryComputePathToPose">
|
||||
<Fallback name="FallbackComputePathToPose">
|
||||
<ReactiveSequence name="CheckIfNewPathNeeded">
|
||||
<Inverter>
|
||||
<GlobalUpdatedGoal/>
|
||||
</Inverter>
|
||||
<IsPathValid path="{path}"/>
|
||||
</ReactiveSequence>
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
</Fallback>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</RecoveryNode>
|
||||
</RateController>
|
||||
<RecoveryNode number_of_retries="1" name="RecoveryFollowPath">
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
</RecoveryNode>
|
||||
</PipelineSequence>
|
||||
<ReactiveFallback name="FallbackRecoveries">
|
||||
<GoalUpdated/>
|
||||
<RoundRobin name="RecoveryActions">
|
||||
<Sequence name="ClearingActions">
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</Sequence>
|
||||
<Spin name="SpinRecovery" spin_dist="1.57"/>
|
||||
<Wait name="WaitRecovery" wait_duration="5"/>
|
||||
<BackUp name="BackUpRecovery" backup_dist="0.30" backup_speed="0.05"/>
|
||||
</RoundRobin>
|
||||
</ReactiveFallback>
|
||||
</RecoveryNode>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!--
|
||||
This Behavior Tree replans the global path after every 1m.
|
||||
-->
|
||||
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<DistanceController distance="1.0">
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
</DistanceController>
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
</PipelineSequence>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!--
|
||||
This Behavior Tree replans the global path only when the goal is updated.
|
||||
-->
|
||||
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<GoalUpdatedController>
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
</GoalUpdatedController>
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
</PipelineSequence>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,21 +0,0 @@
|
||||
<!--
|
||||
This Behavior Tree replans the global path only if the path becomes invalid
|
||||
-->
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<RateController hz="1.0">
|
||||
<Fallback>
|
||||
<ReactiveSequence>
|
||||
<Inverter>
|
||||
<GlobalUpdatedGoal/>
|
||||
</Inverter>
|
||||
<IsPathValid path="{path}"/>
|
||||
</ReactiveSequence>
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
</Fallback>
|
||||
</RateController>
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
</PipelineSequence>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!--
|
||||
This Behavior Tree replans the global path periodically proprortional to speed.
|
||||
-->
|
||||
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<SpeedController min_rate="0.1" max_rate="1.0" min_speed="0.0" max_speed="0.26">
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
</SpeedController>
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
</PipelineSequence>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!--
|
||||
This Behavior Tree replans the global path periodically at 1 Hz.
|
||||
-->
|
||||
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<RateController hz="1.0">
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
</RateController>
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
</PipelineSequence>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,20 +0,0 @@
|
||||
<!--
|
||||
his Behavior Tree drives in a square for odometry calibration experiments
|
||||
-->
|
||||
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<Repeat num_cycles="3">
|
||||
<Sequence name="Drive in a square">
|
||||
<DriveOnHeading dist_to_travel="2.0" speed="0.2" time_allowance="12"/>
|
||||
<Spin spin_dist="1.570796" is_recovery="false"/>
|
||||
<DriveOnHeading dist_to_travel="2.0" speed="0.2" time_allowance="12"/>
|
||||
<Spin spin_dist="1.570796" is_recovery="false"/>
|
||||
<DriveOnHeading dist_to_travel="2.0" speed="0.2" time_allowance="12"/>
|
||||
<Spin spin_dist="1.570796" is_recovery="false"/>
|
||||
<DriveOnHeading dist_to_travel="2.0" speed="0.2" time_allowance="12"/>
|
||||
<Spin spin_dist="1.570796" is_recovery="false"/>
|
||||
</Sequence>
|
||||
</Repeat>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,348 +0,0 @@
|
||||
amcl:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
alpha1: 0.5
|
||||
alpha2: 0.5
|
||||
alpha3: 0.5
|
||||
alpha4: 0.5
|
||||
alpha5: 0.5
|
||||
base_frame_id: "base_link"
|
||||
beam_skip_distance: 0.5
|
||||
beam_skip_error_threshold: 0.9
|
||||
beam_skip_threshold: 0.3
|
||||
do_beamskip: true
|
||||
global_frame_id: "map"
|
||||
lambda_short: 0.1
|
||||
laser_likelihood_max_dist: 4.0
|
||||
laser_max_range: 100.0
|
||||
laser_min_range: -1.0
|
||||
laser_model_type: "likelihood_field"
|
||||
max_beams: 120
|
||||
max_particles: 4000
|
||||
min_particles: 1000
|
||||
odom_frame_id: "odom"
|
||||
pf_err: 0.01
|
||||
pf_z: 0.99
|
||||
recovery_alpha_fast: 0.0
|
||||
recovery_alpha_slow: 0.0
|
||||
resample_interval: 2
|
||||
robot_model_type: "nav2_amcl::DifferentialMotionModel"
|
||||
save_pose_rate: 0.5
|
||||
sigma_hit: 0.2
|
||||
tf_broadcast: true
|
||||
transform_tolerance: 1.0
|
||||
update_min_a: 0.2
|
||||
update_min_d: 0.25
|
||||
z_hit: 0.9
|
||||
z_max: 0.05
|
||||
z_rand: 0.1
|
||||
z_short: 0.05
|
||||
scan_topic: scan
|
||||
|
||||
bt_navigator:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
global_frame: map
|
||||
robot_base_frame: base_link
|
||||
odom_topic: /odom
|
||||
bt_loop_duration: 10
|
||||
default_server_timeout: 20
|
||||
wait_for_service_timeout: 1000
|
||||
# 'default_nav_through_poses_bt_xml' and 'default_nav_to_pose_bt_xml' are use defaults:
|
||||
# nav2_bt_navigator/navigate_to_pose_w_replanning_and_recovery.xml
|
||||
# nav2_bt_navigator/navigate_through_poses_w_replanning_and_recovery.xml
|
||||
# They can be set here or via a RewrittenYaml remap from a parent launch file to Nav2.
|
||||
plugin_lib_names:
|
||||
- nav2_compute_path_to_pose_action_bt_node
|
||||
- nav2_compute_path_through_poses_action_bt_node
|
||||
- nav2_smooth_path_action_bt_node
|
||||
- nav2_follow_path_action_bt_node
|
||||
- nav2_spin_action_bt_node
|
||||
- nav2_wait_action_bt_node
|
||||
- nav2_assisted_teleop_action_bt_node
|
||||
- nav2_back_up_action_bt_node
|
||||
- nav2_drive_on_heading_bt_node
|
||||
- nav2_clear_costmap_service_bt_node
|
||||
- nav2_is_stuck_condition_bt_node
|
||||
- nav2_goal_reached_condition_bt_node
|
||||
- nav2_goal_updated_condition_bt_node
|
||||
- nav2_globally_updated_goal_condition_bt_node
|
||||
- nav2_is_path_valid_condition_bt_node
|
||||
- nav2_initial_pose_received_condition_bt_node
|
||||
- nav2_reinitialize_global_localization_service_bt_node
|
||||
- nav2_rate_controller_bt_node
|
||||
- nav2_distance_controller_bt_node
|
||||
- nav2_speed_controller_bt_node
|
||||
- nav2_truncate_path_action_bt_node
|
||||
- nav2_truncate_path_local_action_bt_node
|
||||
- nav2_goal_updater_node_bt_node
|
||||
- nav2_recovery_node_bt_node
|
||||
- nav2_pipeline_sequence_bt_node
|
||||
- nav2_round_robin_node_bt_node
|
||||
- nav2_transform_available_condition_bt_node
|
||||
- nav2_time_expired_condition_bt_node
|
||||
- nav2_path_expiring_timer_condition
|
||||
- nav2_distance_traveled_condition_bt_node
|
||||
- nav2_single_trigger_bt_node
|
||||
- nav2_goal_updated_controller_bt_node
|
||||
- nav2_is_battery_low_condition_bt_node
|
||||
- nav2_navigate_through_poses_action_bt_node
|
||||
- nav2_navigate_to_pose_action_bt_node
|
||||
- nav2_remove_passed_goals_action_bt_node
|
||||
- nav2_planner_selector_bt_node
|
||||
- nav2_controller_selector_bt_node
|
||||
- nav2_goal_checker_selector_bt_node
|
||||
- nav2_controller_cancel_bt_node
|
||||
- nav2_path_longer_on_approach_bt_node
|
||||
- nav2_wait_cancel_bt_node
|
||||
- nav2_spin_cancel_bt_node
|
||||
- nav2_back_up_cancel_bt_node
|
||||
- nav2_assisted_teleop_cancel_bt_node
|
||||
- nav2_drive_on_heading_cancel_bt_node
|
||||
- nav2_is_battery_charging_condition_bt_node
|
||||
|
||||
bt_navigator_navigate_through_poses_rclcpp_node:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
|
||||
bt_navigator_navigate_to_pose_rclcpp_node:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
|
||||
controller_server:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
controller_frequency: 20.0
|
||||
min_x_velocity_threshold: 0.001
|
||||
min_y_velocity_threshold: 0.5
|
||||
min_theta_velocity_threshold: 0.001
|
||||
failure_tolerance: 0.3
|
||||
progress_checker_plugin: "progress_checker"
|
||||
goal_checker_plugins: ["general_goal_checker"] # "precise_goal_checker"
|
||||
controller_plugins: ["FollowPath"]
|
||||
|
||||
# Progress checker parameters
|
||||
progress_checker:
|
||||
plugin: "nav2_controller::SimpleProgressChecker"
|
||||
required_movement_radius: 0.5
|
||||
movement_time_allowance: 10.0
|
||||
# Goal checker parameters
|
||||
#precise_goal_checker:
|
||||
# plugin: "nav2_controller::SimpleGoalChecker"
|
||||
# xy_goal_tolerance: 0.25
|
||||
# yaw_goal_tolerance: 0.25
|
||||
# stateful: True
|
||||
general_goal_checker:
|
||||
stateful: True
|
||||
plugin: "nav2_controller::SimpleGoalChecker"
|
||||
xy_goal_tolerance: 0.25
|
||||
yaw_goal_tolerance: 0.25
|
||||
# DWB parameters
|
||||
FollowPath:
|
||||
plugin: "dwb_core::DWBLocalPlanner"
|
||||
debug_trajectory_details: True
|
||||
min_vel_x: 0.0
|
||||
min_vel_y: 0.0
|
||||
max_vel_x: 0.50
|
||||
max_vel_y: 0.0
|
||||
max_vel_theta: 3.0
|
||||
min_speed_xy: 0.0
|
||||
max_speed_xy: 0.50
|
||||
min_speed_theta: 0.0
|
||||
# Add high threshold velocity for turtlebot 3 issue.
|
||||
# https://github.com/ROBOTIS-GIT/turtlebot3_simulations/issues/75
|
||||
acc_lim_x: 2.5
|
||||
acc_lim_y: 0.0
|
||||
acc_lim_theta: 3.2
|
||||
decel_lim_x: -2.5
|
||||
decel_lim_y: 0.0
|
||||
decel_lim_theta: -3.2
|
||||
vx_samples: 20
|
||||
vy_samples: 5
|
||||
vtheta_samples: 20
|
||||
sim_time: 1.7
|
||||
linear_granularity: 0.05
|
||||
angular_granularity: 0.025
|
||||
transform_tolerance: 0.2
|
||||
xy_goal_tolerance: 0.25
|
||||
trans_stopped_velocity: 0.25
|
||||
short_circuit_trajectory_evaluation: True
|
||||
stateful: True
|
||||
critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
|
||||
BaseObstacle.scale: 0.02
|
||||
PathAlign.scale: 32.0
|
||||
PathAlign.forward_point_distance: 0.1
|
||||
GoalAlign.scale: 24.0
|
||||
GoalAlign.forward_point_distance: 0.1
|
||||
PathDist.scale: 32.0
|
||||
GoalDist.scale: 24.0
|
||||
RotateToGoal.scale: 32.0
|
||||
RotateToGoal.slowing_factor: 5.0
|
||||
RotateToGoal.lookahead_time: -1.0
|
||||
|
||||
local_costmap:
|
||||
local_costmap:
|
||||
ros__parameters:
|
||||
update_frequency: 5.0
|
||||
publish_frequency: 2.0
|
||||
global_frame: odom
|
||||
robot_base_frame: base_link
|
||||
use_sim_time: True
|
||||
rolling_window: true
|
||||
width: 3
|
||||
height: 3
|
||||
resolution: 0.05
|
||||
robot_radius: 0.20
|
||||
plugins: ["voxel_layer", "inflation_layer"]
|
||||
inflation_layer:
|
||||
plugin: "nav2_costmap_2d::InflationLayer"
|
||||
cost_scaling_factor: 3.0
|
||||
inflation_radius: 0.30
|
||||
voxel_layer:
|
||||
plugin: "nav2_costmap_2d::VoxelLayer"
|
||||
enabled: True
|
||||
publish_voxel_map: True
|
||||
origin_z: 0.0
|
||||
z_resolution: 0.05
|
||||
z_voxels: 16
|
||||
max_obstacle_height: 2.0
|
||||
mark_threshold: 0
|
||||
observation_sources: scan
|
||||
scan:
|
||||
topic: /scan
|
||||
max_obstacle_height: 2.0
|
||||
clearing: True
|
||||
marking: True
|
||||
data_type: "LaserScan"
|
||||
raytrace_max_range: 3.0
|
||||
raytrace_min_range: 0.0
|
||||
obstacle_max_range: 2.5
|
||||
obstacle_min_range: 0.0
|
||||
static_layer:
|
||||
plugin: "nav2_costmap_2d::StaticLayer"
|
||||
map_subscribe_transient_local: True
|
||||
always_send_full_costmap: True
|
||||
|
||||
global_costmap:
|
||||
global_costmap:
|
||||
ros__parameters:
|
||||
update_frequency: 1.0
|
||||
publish_frequency: 1.0
|
||||
global_frame: map
|
||||
robot_base_frame: base_link
|
||||
use_sim_time: True
|
||||
robot_radius: 0.20
|
||||
resolution: 0.05
|
||||
track_unknown_space: true
|
||||
plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
|
||||
obstacle_layer:
|
||||
plugin: "nav2_costmap_2d::ObstacleLayer"
|
||||
enabled: True
|
||||
observation_sources: scan
|
||||
scan:
|
||||
topic: /scan
|
||||
max_obstacle_height: 2.0
|
||||
clearing: True
|
||||
marking: True
|
||||
data_type: "LaserScan"
|
||||
raytrace_max_range: 3.0
|
||||
raytrace_min_range: 0.0
|
||||
obstacle_max_range: 2.5
|
||||
obstacle_min_range: 0.0
|
||||
static_layer:
|
||||
plugin: "nav2_costmap_2d::StaticLayer"
|
||||
map_subscribe_transient_local: True
|
||||
inflation_layer:
|
||||
plugin: "nav2_costmap_2d::InflationLayer"
|
||||
cost_scaling_factor: 3.0
|
||||
inflation_radius: 0.30
|
||||
always_send_full_costmap: True
|
||||
|
||||
map_server:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
# Overridden in launch by the "map" launch configuration or provided default value.
|
||||
# To use in yaml, remove the default "map" value in the tb3_simulation_launch.py file & provide full path to map below.
|
||||
yaml_filename: ""
|
||||
|
||||
map_saver:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
save_map_timeout: 5.0
|
||||
free_thresh_default: 0.25
|
||||
occupied_thresh_default: 0.65
|
||||
map_subscribe_transient_local: True
|
||||
|
||||
planner_server:
|
||||
ros__parameters:
|
||||
expected_planner_frequency: 20.0
|
||||
use_sim_time: True
|
||||
planner_plugins: ["GridBased"]
|
||||
GridBased:
|
||||
plugin: "nav2_navfn_planner/NavfnPlanner"
|
||||
tolerance: 0.5
|
||||
use_astar: false
|
||||
allow_unknown: true
|
||||
|
||||
smoother_server:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
smoother_plugins: ["simple_smoother"]
|
||||
simple_smoother:
|
||||
plugin: "nav2_smoother::SimpleSmoother"
|
||||
tolerance: 1.0e-10
|
||||
max_its: 1000
|
||||
do_refinement: True
|
||||
|
||||
behavior_server:
|
||||
ros__parameters:
|
||||
costmap_topic: local_costmap/costmap_raw
|
||||
footprint_topic: local_costmap/published_footprint
|
||||
cycle_frequency: 10.0
|
||||
behavior_plugins: ["backup", "drive_on_heading", "assisted_teleop", "wait"]
|
||||
backup:
|
||||
plugin: "nav2_behaviors/BackUp"
|
||||
drive_on_heading:
|
||||
plugin: "nav2_behaviors/DriveOnHeading"
|
||||
wait:
|
||||
plugin: "nav2_behaviors/Wait"
|
||||
assisted_teleop:
|
||||
plugin: "nav2_behaviors/AssistedTeleop"
|
||||
global_frame: odom
|
||||
robot_base_frame: base_link
|
||||
transform_tolerance: 0.3
|
||||
use_sim_time: true
|
||||
simulate_ahead_time: 2.0
|
||||
max_rotational_vel: 1.0
|
||||
min_rotational_vel: 0.4
|
||||
rotational_acc_lim: 3.2
|
||||
|
||||
robot_state_publisher:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
|
||||
waypoint_follower:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
loop_rate: 20
|
||||
stop_on_failure: false
|
||||
waypoint_task_executor_plugin: "wait_at_waypoint"
|
||||
wait_at_waypoint:
|
||||
plugin: "nav2_waypoint_follower::WaitAtWaypoint"
|
||||
enabled: True
|
||||
waypoint_pause_duration: 200
|
||||
|
||||
velocity_smoother:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
smoothing_frequency: 20.0
|
||||
scale_velocities: False
|
||||
feedback: "OPEN_LOOP"
|
||||
max_velocity: [0.26, 0.0, 1.0]
|
||||
min_velocity: [-0.26, 0.0, -1.0]
|
||||
max_accel: [2.5, 0.0, 3.2]
|
||||
max_decel: [-2.5, 0.0, -3.2]
|
||||
odom_topic: "odom"
|
||||
odom_duration: 0.1
|
||||
deadband_velocity: [0.0, 0.0, 0.0]
|
||||
velocity_timeout: 1.0
|
||||
@@ -1,108 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
小车导航系统启动文件
|
||||
启动所有必要的硬件和导航节点
|
||||
"""
|
||||
|
||||
import os
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument, TimerAction, LogInfo
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource, FrontendLaunchDescriptionSource
|
||||
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution, PythonExpression
|
||||
from launch_ros.actions import Node
|
||||
from launch_ros.substitutions import FindPackageShare
|
||||
from launch.conditions import IfCondition, UnlessCondition
|
||||
|
||||
def generate_launch_description():
|
||||
# 获取包路径
|
||||
cyy_navigation2_dir = get_package_share_directory('cyy_navigation2')
|
||||
|
||||
# 声明启动参数
|
||||
use_base = LaunchConfiguration('use_base', default='true')
|
||||
use_lidar = LaunchConfiguration('use_lidar', default='true')
|
||||
use_description = LaunchConfiguration('use_description', default='true')
|
||||
use_bridge = LaunchConfiguration('use_bridge', default='true')
|
||||
|
||||
# 启动参数列表
|
||||
launch_arguments = [
|
||||
DeclareLaunchArgument(
|
||||
'use_base',
|
||||
default_value='true',
|
||||
description='启动底盘控制'
|
||||
),
|
||||
DeclareLaunchArgument(
|
||||
'use_lidar',
|
||||
default_value='true',
|
||||
description='启动激光雷达'
|
||||
),
|
||||
DeclareLaunchArgument(
|
||||
'use_description',
|
||||
default_value='true',
|
||||
description='启动URDF显示'
|
||||
),
|
||||
DeclareLaunchArgument(
|
||||
'use_bridge',
|
||||
default_value='true',
|
||||
description='启动ROS Bridge'
|
||||
),
|
||||
]
|
||||
|
||||
# 创建启动描述
|
||||
ld = LaunchDescription(launch_arguments)
|
||||
|
||||
# 1. 启动底盘控制
|
||||
base_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource([
|
||||
FindPackageShare('origincar_base'), '/launch/base_serial.launch.py'
|
||||
]),
|
||||
condition=IfCondition(use_base)
|
||||
)
|
||||
|
||||
# 添加延迟,确保底盘先启动
|
||||
ld.add_action(TimerAction(
|
||||
period=1.0,
|
||||
actions=[LogInfo(msg='启动底盘控制...'), base_launch]
|
||||
))
|
||||
|
||||
# 2. 启动激光雷达
|
||||
lidar_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource([
|
||||
FindPackageShare('lslidar_driver'), '/launch/lsn10_launch.py'
|
||||
]),
|
||||
condition=IfCondition(use_lidar)
|
||||
)
|
||||
|
||||
ld.add_action(TimerAction(
|
||||
period=2.0,
|
||||
actions=[LogInfo(msg='启动激光雷达...'), lidar_launch]
|
||||
))
|
||||
|
||||
# 3. 启动URDF显示
|
||||
description_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource([
|
||||
FindPackageShare('origincar_description'), '/launch/display.launch.py'
|
||||
]),
|
||||
condition=IfCondition(use_description)
|
||||
)
|
||||
|
||||
ld.add_action(TimerAction(
|
||||
period=3.0,
|
||||
actions=[LogInfo(msg='启动URDF显示...'), description_launch]
|
||||
))
|
||||
|
||||
# 4. 启动ROS Bridge
|
||||
bridge_launch = IncludeLaunchDescription(
|
||||
FrontendLaunchDescriptionSource([
|
||||
FindPackageShare('rosbridge_server'), '/launch/rosbridge_websocket_launch.xml'
|
||||
]),
|
||||
condition=IfCondition(use_bridge)
|
||||
)
|
||||
|
||||
ld.add_action(TimerAction(
|
||||
period=4.0,
|
||||
actions=[LogInfo(msg='启动ROS Bridge...'), bridge_launch]
|
||||
))
|
||||
|
||||
|
||||
return ld
|
||||
@@ -1,41 +0,0 @@
|
||||
import os
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import IncludeLaunchDescription
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
# =============================1.定位到包的地址=============================================================
|
||||
cyy_navigation2_dir = get_package_share_directory('cyy_navigation2')
|
||||
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
|
||||
slam = LaunchConfiguration('slam', default='True')
|
||||
# =============================2.声明参数,获取配置文件路径===================================================
|
||||
# use_sim_time 这里要设置成true,因为gazebo是仿真环境,其时间是通过/clock话题获取,而不是系统时间
|
||||
use_sim_time = LaunchConfiguration('use_sim_time', default='false')
|
||||
map_yaml_path = LaunchConfiguration('map',
|
||||
default=os.path.join(cyy_navigation2_dir, 'maps', 'cyy_map1.yaml'))
|
||||
nav2_param_path = LaunchConfiguration('params_file',
|
||||
default=os.path.join(cyy_navigation2_dir, 'param', 'nav2_params.yaml'))
|
||||
rviz_config_dir = os.path.join(nav2_bringup_dir, 'rviz', 'nav2_default_view.rviz')
|
||||
|
||||
# =============================3.声明启动launch文件,传入:地图路径、是否使用仿真时间以及nav2参数文件==============
|
||||
nav2_bringup_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource([nav2_bringup_dir, '/launch', '/bringup_launch.py']),
|
||||
launch_arguments={
|
||||
'map': map_yaml_path,
|
||||
'use_sim_time': use_sim_time,
|
||||
'params_file': nav2_param_path,
|
||||
'slam': slam}.items(),
|
||||
)
|
||||
rviz_node = Node(
|
||||
package='rviz2',
|
||||
executable='rviz2',
|
||||
name='rviz2',
|
||||
arguments=['-d', rviz_config_dir],
|
||||
parameters=[{'use_sim_time': use_sim_time}],
|
||||
output='screen')
|
||||
|
||||
return LaunchDescription([nav2_bringup_launch])
|
||||
@@ -1,86 +0,0 @@
|
||||
import os
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
|
||||
def generate_launch_description():
|
||||
# 获取包路径
|
||||
cyy_navigation2_dir = get_package_share_directory('cyy_navigation2')
|
||||
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
|
||||
|
||||
# 声明参数
|
||||
use_sim_time = LaunchConfiguration('use_sim_time', default='False')
|
||||
slam = LaunchConfiguration('slam', default='False')
|
||||
localization = LaunchConfiguration('localization', default='False')
|
||||
|
||||
# 定义文件路径
|
||||
map_yaml_path = os.path.join(cyy_navigation2_dir, 'maps', 'cyy_map.yaml')
|
||||
nav2_param_path = os.path.join(cyy_navigation2_dir, 'param', 'nav2_params.yaml')
|
||||
slam_params_file = os.path.join(cyy_navigation2_dir, 'param', 'slam_toolbox_localization.yaml')
|
||||
|
||||
# 定义地图基础路径(用于 .posegraph 文件)
|
||||
map_base_path = os.path.join(cyy_navigation2_dir, 'maps', 'cyy_map')
|
||||
|
||||
# 检查 .posegraph 文件是否存在
|
||||
posegraph_path = map_base_path + '.posegraph'
|
||||
if not os.path.exists(posegraph_path):
|
||||
print(f"警告: .posegraph 文件不存在: {posegraph_path}")
|
||||
print("将使用 AMCL 替代")
|
||||
use_slam_toolbox = False
|
||||
else:
|
||||
use_slam_toolbox = True
|
||||
print(f"找到 .posegraph 文件: {posegraph_path}")
|
||||
|
||||
# 创建启动描述
|
||||
ld = LaunchDescription([
|
||||
DeclareLaunchArgument('use_sim_time', default_value='False'),
|
||||
DeclareLaunchArgument('slam', default_value='False'),
|
||||
DeclareLaunchArgument('localization', default_value='False'),
|
||||
])
|
||||
|
||||
# 如果使用 slam_toolbox
|
||||
if use_slam_toolbox:
|
||||
slam_toolbox_node = Node(
|
||||
package='slam_toolbox',
|
||||
executable='localization_slam_toolbox_node',
|
||||
name='slam_toolbox',
|
||||
output='screen',
|
||||
parameters=[
|
||||
slam_params_file,
|
||||
{'use_sim_time': use_sim_time},
|
||||
{'map_file_name': map_base_path},
|
||||
{'map_start_pose': [0.0, 0.0, 0.0]}
|
||||
],
|
||||
remappings=[('/scan', '/scan')]
|
||||
)
|
||||
ld.add_action(slam_toolbox_node)
|
||||
# 使用 slam_toolbox 时,Nav2 不启用定位
|
||||
localization_arg = 'False'
|
||||
else:
|
||||
# 使用 AMCL
|
||||
localization_arg = 'True'
|
||||
|
||||
# Nav2 启动 - 使用正确的路径
|
||||
nav2_launch_path = os.path.join(nav2_bringup_dir, 'launch', 'bringup_launch.py')
|
||||
if not os.path.exists(nav2_launch_path):
|
||||
print(f"错误: 找不到 Nav2 启动文件: {nav2_launch_path}")
|
||||
return ld
|
||||
|
||||
nav2_bringup_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(nav2_launch_path),
|
||||
launch_arguments={
|
||||
'map': map_yaml_path,
|
||||
'use_sim_time': use_sim_time,
|
||||
'params_file': nav2_param_path,
|
||||
'slam': slam,
|
||||
'localization': localization_arg,
|
||||
'autostart': 'True',
|
||||
}.items(),
|
||||
)
|
||||
|
||||
ld.add_action(nav2_bringup_launch)
|
||||
|
||||
return ld
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
image: cyy_map.pgm
|
||||
mode: trinary
|
||||
resolution: 0.01
|
||||
origin: [-2.27, -1.63, 0]
|
||||
negate: 0
|
||||
occupied_thresh: 0.65
|
||||
free_thresh: 0.25
|
||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
image: cyy_map1.pgm
|
||||
mode: trinary
|
||||
resolution: 0.01
|
||||
origin: [-3.49, -3.24, 0]
|
||||
negate: 0
|
||||
occupied_thresh: 0.65
|
||||
free_thresh: 0.25
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>cyy_navigation2</name>
|
||||
<version>0.0.0</version>
|
||||
<description>TODO: Package description</description>
|
||||
<maintainer email="root@todo.todo">root</maintainer>
|
||||
<license>TODO: License declaration</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
|
||||
<depend>nav2_bringup</depend>
|
||||
|
||||
<test_depend>ament_lint_auto</test_depend>
|
||||
<test_depend>ament_lint_common</test_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
@@ -1,353 +0,0 @@
|
||||
amcl:
|
||||
ros__parameters:
|
||||
enabled: False
|
||||
use_sim_time: True
|
||||
alpha1: 0.2
|
||||
alpha2: 0.2
|
||||
alpha3: 0.2
|
||||
alpha4: 0.2
|
||||
alpha5: 0.2
|
||||
base_frame_id: "base_link"
|
||||
beam_skip_distance: 0.5
|
||||
beam_skip_error_threshold: 0.9
|
||||
beam_skip_threshold: 0.3
|
||||
do_beamskip: false
|
||||
global_frame_id: "map"
|
||||
lambda_short: 0.1
|
||||
laser_likelihood_max_dist: 2.0
|
||||
laser_max_range: 100.0
|
||||
laser_min_range: -1.0
|
||||
laser_model_type: "likelihood_field"
|
||||
max_beams: 60
|
||||
max_particles: 2000
|
||||
min_particles: 500
|
||||
odom_frame_id: "odom"
|
||||
pf_err: 0.05
|
||||
pf_z: 0.99
|
||||
recovery_alpha_fast: 0.0
|
||||
recovery_alpha_slow: 0.0
|
||||
resample_interval: 1
|
||||
robot_model_type: "nav2_amcl::DifferentialMotionModel"
|
||||
save_pose_rate: 0.5
|
||||
sigma_hit: 0.2
|
||||
tf_broadcast: true
|
||||
transform_tolerance: 1.0
|
||||
update_min_a: 0.2
|
||||
update_min_d: 0.25
|
||||
z_hit: 0.5
|
||||
z_max: 0.05
|
||||
z_rand: 0.5
|
||||
z_short: 0.05
|
||||
scan_topic: scan
|
||||
|
||||
bt_navigator:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
global_frame: map
|
||||
robot_base_frame: base_link
|
||||
odom_topic: /odom
|
||||
bt_loop_duration: 10
|
||||
default_server_timeout: 20
|
||||
wait_for_service_timeout: 1000
|
||||
# 'default_nav_through_poses_bt_xml' and 'default_nav_to_pose_bt_xml' are use defaults:
|
||||
# nav2_bt_navigator/navigate_to_pose_w_replanning_and_recovery.xml
|
||||
# nav2_bt_navigator/navigate_through_poses_w_replanning_and_recovery.xml
|
||||
# They can be set here or via a RewrittenYaml remap from a parent launch file to Nav2.
|
||||
plugin_lib_names:
|
||||
- nav2_compute_path_to_pose_action_bt_node
|
||||
- nav2_compute_path_through_poses_action_bt_node
|
||||
- nav2_smooth_path_action_bt_node
|
||||
- nav2_follow_path_action_bt_node
|
||||
- nav2_spin_action_bt_node
|
||||
- nav2_wait_action_bt_node
|
||||
- nav2_assisted_teleop_action_bt_node
|
||||
- nav2_back_up_action_bt_node
|
||||
- nav2_drive_on_heading_bt_node
|
||||
- nav2_clear_costmap_service_bt_node
|
||||
- nav2_is_stuck_condition_bt_node
|
||||
- nav2_goal_reached_condition_bt_node
|
||||
- nav2_goal_updated_condition_bt_node
|
||||
- nav2_globally_updated_goal_condition_bt_node
|
||||
- nav2_is_path_valid_condition_bt_node
|
||||
- nav2_initial_pose_received_condition_bt_node
|
||||
- nav2_reinitialize_global_localization_service_bt_node
|
||||
- nav2_rate_controller_bt_node
|
||||
- nav2_distance_controller_bt_node
|
||||
- nav2_speed_controller_bt_node
|
||||
- nav2_truncate_path_action_bt_node
|
||||
- nav2_truncate_path_local_action_bt_node
|
||||
- nav2_goal_updater_node_bt_node
|
||||
- nav2_recovery_node_bt_node
|
||||
- nav2_pipeline_sequence_bt_node
|
||||
- nav2_round_robin_node_bt_node
|
||||
- nav2_transform_available_condition_bt_node
|
||||
- nav2_time_expired_condition_bt_node
|
||||
- nav2_path_expiring_timer_condition
|
||||
- nav2_distance_traveled_condition_bt_node
|
||||
- nav2_single_trigger_bt_node
|
||||
- nav2_goal_updated_controller_bt_node
|
||||
- nav2_is_battery_low_condition_bt_node
|
||||
- nav2_navigate_through_poses_action_bt_node
|
||||
- nav2_navigate_to_pose_action_bt_node
|
||||
- nav2_remove_passed_goals_action_bt_node
|
||||
- nav2_planner_selector_bt_node
|
||||
- nav2_controller_selector_bt_node
|
||||
- nav2_goal_checker_selector_bt_node
|
||||
- nav2_controller_cancel_bt_node
|
||||
- nav2_path_longer_on_approach_bt_node
|
||||
- nav2_wait_cancel_bt_node
|
||||
- nav2_spin_cancel_bt_node
|
||||
- nav2_back_up_cancel_bt_node
|
||||
- nav2_assisted_teleop_cancel_bt_node
|
||||
- nav2_drive_on_heading_cancel_bt_node
|
||||
- nav2_is_battery_charging_condition_bt_node
|
||||
|
||||
bt_navigator_navigate_through_poses_rclcpp_node:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
|
||||
bt_navigator_navigate_to_pose_rclcpp_node:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
|
||||
controller_server:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
controller_frequency: 20.0
|
||||
min_x_velocity_threshold: 0.001
|
||||
min_y_velocity_threshold: 0.5
|
||||
min_theta_velocity_threshold: 0.001
|
||||
failure_tolerance: 0.3
|
||||
progress_checker_plugin: "progress_checker"
|
||||
goal_checker_plugins: ["general_goal_checker"] # "precise_goal_checker"
|
||||
controller_plugins: ["FollowPath"]
|
||||
|
||||
# Progress checker parameters
|
||||
progress_checker:
|
||||
plugin: "nav2_controller::SimpleProgressChecker"
|
||||
required_movement_radius: 0.5
|
||||
movement_time_allowance: 10.0
|
||||
# Goal checker parameters
|
||||
#precise_goal_checker:
|
||||
# plugin: "nav2_controller::SimpleGoalChecker"
|
||||
# xy_goal_tolerance: 0.25
|
||||
# yaw_goal_tolerance: 0.25
|
||||
# stateful: True
|
||||
general_goal_checker:
|
||||
stateful: True
|
||||
plugin: "nav2_controller::SimpleGoalChecker"
|
||||
xy_goal_tolerance: 0.25
|
||||
yaw_goal_tolerance: 6.28
|
||||
# DWB parameters
|
||||
FollowPath:
|
||||
plugin: "dwb_core::DWBLocalPlanner"
|
||||
debug_trajectory_details: True
|
||||
min_vel_x: -0.50
|
||||
min_vel_y: 0.0
|
||||
max_vel_x: 0.50
|
||||
max_vel_y: 0.0
|
||||
max_vel_theta: 1.0
|
||||
min_speed_xy: 0.0
|
||||
max_speed_xy: 0.50
|
||||
min_speed_theta: 0.0
|
||||
# Add high threshold velocity for turtlebot 3 issue.
|
||||
# https://github.com/ROBOTIS-GIT/turtlebot3_simulations/issues/75
|
||||
acc_lim_x: 2.5
|
||||
acc_lim_y: 0.0
|
||||
acc_lim_theta: 3.2
|
||||
decel_lim_x: -2.5
|
||||
decel_lim_y: 0.0
|
||||
decel_lim_theta: -3.2
|
||||
vx_samples: 20
|
||||
vy_samples: 0
|
||||
vtheta_samples: 20
|
||||
sim_time: 1.7
|
||||
linear_granularity: 0.05
|
||||
angular_granularity: 0.025
|
||||
transform_tolerance: 0.2
|
||||
xy_goal_tolerance: 0.25
|
||||
trans_stopped_velocity: 0.25
|
||||
short_circuit_trajectory_evaluation: True
|
||||
stateful: True
|
||||
critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
|
||||
BaseObstacle.scale: 0.01
|
||||
PathAlign.scale: 32.0
|
||||
PathAlign.forward_point_distance: 0.1
|
||||
GoalAlign.scale: 24.0
|
||||
GoalAlign.forward_point_distance: 0.1
|
||||
PathDist.scale: 32.0
|
||||
GoalDist.scale: 24.0
|
||||
RotateToGoal.scale: 32.0
|
||||
RotateToGoal.slowing_factor: 5.0
|
||||
RotateToGoal.lookahead_time: -1.0
|
||||
|
||||
local_costmap:
|
||||
local_costmap:
|
||||
ros__parameters:
|
||||
update_frequency: 5.0
|
||||
publish_frequency: 2.0
|
||||
global_frame: odom
|
||||
robot_base_frame: base_link
|
||||
use_sim_time: True
|
||||
rolling_window: true
|
||||
width: 3
|
||||
height: 3
|
||||
resolution: 0.05
|
||||
footprint: "[[0.2, 0.15], [0.2, -0.15], [-0.2, -0.15], [-0.2, 0.15]]"
|
||||
robot_radius: 0.00
|
||||
plugins: ["voxel_layer", "inflation_layer"]
|
||||
inflation_layer:
|
||||
plugin: "nav2_costmap_2d::InflationLayer"
|
||||
cost_scaling_factor: 3.0
|
||||
inflation_radius: 0.10
|
||||
voxel_layer:
|
||||
plugin: "nav2_costmap_2d::VoxelLayer"
|
||||
enabled: True
|
||||
publish_voxel_map: True
|
||||
origin_z: 0.0
|
||||
z_resolution: 0.05
|
||||
z_voxels: 16
|
||||
max_obstacle_height: 2.0
|
||||
mark_threshold: 0
|
||||
observation_sources: scan
|
||||
scan:
|
||||
topic: /scan
|
||||
max_obstacle_height: 2.0
|
||||
clearing: True
|
||||
marking: True
|
||||
data_type: "LaserScan"
|
||||
raytrace_max_range: 3.0
|
||||
raytrace_min_range: 0.0
|
||||
obstacle_max_range: 2.5
|
||||
obstacle_min_range: 0.0
|
||||
static_layer:
|
||||
plugin: "nav2_costmap_2d::StaticLayer"
|
||||
map_subscribe_transient_local: True
|
||||
always_send_full_costmap: True
|
||||
|
||||
global_costmap:
|
||||
global_costmap:
|
||||
ros__parameters:
|
||||
update_frequency: 1.0
|
||||
publish_frequency: 1.0
|
||||
global_frame: map
|
||||
robot_base_frame: base_link
|
||||
use_sim_time: True
|
||||
footprint: "[[0.2, 0.15], [0.2, -0.15], [-0.2, -0.15], [-0.2, 0.15]]"
|
||||
robot_radius: 0.0
|
||||
resolution: 0.05
|
||||
track_unknown_space: true
|
||||
plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
|
||||
obstacle_layer:
|
||||
plugin: "nav2_costmap_2d::ObstacleLayer"
|
||||
enabled: True
|
||||
observation_sources: scan
|
||||
scan:
|
||||
topic: /scan
|
||||
max_obstacle_height: 2.0
|
||||
clearing: True
|
||||
marking: True
|
||||
data_type: "LaserScan"
|
||||
raytrace_max_range: 3.0
|
||||
raytrace_min_range: 0.0
|
||||
obstacle_max_range: 2.5
|
||||
obstacle_min_range: 0.0
|
||||
static_layer:
|
||||
plugin: "nav2_costmap_2d::StaticLayer"
|
||||
map_subscribe_transient_local: True
|
||||
inflation_layer:
|
||||
plugin: "nav2_costmap_2d::InflationLayer"
|
||||
cost_scaling_factor: 3.0
|
||||
inflation_radius: 0.30
|
||||
always_send_full_costmap: True
|
||||
|
||||
map_server:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
# Overridden in launch by the "map" launch configuration or provided default value.
|
||||
# To use in yaml, remove the default "map" value in the tb3_simulation_launch.py file & provide full path to map below.
|
||||
yaml_filename: ""
|
||||
|
||||
map_saver:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
save_map_timeout: 5.0
|
||||
free_thresh_default: 0.25
|
||||
occupied_thresh_default: 0.65
|
||||
map_subscribe_transient_local: True
|
||||
|
||||
planner_server:
|
||||
ros__parameters:
|
||||
expected_planner_frequency: 20.0
|
||||
use_sim_time: True
|
||||
planner_plugins: ["GridBased"]
|
||||
GridBased:
|
||||
plugin: "nav2_navfn_planner/NavfnPlanner"
|
||||
tolerance: 0.5
|
||||
use_astar: false
|
||||
allow_unknown: true
|
||||
|
||||
smoother_server:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
smoother_plugins: ["simple_smoother"]
|
||||
simple_smoother:
|
||||
plugin: "nav2_smoother::SimpleSmoother"
|
||||
tolerance: 1.0e-10
|
||||
max_its: 1000
|
||||
do_refinement: True
|
||||
|
||||
behavior_server:
|
||||
ros__parameters:
|
||||
costmap_topic: local_costmap/costmap_raw
|
||||
footprint_topic: local_costmap/published_footprint
|
||||
cycle_frequency: 10.0
|
||||
behavior_plugins: ["spin", "backup", "drive_on_heading", "assisted_teleop", "wait"]
|
||||
spin:
|
||||
plugin: "nav2_behaviors/Spin"
|
||||
backup:
|
||||
plugin: "nav2_behaviors/BackUp"
|
||||
drive_on_heading:
|
||||
plugin: "nav2_behaviors/DriveOnHeading"
|
||||
wait:
|
||||
plugin: "nav2_behaviors/Wait"
|
||||
assisted_teleop:
|
||||
plugin: "nav2_behaviors/AssistedTeleop"
|
||||
global_frame: odom
|
||||
robot_base_frame: base_link
|
||||
transform_tolerance: 0.3
|
||||
use_sim_time: true
|
||||
simulate_ahead_time: 2.0
|
||||
max_rotational_vel: 1.0
|
||||
min_rotational_vel: 0.4
|
||||
rotational_acc_lim: 3.2
|
||||
|
||||
robot_state_publisher:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
|
||||
waypoint_follower:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
loop_rate: 20
|
||||
stop_on_failure: false
|
||||
waypoint_task_executor_plugin: "wait_at_waypoint"
|
||||
wait_at_waypoint:
|
||||
plugin: "nav2_waypoint_follower::WaitAtWaypoint"
|
||||
enabled: True
|
||||
waypoint_pause_duration: 200
|
||||
|
||||
velocity_smoother:
|
||||
ros__parameters:
|
||||
use_sim_time: True
|
||||
smoothing_frequency: 20.0
|
||||
scale_velocities: False
|
||||
feedback: "OPEN_LOOP"
|
||||
max_velocity: [0.26, 0.0, 1.0]
|
||||
min_velocity: [-0.26, 0.0, -1.0]
|
||||
max_accel: [2.5, 0.0, 3.2]
|
||||
max_decel: [-2.5, 0.0, -3.2]
|
||||
odom_topic: "odom"
|
||||
odom_duration: 0.1
|
||||
deadband_velocity: [0.0, 0.0, 0.0]
|
||||
velocity_timeout: 1.0
|
||||
@@ -1,54 +0,0 @@
|
||||
slam_toolbox:
|
||||
ros__parameters:
|
||||
# 核心模式设置
|
||||
mode: "localization" # 重要:设置为定位模式
|
||||
map_file_name: "" # 由启动参数传入
|
||||
map_start_pose: [0.0, 0.0, 0.0]
|
||||
# ROS框架设置
|
||||
odom_frame: "odom"
|
||||
map_frame: "map"
|
||||
base_frame: "base_link"
|
||||
scan_topic: "/scan"
|
||||
|
||||
# 求解器设置
|
||||
solver_plugin: "solver_plugins::CeresSolver"
|
||||
ceres_linear_solver: "SPARSE_NORMAL_CHOLESKY"
|
||||
ceres_preconditioner: "SCHUR_JACOBI"
|
||||
ceres_trust_strategy: "LEVENBERG_MARQUARDT"
|
||||
ceres_dogleg_type: "TRADITIONAL_DOGLEG"
|
||||
ceres_loss_function: "None"
|
||||
|
||||
# 定位优化参数
|
||||
use_scan_matching: true
|
||||
use_scan_barycenter: true
|
||||
minimum_travel_distance: 0.05
|
||||
minimum_travel_heading: 0.087
|
||||
|
||||
# 扫描处理
|
||||
scan_buffer_size: 20
|
||||
throttle_scans: 1
|
||||
|
||||
# 回环检测(定位模式可关闭)
|
||||
do_loop_closing: false
|
||||
|
||||
# 搜索参数
|
||||
link_match_minimum_response_fine: 0.2
|
||||
link_scan_maximum_distance: 2.0
|
||||
loop_search_maximum_distance: 5.0
|
||||
|
||||
# 性能参数
|
||||
minimum_time_interval: 0.1
|
||||
transform_publish_period: 0.02
|
||||
map_update_interval: 0.5
|
||||
|
||||
# 地图参数
|
||||
resolution: 0.05
|
||||
max_laser_range: 15.0
|
||||
min_laser_range: 0.2
|
||||
|
||||
# 初始位姿(可选,可以通过RViz设置)
|
||||
# map_start_pose: [0.0, 0.0, 0.0]
|
||||
|
||||
# 调试
|
||||
debug_logging: false
|
||||
enable_interactive_mode: true
|
||||
@@ -1,61 +0,0 @@
|
||||
# 设置CMake最低版本要求
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
# 定义项目名称(应与package.xml中的<name>一致)
|
||||
project(cyy_slamtoolbox)
|
||||
|
||||
# 如果未设置,默认使用C++17标准
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
# 查找编译依赖
|
||||
find_package(ament_cmake REQUIRED)
|
||||
# 查找slam_toolbox包
|
||||
find_package(slam_toolbox REQUIRED)
|
||||
# 查找其他可能的依赖,如传感器消息、几何库等
|
||||
find_package(rclcpp REQUIRED)
|
||||
find_package(std_msgs REQUIRED)
|
||||
find_package(sensor_msgs REQUIRED)
|
||||
find_package(nav_msgs REQUIRED)
|
||||
find_package(tf2 REQUIRED)
|
||||
find_package(tf2_ros REQUIRED)
|
||||
find_package(geometry_msgs REQUIRED)
|
||||
|
||||
# 消息输出,用于调试
|
||||
message(STATUS "开始配置项目: ${PROJECT_NAME}")
|
||||
|
||||
# 包含头文件目录
|
||||
include_directories(
|
||||
include
|
||||
${ament_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# 如果有自定义的C++节点源文件,在此添加可执行文件
|
||||
# 例如,如果您有自定义的SLAM处理节点:
|
||||
# add_executable(origincar_slam_node src/origincar_slam_node.cpp)
|
||||
# ament_target_dependencies(origincar_slam_node
|
||||
# rclcpp std_msgs sensor_msgs nav_msgs tf2 tf2_ros geometry_msgs slam_toolbox)
|
||||
#
|
||||
# 安装目标(将可执行文件安装到lib/<package_name>)
|
||||
# install(TARGETS origincar_slam_node
|
||||
# DESTINATION lib/${PROJECT_NAME})
|
||||
|
||||
# 安装launch文件到share/<package_name>/launch目录
|
||||
install(DIRECTORY launch
|
||||
DESTINATION share/${PROJECT_NAME}
|
||||
PATTERN "*.py"
|
||||
)
|
||||
|
||||
# 安装配置文件(如YAML参数文件)到share/<package_name>/config目录
|
||||
install(DIRECTORY config
|
||||
DESTINATION share/${PROJECT_NAME}
|
||||
PATTERN "*.yaml"
|
||||
PATTERN "*.yml"
|
||||
)
|
||||
|
||||
|
||||
# 声明ament包依赖关系(确保在package.xml中已声明这些依赖)
|
||||
ament_export_dependencies(slam_toolbox rclcpp std_msgs sensor_msgs nav_msgs tf2 tf2_ros geometry_msgs)
|
||||
|
||||
# 必须调用此函数来生成必要的CMake配置
|
||||
ament_package()
|
||||
@@ -1,9 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: angle
|
||||
type: laser_filters/LaserScanAngularBoundsFilter
|
||||
params:
|
||||
lower_angle: -1.52
|
||||
upper_angle: 1.52
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: box_filter
|
||||
type: laser_filters/LaserScanBoxFilter
|
||||
params:
|
||||
box_frame: base_link
|
||||
max_x: 0.5
|
||||
max_y: 0.5
|
||||
max_z: 0.5
|
||||
min_x: -0.5
|
||||
min_y: -0.5
|
||||
min_z: -0.5
|
||||
|
||||
invert: false # activate to remove all points outside of the box
|
||||
@@ -1,7 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: footprint_filter
|
||||
type: laser_filters/LaserScanFootprintFilter
|
||||
params:
|
||||
inscribed_radius: 0.325
|
||||
@@ -1,9 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: intensity
|
||||
type: laser_filters/LaserScanIntensityFilter
|
||||
params:
|
||||
lower_threshold: 8000.
|
||||
upper_threshold: 100000.
|
||||
disp_histogram: 0
|
||||
@@ -1,19 +0,0 @@
|
||||
scan_filter_chain:
|
||||
- name: angle_bounds
|
||||
type: laser_filters/LaserScanAngularBoundsFilter
|
||||
params:
|
||||
# 示例:如果您只想处理前方180度的数据,可以设置为:
|
||||
lower_angle: -1.57 # 约-90度
|
||||
upper_angle: 1.57 # 约90度
|
||||
|
||||
- name: range_filter
|
||||
type: laser_filters/LaserScanRangeFilter
|
||||
params:
|
||||
# 过滤掉无效的距离值,这对于SLAM非常重要
|
||||
lower_threshold: 0.2 # 忽略小于0.2米的测量(如雷达自身的噪声)
|
||||
upper_threshold: 20.0 # 忽略大于20.0米的测量(通常是不稳定的数据)
|
||||
use_message_range_limits: false
|
||||
|
||||
- name: interpolation
|
||||
type: laser_filters/InterpolationFilter
|
||||
# 此滤波器没有参数,它会自动对因过滤产生的无效值(如NaN)进行插值修复[1](@ref)
|
||||
@@ -1,87 +0,0 @@
|
||||
|
||||
slam_toolbox:
|
||||
ros__parameters:
|
||||
|
||||
# Plugin params
|
||||
solver_plugin: solver_plugins::CeresSolver
|
||||
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
|
||||
ceres_preconditioner: SCHUR_JACOBI
|
||||
ceres_trust_strategy: LEVENBERG_MARQUARDT
|
||||
ceres_dogleg_type: TRADITIONAL_DOGLEG
|
||||
ceres_loss_function: None
|
||||
|
||||
# ROS Parameters
|
||||
odom_frame: odom
|
||||
map_frame: map
|
||||
base_frame: base_footprint
|
||||
scan_topic: /scan
|
||||
use_map_saver: true
|
||||
mode: mapping
|
||||
|
||||
# lifelong params
|
||||
lifelong_search_use_tree: false
|
||||
lifelong_minimum_score: 0.1
|
||||
lifelong_iou_match: 0.85
|
||||
lifelong_node_removal_score: 0.04
|
||||
lifelong_overlap_score_scale: 0.06
|
||||
lifelong_constraint_multiplier: 0.08
|
||||
lifelong_nearby_penalty: 0.001
|
||||
lifelong_candidates_scale: 0.03
|
||||
|
||||
# if you'd like to immediately start continuing a map at a given pose
|
||||
# or at the dock, but they are mutually exclusive, if pose is given
|
||||
# will use pose
|
||||
#map_file_name: test_steve
|
||||
#map_start_pose: [0.0, 0.0, 0.0]
|
||||
#map_start_at_dock: true
|
||||
|
||||
debug_logging: false
|
||||
throttle_scans: 1
|
||||
transform_publish_period: 0.02 #if 0 never publishes odometry
|
||||
map_update_interval: 5.0
|
||||
resolution: 0.05
|
||||
min_laser_range: 0.0 #for rastering images
|
||||
max_laser_range: 20.0 #for rastering images
|
||||
minimum_time_interval: 0.5
|
||||
transform_timeout: 0.2
|
||||
tf_buffer_duration: 10.
|
||||
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
|
||||
|
||||
# General Parameters
|
||||
use_scan_matching: true
|
||||
use_scan_barycenter: true
|
||||
minimum_travel_distance: 0.5
|
||||
minimum_travel_heading: 0.5
|
||||
scan_buffer_size: 10
|
||||
scan_buffer_maximum_scan_distance: 10.0
|
||||
link_match_minimum_response_fine: 0.1
|
||||
link_scan_maximum_distance: 1.5
|
||||
loop_search_maximum_distance: 3.0
|
||||
do_loop_closing: true
|
||||
loop_match_minimum_chain_size: 10
|
||||
loop_match_maximum_variance_coarse: 3.0
|
||||
loop_match_minimum_response_coarse: 0.35
|
||||
loop_match_minimum_response_fine: 0.45
|
||||
|
||||
# Correlation Parameters - Correlation Parameters
|
||||
correlation_search_space_dimension: 0.5
|
||||
correlation_search_space_resolution: 0.01
|
||||
correlation_search_space_smear_deviation: 0.1
|
||||
|
||||
# Correlation Parameters - Loop Closure Parameters
|
||||
loop_search_space_dimension: 8.0
|
||||
loop_search_space_resolution: 0.05
|
||||
loop_search_space_smear_deviation: 0.03
|
||||
|
||||
# Scan Matcher Parameters
|
||||
distance_variance_penalty: 0.5
|
||||
angle_variance_penalty: 1.0
|
||||
|
||||
fine_search_angle_offset: 0.00349
|
||||
coarse_search_angle_offset: 0.349
|
||||
coarse_angle_resolution: 0.0349
|
||||
minimum_angle_penalty: 0.9
|
||||
minimum_distance_penalty: 0.5
|
||||
use_response_expansion: true
|
||||
min_pass_through: 2
|
||||
occupancy_threshold: 0.1
|
||||
@@ -1,70 +0,0 @@
|
||||
slam_toolbox:
|
||||
ros__parameters:
|
||||
solver_plugin: solver_plugins::CeresSolver
|
||||
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
|
||||
ceres_preconditioner: SCHUR_JACOBI
|
||||
ceres_trust_strategy: LEVENBERG_MARQUARDT
|
||||
ceres_dogleg_type: TRADITIONAL_DOGLEG
|
||||
ceres_loss_function: None
|
||||
|
||||
# ROS Parameters
|
||||
odom_frame: odom
|
||||
map_frame: map
|
||||
base_frame: base_link
|
||||
scan_topic: /scan
|
||||
mode: localization #localization
|
||||
|
||||
# if you'd like to start localizing on bringup in a map and pose
|
||||
#map_file_name: test_steve
|
||||
#map_start_pose: [5.0, 1.0, 0.0]
|
||||
|
||||
debug_logging: false
|
||||
throttle_scans: 1
|
||||
transform_publish_period: 0.02 #if 0 never publishes odometry
|
||||
map_update_interval: 5.0
|
||||
resolution: 0.05
|
||||
min_laser_range: 0.0 #for rastering images
|
||||
max_laser_range: 20.0 #for rastering images
|
||||
minimum_time_interval: 0.5
|
||||
transform_timeout: 0.2
|
||||
tf_buffer_duration: 30.
|
||||
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
|
||||
|
||||
# General Parameters
|
||||
use_scan_matching: true
|
||||
use_scan_barycenter: true
|
||||
minimum_travel_distance: 0.5
|
||||
minimum_travel_heading: 0.5
|
||||
scan_buffer_size: 3
|
||||
scan_buffer_maximum_scan_distance: 10.0
|
||||
link_match_minimum_response_fine: 0.1
|
||||
link_scan_maximum_distance: 1.5
|
||||
do_loop_closing: true
|
||||
loop_match_minimum_chain_size: 3
|
||||
loop_match_maximum_variance_coarse: 3.0
|
||||
loop_match_minimum_response_coarse: 0.35
|
||||
loop_match_minimum_response_fine: 0.45
|
||||
|
||||
# Correlation Parameters - Correlation Parameters
|
||||
correlation_search_space_dimension: 0.5
|
||||
correlation_search_space_resolution: 0.01
|
||||
correlation_search_space_smear_deviation: 0.1
|
||||
|
||||
# Correlation Parameters - Loop Closure Parameters
|
||||
loop_search_space_dimension: 8.0
|
||||
loop_search_space_resolution: 0.05
|
||||
loop_search_space_smear_deviation: 0.03
|
||||
loop_search_maximum_distance: 3.0
|
||||
|
||||
# Scan Matcher Parameters
|
||||
distance_variance_penalty: 0.5
|
||||
angle_variance_penalty: 1.0
|
||||
|
||||
fine_search_angle_offset: 0.00349
|
||||
coarse_search_angle_offset: 0.349
|
||||
coarse_angle_resolution: 0.0349
|
||||
minimum_angle_penalty: 0.9
|
||||
minimum_distance_penalty: 0.5
|
||||
use_response_expansion: true
|
||||
min_pass_through: 2
|
||||
occupancy_threshold: 0.1
|
||||
@@ -1,69 +0,0 @@
|
||||
slam_toolbox:
|
||||
ros__parameters:
|
||||
|
||||
# Plugin params
|
||||
solver_plugin: solver_plugins::CeresSolver
|
||||
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
|
||||
ceres_preconditioner: SCHUR_JACOBI
|
||||
ceres_trust_strategy: LEVENBERG_MARQUARDT
|
||||
ceres_dogleg_type: TRADITIONAL_DOGLEG
|
||||
ceres_loss_function: None
|
||||
|
||||
# ROS Parameters
|
||||
odom_frame: odom
|
||||
map_frame: map
|
||||
base_frame: base_footprint
|
||||
scan_topic: /scan
|
||||
use_map_saver: true
|
||||
mode: mapping #localization
|
||||
debug_logging: false
|
||||
throttle_scans: 1
|
||||
transform_publish_period: 0.02 #if 0 never publishes odometry
|
||||
map_update_interval: 10.0
|
||||
resolution: 0.05
|
||||
min_laser_range: 0.0 #for rastering images
|
||||
max_laser_range: 20.0 #for rastering images
|
||||
minimum_time_interval: 0.5
|
||||
transform_timeout: 0.2
|
||||
tf_buffer_duration: 14400.
|
||||
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
|
||||
enable_interactive_mode: true
|
||||
|
||||
# General Parameters
|
||||
use_scan_matching: true
|
||||
use_scan_barycenter: true
|
||||
minimum_travel_distance: 0.5
|
||||
minimum_travel_heading: 0.5
|
||||
scan_buffer_size: 10
|
||||
scan_buffer_maximum_scan_distance: 10.0
|
||||
link_match_minimum_response_fine: 0.1
|
||||
link_scan_maximum_distance: 1.5
|
||||
loop_search_maximum_distance: 3.0
|
||||
do_loop_closing: true
|
||||
loop_match_minimum_chain_size: 10
|
||||
loop_match_maximum_variance_coarse: 3.0
|
||||
loop_match_minimum_response_coarse: 0.35
|
||||
loop_match_minimum_response_fine: 0.45
|
||||
|
||||
# Correlation Parameters - Correlation Parameters
|
||||
correlation_search_space_dimension: 0.5
|
||||
correlation_search_space_resolution: 0.01
|
||||
correlation_search_space_smear_deviation: 0.1
|
||||
|
||||
# Correlation Parameters - Loop Closure Parameters
|
||||
loop_search_space_dimension: 8.0
|
||||
loop_search_space_resolution: 0.05
|
||||
loop_search_space_smear_deviation: 0.03
|
||||
|
||||
# Scan Matcher Parameters
|
||||
distance_variance_penalty: 0.5
|
||||
angle_variance_penalty: 1.0
|
||||
|
||||
fine_search_angle_offset: 0.00349
|
||||
coarse_search_angle_offset: 0.349
|
||||
coarse_angle_resolution: 0.0349
|
||||
minimum_angle_penalty: 0.9
|
||||
minimum_distance_penalty: 0.5
|
||||
use_response_expansion: true
|
||||
min_pass_through: 2
|
||||
occupancy_threshold: 0.1
|
||||
@@ -1,78 +0,0 @@
|
||||
slam_toolbox:
|
||||
ros__parameters:
|
||||
|
||||
# Plugin params
|
||||
solver_plugin: solver_plugins::CeresSolver
|
||||
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
|
||||
ceres_preconditioner: SCHUR_JACOBI
|
||||
ceres_trust_strategy: LEVENBERG_MARQUARDT
|
||||
ceres_dogleg_type: TRADITIONAL_DOGLEG
|
||||
ceres_loss_function: None
|
||||
|
||||
# ROS Parameters
|
||||
odom_frame: odom
|
||||
map_frame: map
|
||||
base_frame: base_link
|
||||
scan_topic: /scan
|
||||
use_map_saver: true
|
||||
mode: mapping #localization
|
||||
samples: 440
|
||||
# if you'd like to immediately start continuing a map at a given pose
|
||||
# or at the dock, but they are mutually exclusive, if pose is given
|
||||
# will use pose
|
||||
#map_file_name: test_steve
|
||||
# map_start_pose: [0.0, 0.0, 0.0]
|
||||
#map_start_at_dock: true
|
||||
|
||||
debug_logging: false
|
||||
throttle_scans: 5
|
||||
transform_publish_period: 0.02 #if 0 never publishes odometry
|
||||
map_update_interval: 0.01
|
||||
resolution: 0.01
|
||||
min_laser_range: 0.21 #for rastering images
|
||||
max_laser_range: 15.0 #for rastering images
|
||||
minimum_time_interval: 0.1
|
||||
transform_timeout: 2.0
|
||||
tf_buffer_duration: 30.
|
||||
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
|
||||
enable_interactive_mode: true
|
||||
|
||||
# General Parameters
|
||||
use_scan_matching: true
|
||||
use_scan_barycenter: true
|
||||
minimum_travel_distance: 0.2
|
||||
minimum_travel_heading: 0.2
|
||||
scan_buffer_size: 10
|
||||
samples: 440
|
||||
scan_buffer_maximum_scan_distance: 10.0
|
||||
link_match_minimum_response_fine: 0.1
|
||||
link_scan_maximum_distance: 1.5
|
||||
loop_search_maximum_distance: 3.0
|
||||
do_loop_closing: true
|
||||
loop_match_minimum_chain_size: 10
|
||||
loop_match_maximum_variance_coarse: 3.0
|
||||
loop_match_minimum_response_coarse: 0.35
|
||||
loop_match_minimum_response_fine: 0.45
|
||||
|
||||
# Correlation Parameters - Correlation Parameters
|
||||
correlation_search_space_dimension: 0.5
|
||||
correlation_search_space_resolution: 0.05
|
||||
correlation_search_space_smear_deviation: 0.1
|
||||
|
||||
# Correlation Parameters - Loop Closure Parameters
|
||||
loop_search_space_dimension: 8.0
|
||||
loop_search_space_resolution: 0.05
|
||||
loop_search_space_smear_deviation: 0.03
|
||||
|
||||
# Scan Matcher Parameters
|
||||
distance_variance_penalty: 0.5
|
||||
angle_variance_penalty: 1.0
|
||||
|
||||
fine_search_angle_offset: 0.00349
|
||||
coarse_search_angle_offset: 0.349
|
||||
coarse_angle_resolution: 0.0349
|
||||
minimum_angle_penalty: 0.9
|
||||
minimum_distance_penalty: 0.5
|
||||
use_response_expansion: true
|
||||
min_pass_through: 2
|
||||
occupancy_threshold: 0.1
|
||||
@@ -1,77 +0,0 @@
|
||||
slam_toolbox:
|
||||
ros__parameters:
|
||||
|
||||
# Plugin params
|
||||
solver_plugin: solver_plugins::CeresSolver
|
||||
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
|
||||
ceres_preconditioner: SCHUR_JACOBI
|
||||
ceres_trust_strategy: LEVENBERG_MARQUARDT
|
||||
ceres_dogleg_type: TRADITIONAL_DOGLEG
|
||||
ceres_loss_function: None
|
||||
|
||||
# ROS Parameters
|
||||
odom_frame: odom
|
||||
map_frame: map
|
||||
base_frame: base_footprint
|
||||
scan_topic: /scan
|
||||
use_map_saver: true
|
||||
mode: mapping #localization
|
||||
|
||||
# if you'd like to immediately start continuing a map at a given pose
|
||||
# or at the dock, but they are mutually exclusive, if pose is given
|
||||
# will use pose
|
||||
#map_file_name: test_steve
|
||||
#map_start_pose: [0.0, 0.0, 0.0]
|
||||
#map_start_at_dock: true
|
||||
|
||||
debug_logging: false
|
||||
throttle_scans: 1
|
||||
transform_publish_period: 0.02 #if 0 never publishes odometry
|
||||
map_update_interval: 5.0
|
||||
resolution: 0.05
|
||||
min_laser_range: 0.0 #for rastering images
|
||||
max_laser_range: 20.0 #for rastering images
|
||||
minimum_time_interval: 0.5
|
||||
transform_timeout: 0.2
|
||||
tf_buffer_duration: 30.
|
||||
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
|
||||
enable_interactive_mode: true
|
||||
|
||||
# General Parameters
|
||||
use_scan_matching: true
|
||||
use_scan_barycenter: true
|
||||
minimum_travel_distance: 0.5
|
||||
minimum_travel_heading: 0.5
|
||||
scan_buffer_size: 10
|
||||
scan_buffer_maximum_scan_distance: 10.0
|
||||
link_match_minimum_response_fine: 0.1
|
||||
link_scan_maximum_distance: 1.5
|
||||
loop_search_maximum_distance: 3.0
|
||||
do_loop_closing: true
|
||||
loop_match_minimum_chain_size: 10
|
||||
loop_match_maximum_variance_coarse: 3.0
|
||||
loop_match_minimum_response_coarse: 0.35
|
||||
loop_match_minimum_response_fine: 0.45
|
||||
|
||||
# Correlation Parameters - Correlation Parameters
|
||||
correlation_search_space_dimension: 0.5
|
||||
correlation_search_space_resolution: 0.01
|
||||
correlation_search_space_smear_deviation: 0.1
|
||||
|
||||
# Correlation Parameters - Loop Closure Parameters
|
||||
loop_search_space_dimension: 8.0
|
||||
loop_search_space_resolution: 0.05
|
||||
loop_search_space_smear_deviation: 0.03
|
||||
|
||||
# Scan Matcher Parameters
|
||||
distance_variance_penalty: 0.5
|
||||
angle_variance_penalty: 1.0
|
||||
|
||||
fine_search_angle_offset: 0.00349
|
||||
coarse_search_angle_offset: 0.349
|
||||
coarse_angle_resolution: 0.0349
|
||||
minimum_angle_penalty: 0.9
|
||||
minimum_distance_penalty: 0.5
|
||||
use_response_expansion: true
|
||||
min_pass_through: 2
|
||||
occupancy_threshold: 0.1
|
||||
@@ -1,16 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: mask
|
||||
type: laser_filters/LaserScanMaskFilter
|
||||
params:
|
||||
masks:
|
||||
laser:
|
||||
- 100.
|
||||
- 101.
|
||||
- 102.
|
||||
- 103.
|
||||
- 104.
|
||||
- 1000.
|
||||
- 1001.
|
||||
- 1002.
|
||||
@@ -1,20 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
type: laser_filters/LaserArrayFilter
|
||||
name: median
|
||||
params:
|
||||
range_filter_chain:
|
||||
filter1:
|
||||
name: median
|
||||
type: filters/MultiChannelMedianFilterFloat
|
||||
params:
|
||||
number_of_observations: 5
|
||||
unused: 10
|
||||
intensity_filter_chain:
|
||||
filter1:
|
||||
name: median
|
||||
type: filters/MultiChannelMedianFilterFloat
|
||||
params:
|
||||
number_of_observations: 5
|
||||
unused: 10
|
||||
@@ -1,17 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: median_spatial
|
||||
type: laser_filters/LaserScanMedianSpatialFilter
|
||||
params:
|
||||
window_size: 31
|
||||
filter2:
|
||||
name: median_filter
|
||||
type: laser_filters/LaserArrayFilter
|
||||
params:
|
||||
range_filter_chain:
|
||||
filter1:
|
||||
name: median
|
||||
type: filters/MultiChannelMedianFilterFloat
|
||||
params:
|
||||
number_of_observations: 3
|
||||
@@ -1,42 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
type: laser_filters/LaserArrayFilter
|
||||
name: laser_median_5
|
||||
params:
|
||||
range_filter_chain:
|
||||
filter1:
|
||||
name: median_5
|
||||
type: filters/MultiChannelMedianFilterFloat
|
||||
params:
|
||||
number_of_observations: 5
|
||||
unused: 10
|
||||
intensity_filter_chain:
|
||||
filter2:
|
||||
name: median_5
|
||||
type: filters/MultiChannelMedianFilterFloat
|
||||
params:
|
||||
number_of_observations: 5
|
||||
unused: 10
|
||||
filter2:
|
||||
name: intensity
|
||||
type: laser_filters/LaserScanIntensityFilter
|
||||
params:
|
||||
lower_threshold: 8000.
|
||||
upper_threshold: 100000.
|
||||
disp_histogram: 0
|
||||
filter3:
|
||||
name: shadows
|
||||
type: laser_filters/ScanShadowsFilter
|
||||
params:
|
||||
min_angle: 10.
|
||||
max_angle: 170.
|
||||
neighbors: 20
|
||||
window: 0
|
||||
filter4:
|
||||
name: dark_shadows
|
||||
type: laser_filters/LaserScanIntensityFilter
|
||||
params:
|
||||
lower_threshold: 100.
|
||||
upper_threshold: 10000.
|
||||
disp_histogram: 0
|
||||
@@ -1,10 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: polygon_filter
|
||||
type: laser_filters/LaserScanPolygonFilter
|
||||
params:
|
||||
polygon_frame: base_link
|
||||
polygon: '[[0.0, 0.0], [0.1, 0.1], [0.1, 0.0], [0.0, -0.1]]'
|
||||
invert: false
|
||||
footprint_topic: base_footprint_exclude
|
||||
@@ -1,11 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: box_filter
|
||||
type: laser_filters/LaserScanRangeFilter
|
||||
params:
|
||||
use_message_range_limits: false # if not specified defaults to false
|
||||
lower_threshold: 0.5 # if not specified defaults to 0.0
|
||||
upper_threshold: 1.0 # if not specified defaults to 100000.0
|
||||
lower_replacement_value: -.inf # if not specified defaults to NaN
|
||||
upper_replacement_value: .inf # if not specified defaults to NaN
|
||||
@@ -1,8 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: scan_blob_filter
|
||||
type: laser_filters/ScanBlobFilter
|
||||
params:
|
||||
max_radius: 0.25 # maximum radius to be considered as blob object
|
||||
min_points: 6 # min scan points to be considered as blob object
|
||||
@@ -1,12 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: scan_filter
|
||||
type: laser_filters/LaserScanSectorFilter
|
||||
params:
|
||||
angle_min: 2.54 # if not specified defaults to 0.0
|
||||
angle_max: -2.54 # if not specified defaults to 0.0
|
||||
range_min: 0.2 # if not specified defaults to 0.0
|
||||
range_max: 2.0 # if not specified defaults to 100000.0
|
||||
clear_inside: true # if not specified defaults to true
|
||||
invert: false # (!clear_inside) if not specified defaults to false
|
||||
@@ -1,18 +0,0 @@
|
||||
scan_to_scan_filter_chain:
|
||||
ros__parameters:
|
||||
filter1:
|
||||
name: shadows
|
||||
type: laser_filters/ScanShadowsFilter
|
||||
params:
|
||||
min_angle: 10.
|
||||
max_angle: 170.
|
||||
neighbors: 20
|
||||
window: 1
|
||||
filter2:
|
||||
name: dark_shadows
|
||||
type: laser_filters/LaserScanIntensityFilter
|
||||
params:
|
||||
lower_threshold: 100.
|
||||
upper_threshold: 10000.
|
||||
disp_histogram: 0
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
Panels:
|
||||
- Class: rviz_common/Displays
|
||||
Help Height: 78
|
||||
Name: Displays
|
||||
Property Tree Widget:
|
||||
Expanded:
|
||||
- /Global Options1
|
||||
- /Status1
|
||||
Splitter Ratio: 0.5
|
||||
Tree Height: 154
|
||||
- Class: rviz_common/Selection
|
||||
Name: Selection
|
||||
- Class: rviz_common/Tool Properties
|
||||
Expanded:
|
||||
- /2D Goal Pose1
|
||||
- /Publish Point1
|
||||
Name: Tool Properties
|
||||
Splitter Ratio: 0.5886790156364441
|
||||
- Class: rviz_common/Views
|
||||
Expanded:
|
||||
- /Current View1
|
||||
Name: Views
|
||||
Splitter Ratio: 0.5
|
||||
- Class: rviz_common/Time
|
||||
Experimental: false
|
||||
Name: Time
|
||||
SyncMode: 0
|
||||
SyncSource: ""
|
||||
- Class: slam_toolbox::SlamToolboxPlugin
|
||||
Name: SlamToolboxPlugin
|
||||
Visualization Manager:
|
||||
Class: ""
|
||||
Displays:
|
||||
- Alpha: 0.5
|
||||
Cell Size: 1
|
||||
Class: rviz_default_plugins/Grid
|
||||
Color: 160; 160; 164
|
||||
Enabled: true
|
||||
Line Style:
|
||||
Line Width: 0.029999999329447746
|
||||
Value: Lines
|
||||
Name: Grid
|
||||
Normal Cell Count: 0
|
||||
Offset:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Plane: XY
|
||||
Plane Cell Count: 10
|
||||
Reference Frame: <Fixed Frame>
|
||||
Value: true
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Fixed Frame: map
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
- Class: rviz_default_plugins/Interact
|
||||
Hide Inactive Objects: true
|
||||
- Class: rviz_default_plugins/MoveCamera
|
||||
- Class: rviz_default_plugins/Select
|
||||
- Class: rviz_default_plugins/FocusCamera
|
||||
- Class: rviz_default_plugins/Measure
|
||||
Line color: 128; 128; 0
|
||||
- Class: rviz_default_plugins/SetInitialPose
|
||||
Covariance x: 0.25
|
||||
Covariance y: 0.25
|
||||
Covariance yaw: 0.06853891909122467
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /initialpose
|
||||
- Class: rviz_default_plugins/SetGoal
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /goal_pose
|
||||
- Class: rviz_default_plugins/PublishPoint
|
||||
Single click: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /clicked_point
|
||||
Transformation:
|
||||
Current:
|
||||
Class: rviz_default_plugins/TF
|
||||
Value: true
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz_default_plugins/Orbit
|
||||
Distance: 10
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Focal Point:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Focal Shape Fixed Size: true
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: Current View
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: 0.785398006439209
|
||||
Target Frame: <Fixed Frame>
|
||||
Value: Orbit (rviz)
|
||||
Yaw: 0.785398006439209
|
||||
Saved: ~
|
||||
Window Geometry:
|
||||
Displays:
|
||||
collapsed: false
|
||||
Height: 846
|
||||
Hide Left Dock: false
|
||||
Hide Right Dock: false
|
||||
QMainWindow State: 000000ff00000000fd000000040000000000000217000002b0fc0200000009fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d00000125000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb000000220053006c0061006d0054006f006f006c0062006f00780050006c007500670069006e0100000168000001850000018500ffffff000000010000010f000002b0fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d000002b0000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b0000002eb00fffffffb0000000800540069006d006501000000000000045000000000000000000000017e000002b000000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
Selection:
|
||||
collapsed: false
|
||||
SlamToolboxPlugin:
|
||||
collapsed: false
|
||||
Time:
|
||||
collapsed: false
|
||||
Tool Properties:
|
||||
collapsed: false
|
||||
Views:
|
||||
collapsed: false
|
||||
Width: 1200
|
||||
X: 72
|
||||
Y: 60
|
||||
@@ -1,19 +0,0 @@
|
||||
scan_filter_chain:
|
||||
- name: speckle_filter
|
||||
type: laser_filters/LaserScanSpeckleFilter
|
||||
params:
|
||||
# Select which filter type to use.
|
||||
# 0: Range based filtering (distance between consecutive points)
|
||||
# 1: Euclidean filtering based on radius outlier search
|
||||
filter_type: 0
|
||||
|
||||
# Only ranges smaller than this range are taken into account
|
||||
max_range: 2.0
|
||||
|
||||
# filter_type[0] (Distance): max distance between consecutive points
|
||||
# filter_type[1] (RadiusOutlier): max distance between points
|
||||
max_range_difference: 0.1
|
||||
|
||||
# filter_type[0] (Distance): Number of consecutive ranges that will be tested for max_distance
|
||||
# filter_type[1] (RadiusOutlier): Minimum number of neighbors
|
||||
filter_window: 2
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
import os
|
||||
|
||||
def generate_launch_description():
|
||||
# 获取参数文件路径
|
||||
pkg_share = get_package_share_directory('cyy_slamtoolbox')
|
||||
params_file = os.path.join(pkg_share, 'config', 'mapper_params_online_async.yaml')
|
||||
|
||||
# 创建SLAM Toolbox节点
|
||||
slam_toolbox_node = Node(
|
||||
package='slam_toolbox',
|
||||
executable='async_slam_toolbox_node', # 或 sync_slam_toolbox_node
|
||||
name='slam_toolbox',
|
||||
output='screen',
|
||||
parameters=[params_file]
|
||||
)
|
||||
|
||||
|
||||
return LaunchDescription([
|
||||
slam_toolbox_node
|
||||
])
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
import os
|
||||
|
||||
def generate_launch_description():
|
||||
# 获取参数文件路径
|
||||
pkg_share = get_package_share_directory('cyy_slamtoolbox')
|
||||
params_file = os.path.join(pkg_share, 'config', 'mapper_params_localization.yaml')
|
||||
|
||||
# 创建SLAM Toolbox节点
|
||||
slam_toolbox_node = Node(
|
||||
package='slam_toolbox',
|
||||
executable='localization_slam_toolbox_node', # 或 sync_slam_toolbox_node
|
||||
name='slam_toolbox',
|
||||
output='screen',
|
||||
parameters=[params_file]
|
||||
)
|
||||
|
||||
|
||||
return LaunchDescription([
|
||||
slam_toolbox_node
|
||||
])
|
||||
@@ -1,24 +0,0 @@
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
import os
|
||||
|
||||
def generate_launch_description():
|
||||
# 假设配置文件路径,你需要根据实际情况修改
|
||||
config_path = os.path.join(
|
||||
get_package_share_directory('cyy_slamtoolbox'),
|
||||
'config',
|
||||
'angular_filter_example.yaml'
|
||||
)
|
||||
|
||||
laser_filter_node = Node(
|
||||
package='laser_filters',
|
||||
executable='scan_to_scan_filter_chain',
|
||||
name='laser_filter',
|
||||
output='screen',
|
||||
parameters=[config_path],
|
||||
# 重新映射话题:从/base_scan原始数据过滤后发布到/scan
|
||||
remappings=[('scan', '/base_scan'), ('scan_filtered', '/scan')]
|
||||
)
|
||||
|
||||
return LaunchDescription([laser_filter_node])
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||
<package format="3">
|
||||
<name>cyy_slamtoolbox</name>
|
||||
<version>0.0.0</version>
|
||||
<description>TODO: Package description</description>
|
||||
<maintainer email="root@todo.todo">root</maintainer>
|
||||
<license>TODO: License declaration</license>
|
||||
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
|
||||
<test_depend>ament_lint_auto</test_depend>
|
||||
<test_depend>ament_lint_common</test_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
@@ -1,23 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(gc_navigation2_real)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
# find dependencies
|
||||
find_package(ament_cmake REQUIRED)
|
||||
|
||||
install(
|
||||
DIRECTORY launch config params maps behavior_tree
|
||||
DESTINATION share/${PROJECT_NAME}
|
||||
)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
set(ament_cmake_copyright_FOUND TRUE)
|
||||
set(ament_cmake_cpplint_FOUND TRUE)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
endif()
|
||||
|
||||
ament_package()
|
||||
@@ -1,37 +0,0 @@
|
||||
<!--
|
||||
阿克曼底盘自定义行为树:移除了 Spin(原地旋转),
|
||||
恢复行为改为:清除代价地图 → 后退 → 等待
|
||||
实车版本 — 与仿真版相同逻辑
|
||||
-->
|
||||
<root main_tree_to_execute="MainTree">
|
||||
<BehaviorTree ID="MainTree">
|
||||
<RecoveryNode number_of_retries="6" name="NavigateRecovery">
|
||||
<PipelineSequence name="NavigateWithReplanning">
|
||||
<RateController hz="1.0">
|
||||
<RecoveryNode number_of_retries="1" name="ComputePathToPose">
|
||||
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</RecoveryNode>
|
||||
</RateController>
|
||||
<RecoveryNode number_of_retries="1" name="FollowPath">
|
||||
<FollowPath path="{path}" controller_id="FollowPath"/>
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
</RecoveryNode>
|
||||
</PipelineSequence>
|
||||
<ReactiveFallback name="RecoveryFallback">
|
||||
<GoalUpdated/>
|
||||
<RoundRobin name="RecoveryActions">
|
||||
<!-- 1. 清除代价地图,去掉短暂障碍 -->
|
||||
<Sequence name="ClearingActions">
|
||||
<ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
|
||||
<ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
|
||||
</Sequence>
|
||||
<!-- 2. 快速后退 0.8m,给重新规划留空间(阿克曼无法原地旋转) -->
|
||||
<BackUp backup_dist="0.80" backup_speed="0.18"/>
|
||||
<!-- 3. 短暂等待 0.3s,让新路径规划完成 -->
|
||||
<Wait wait_duration="0.3"/>
|
||||
</RoundRobin>
|
||||
</ReactiveFallback>
|
||||
</RecoveryNode>
|
||||
</BehaviorTree>
|
||||
</root>
|
||||
@@ -1,78 +0,0 @@
|
||||
slam_toolbox:
|
||||
ros__parameters:
|
||||
|
||||
# ============================ Solver 插件参数 ======================================
|
||||
solver_plugin: solver_plugins::CeresSolver
|
||||
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
|
||||
ceres_preconditioner: SCHUR_JACOBI
|
||||
ceres_trust_strategy: LEVENBERG_MARQUARDT
|
||||
ceres_dogleg_type: TRADITIONAL_DOGLEG
|
||||
ceres_loss_function: None
|
||||
|
||||
# ============================ ROS 基础参数(实车)===================================
|
||||
odom_frame: odom_combined # 实车:EKF 融合后的里程计坐标系
|
||||
map_frame: map # 地图坐标系
|
||||
base_frame: base_footprint # 机器人基座坐标系(与 URDF 根帧一致)
|
||||
scan_topic: /scan # 激光雷达话题(实车镭神雷达)
|
||||
use_map_saver: true # 启用地图保存功能
|
||||
mode: mapping # mapping = 定位 + 实时建图
|
||||
|
||||
# ============================ 已有地图加载 ==========================================
|
||||
# map_file_name: "" # 从零开始建图,留空
|
||||
map_start_pose: [0.0, 0.0, 0.0] # 初始位姿 [x, y, yaw]
|
||||
|
||||
# ============================ 调试与性能 ===========================================
|
||||
debug_logging: false
|
||||
throttle_scans: 1 # 每 N 帧处理一次(实车每秒10帧左右)
|
||||
transform_publish_period: 0.02 # TF 发布周期(秒)
|
||||
map_update_interval: 3.0 # /map 话题更新间隔(秒)
|
||||
resolution: 0.05 # 地图分辨率(米/像素)
|
||||
restamp_tf: false
|
||||
min_laser_range: 0.15 # 实车雷达盲区约 0.12m,设 0.15 过滤近处噪点
|
||||
max_laser_range: 12.0 # 实车雷达最大有效距离(镭神 N10 ≈ 10-15m)
|
||||
minimum_time_interval: 0.3 # 最小处理时间间隔(实车可适当放宽)
|
||||
transform_timeout: 0.2 # TF 查找超时
|
||||
tf_buffer_duration: 30.0 # TF 缓冲区时长
|
||||
stack_size_to_use: 40000000 # 栈大小(序列化大地图需要)
|
||||
enable_interactive_mode: true # 交互模式:允许外部工具编辑地图
|
||||
|
||||
# ============================ 通用建图参数 =========================================
|
||||
use_scan_matching: true
|
||||
use_scan_barycenter: true
|
||||
minimum_travel_distance: 0.3 # 实车最小移动距离(米),小于仿真以更频繁更新
|
||||
minimum_travel_heading: 0.3 # 最小转向角度(弧度)
|
||||
check_min_dist_and_heading_precisely: false
|
||||
scan_buffer_size: 10 # 扫描缓冲区大小
|
||||
scan_buffer_maximum_scan_distance: 10.0
|
||||
link_match_minimum_response_fine: 0.1
|
||||
link_scan_maximum_distance: 1.5
|
||||
|
||||
# ============================ 回环检测参数 =========================================
|
||||
do_loop_closing: true # 启用回环检测
|
||||
loop_match_minimum_chain_size: 10
|
||||
loop_match_maximum_variance_coarse: 3.0
|
||||
loop_match_minimum_response_coarse: 0.35
|
||||
loop_match_minimum_response_fine: 0.45
|
||||
loop_search_maximum_distance: 3.0
|
||||
|
||||
# ============================ 相关性匹配参数 =======================================
|
||||
correlation_search_space_dimension: 0.5
|
||||
correlation_search_space_resolution: 0.01
|
||||
correlation_search_space_smear_deviation: 0.1
|
||||
|
||||
loop_search_space_dimension: 8.0
|
||||
loop_search_space_resolution: 0.05
|
||||
loop_search_space_smear_deviation: 0.03
|
||||
|
||||
# ============================ 扫描匹配器参数 ========================================
|
||||
distance_variance_penalty: 0.5
|
||||
angle_variance_penalty: 1.0
|
||||
|
||||
fine_search_angle_offset: 0.00349
|
||||
coarse_search_angle_offset: 0.349
|
||||
coarse_angle_resolution: 0.0349
|
||||
minimum_angle_penalty: 0.9
|
||||
minimum_distance_penalty: 0.5
|
||||
use_response_expansion: true
|
||||
min_pass_through: 2
|
||||
occupancy_threshold: 0.1
|
||||
@@ -1,77 +0,0 @@
|
||||
slam_toolbox:
|
||||
ros__parameters:
|
||||
|
||||
# ============================ Solver 插件参数 ======================================
|
||||
solver_plugin: solver_plugins::CeresSolver
|
||||
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
|
||||
ceres_preconditioner: SCHUR_JACOBI
|
||||
ceres_trust_strategy: LEVENBERG_MARQUARDT
|
||||
ceres_dogleg_type: TRADITIONAL_DOGLEG
|
||||
ceres_loss_function: None
|
||||
|
||||
# ============================ ROS 基础参数(实车定位模式)============================
|
||||
odom_frame: odom_combined # 实车:EKF 融合后的里程计坐标系
|
||||
map_frame: map
|
||||
base_frame: base_footprint
|
||||
scan_topic: /scan
|
||||
mode: localization # 纯定位模式,不更新地图
|
||||
|
||||
# ============================ 已有地图加载 ==========================================
|
||||
# 由 launch 文件通过 map_file_name 参数传入 .posegraph 路径
|
||||
# map_file_name: ""
|
||||
map_start_pose: [0.0, 0.0, 0.0]
|
||||
|
||||
# ============================ 调试与性能 ===========================================
|
||||
debug_logging: false
|
||||
throttle_scans: 2 # 每2帧处理一次(实车激光较慢时使用)
|
||||
transform_publish_period: 0.02
|
||||
map_update_interval: 5.0
|
||||
resolution: 0.05
|
||||
restamp_tf: false
|
||||
min_laser_range: 0.15 # 过滤雷达盲区噪点
|
||||
max_laser_range: 12.0 # 实车雷达最大有效距离
|
||||
minimum_time_interval: 0.3
|
||||
transform_timeout: 0.2
|
||||
tf_buffer_duration: 30.0
|
||||
stack_size_to_use: 40000000
|
||||
|
||||
# ============================ 通用参数 =============================================
|
||||
use_scan_matching: true
|
||||
use_scan_barycenter: true
|
||||
minimum_travel_distance: 0.3
|
||||
minimum_travel_heading: 0.3
|
||||
check_min_dist_and_heading_precisely: false
|
||||
scan_buffer_size: 10
|
||||
scan_buffer_maximum_scan_distance: 10.0
|
||||
link_match_minimum_response_fine: 0.1
|
||||
link_scan_maximum_distance: 1.5
|
||||
|
||||
# 定位模式关闭回环检测
|
||||
do_loop_closing: false
|
||||
loop_match_minimum_chain_size: 10
|
||||
loop_match_maximum_variance_coarse: 3.0
|
||||
loop_match_minimum_response_coarse: 0.35
|
||||
loop_match_minimum_response_fine: 0.45
|
||||
loop_search_maximum_distance: 3.0
|
||||
|
||||
# ============================ 相关性匹配参数 =======================================
|
||||
correlation_search_space_dimension: 0.5
|
||||
correlation_search_space_resolution: 0.01
|
||||
correlation_search_space_smear_deviation: 0.1
|
||||
|
||||
loop_search_space_dimension: 8.0
|
||||
loop_search_space_resolution: 0.05
|
||||
loop_search_space_smear_deviation: 0.03
|
||||
|
||||
# ============================ 扫描匹配器参数 ========================================
|
||||
distance_variance_penalty: 0.5
|
||||
angle_variance_penalty: 1.0
|
||||
|
||||
fine_search_angle_offset: 0.00349
|
||||
coarse_search_angle_offset: 0.349
|
||||
coarse_angle_resolution: 0.0349
|
||||
minimum_angle_penalty: 0.9
|
||||
minimum_distance_penalty: 0.5
|
||||
use_response_expansion: true
|
||||
min_pass_through: 2
|
||||
occupancy_threshold: 0.1
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# ============================================================================
|
||||
# real_bringup.launch.py
|
||||
# 功能:实车基础 bringup — 底盘驱动 + 激光雷达 + TF 树
|
||||
#
|
||||
# 适用场景:
|
||||
# - 单独调试底盘通信和传感器数据
|
||||
# - 遥控测试(无导航)
|
||||
# - 作为其他 launch 文件的基础模块
|
||||
#
|
||||
# 启动内容:
|
||||
# origincar_base bringup — 串口驱动 + EKF + IMU 滤波 + TF + robot_state_publisher
|
||||
# lslidar_driver — 镭神激光雷达 → /scan
|
||||
#
|
||||
# 使用方式:
|
||||
# ros2 launch gc_navigation2_real real_bringup.launch.py
|
||||
# ============================================================================
|
||||
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
"""生成 LaunchDescription,启动实车底盘 + 雷达 + TF(无导航)"""
|
||||
|
||||
# ============================ 1. 包路径 =========================================
|
||||
origincar_base_dir = get_package_share_directory('origincar_base')
|
||||
|
||||
# ============================ 2. 实车底盘 bringup ===============================
|
||||
# 注:origincar_bringup 已包含 robot_state_publisher + joint_state_publisher + 静态 TF
|
||||
origincar_bringup = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
[origincar_base_dir, '/launch', '/origincar_bringup.launch.py']),
|
||||
)
|
||||
|
||||
# ============================ 3. 镭神激光雷达驱动 ===============================
|
||||
lslidar_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
[get_package_share_directory('lslidar_driver'),
|
||||
'/launch', '/lsn10_launch.py']),
|
||||
)
|
||||
|
||||
# ============================ 4. 组装 LaunchDescription =========================
|
||||
return LaunchDescription([
|
||||
DeclareLaunchArgument(
|
||||
'use_sim_time',
|
||||
default_value='false',
|
||||
description='使用仿真时间(实车必须为 false)'),
|
||||
|
||||
origincar_bringup,
|
||||
lslidar_launch,
|
||||
])
|
||||
@@ -1,110 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# ============================================================================
|
||||
# real_nav2_slam.launch.py
|
||||
# 功能:实车导航 — 已知静态地图 + SLAM 定位 + Nav2 导航
|
||||
#
|
||||
# 架构:
|
||||
# origincar_base (bringup) — 底盘串口驱动 + EKF 里程计 + IMU 滤波 + TF
|
||||
# lslidar_driver — 镭神激光雷达驱动 → /scan
|
||||
# map_server — 加载 yaml+pgm 全量静态地图 → /map
|
||||
# slam_toolbox (localization) — 加载 .posegraph,激光扫描匹配定位
|
||||
# 发布 map→odom_combined TF(替代 AMCL)
|
||||
# ⚠️ /map 话题重映射为 /slam_map,避免冲突
|
||||
# navigation_launch — Nav2 导航栈
|
||||
# global_costmap 从 /map 获取全量静态地图
|
||||
#
|
||||
# 使用方式:
|
||||
# ros2 launch gc_navigation2_real real_nav2_slam.launch.py
|
||||
# ============================================================================
|
||||
|
||||
import os
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
"""生成 LaunchDescription,启动实车底盘 + 雷达 + SLAM定位 + Nav2 导航"""
|
||||
ld = LaunchDescription()
|
||||
|
||||
# =============================1. 包路径===========================================
|
||||
pkg_dir = get_package_share_directory('gc_navigation2_real')
|
||||
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
|
||||
origincar_base_dir = get_package_share_directory('origincar_base')
|
||||
|
||||
# =============================2. 参数=============================================
|
||||
use_sim_time = LaunchConfiguration('use_sim_time', default='false')
|
||||
map_yaml_path = LaunchConfiguration('map', default=os.path.join(
|
||||
pkg_dir, 'maps', 'my_map.yaml'))
|
||||
nav2_param_path = LaunchConfiguration('params_file', default=os.path.join(
|
||||
pkg_dir, 'params', 'gc_navigation_slam_real.yaml'))
|
||||
slam_params_file = os.path.join(
|
||||
pkg_dir, 'config', 'slam_toolbox_localization_real.yaml')
|
||||
posegraph_path = os.path.join(
|
||||
pkg_dir, 'maps', 'my_map.posegraph')
|
||||
|
||||
# =============================3. 实车底盘 bringup ================================
|
||||
origincar_bringup = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
[origincar_base_dir, '/launch', '/origincar_bringup.launch.py']),
|
||||
)
|
||||
|
||||
# =============================4. 镭神激光雷达驱动 ================================
|
||||
lslidar_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
[get_package_share_directory('lslidar_driver'),
|
||||
'/launch', '/lsn10_launch.py']),
|
||||
)
|
||||
|
||||
# =============================5. map_server:全量静态地图 ==========================
|
||||
map_server_node = Node(
|
||||
package='nav2_map_server',
|
||||
executable='map_server',
|
||||
name='map_server',
|
||||
output='screen',
|
||||
parameters=[{'yaml_filename': map_yaml_path, 'use_sim_time': False}],
|
||||
)
|
||||
map_server_lifecycle = Node(
|
||||
package='nav2_lifecycle_manager',
|
||||
executable='lifecycle_manager',
|
||||
name='lifecycle_manager_map',
|
||||
output='screen',
|
||||
parameters=[{'use_sim_time': False, 'autostart': True,
|
||||
'node_names': ['map_server']}],
|
||||
)
|
||||
|
||||
# =============================6. slam_toolbox 定位模式(替代 AMCL)==================
|
||||
# ⚠️ /map 重映射到 /slam_map,避免覆盖 map_server 的全量地图
|
||||
slam_toolbox_node = Node(
|
||||
package='slam_toolbox',
|
||||
executable='localization_slam_toolbox_node',
|
||||
name='slam_toolbox',
|
||||
output='screen',
|
||||
parameters=[slam_params_file,
|
||||
{'use_sim_time': False,
|
||||
'map_file_name': posegraph_path}],
|
||||
remappings=[('/map', '/slam_map')],
|
||||
)
|
||||
|
||||
# =============================7. Nav2 导航栈 =====================================
|
||||
navigation_launch = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
[nav2_bringup_dir, '/launch', '/navigation_launch.py']),
|
||||
launch_arguments={
|
||||
'use_sim_time': use_sim_time,
|
||||
'params_file': nav2_param_path,
|
||||
}.items(),
|
||||
)
|
||||
|
||||
# =============================8. 组装=============================================
|
||||
ld.add_action(origincar_bringup)
|
||||
ld.add_action(lslidar_launch)
|
||||
ld.add_action(map_server_node)
|
||||
ld.add_action(map_server_lifecycle)
|
||||
ld.add_action(slam_toolbox_node)
|
||||
ld.add_action(navigation_launch)
|
||||
|
||||
return ld
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user