# dx_sentry **Repository Path**: dx_vision/dx_sentry ## Basic Information - **Project Name**: dx_sentry - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2026-04-18 - **Last Updated**: 2026-09-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sentry_nav 2025赛季哨兵导航仿真/实车功能包 ## 1. Overview 本项目基于 [NAV2 导航框架](https://github.com/ros-navigation/navigation2) 并参考学习了 [autonomous_exploration_development_environment](https://github.com/HongbiaoZ/autonomous_exploration_development_environment/tree/humble) 的设计。 - 关于坐标变换: 本项目大幅优化了坐标变换逻辑,考虑雷达原点 `lidar_odom` 与 底盘原点 `odom` 之间的隐式变换。 mid360 倾斜侧放在底盘上,使用 [point_lio](https://github.com/your-org/point_lio/tree/RM2025_auto_sentry) 里程计,[small_gicp](https://github.com/your-org/small_gicp_relocalization) 重定位,[loam_interface](./loam_interface/) 会将 point_lio 输出的 `/cloud_registered` 从 `lidar_odom` 系转换到 `odom` 系,[sensor_scan_generation](./sensor_scan_generation/) 将 `odom` 系的点云转换到 `front_mid360` 系,并发布变换 `odom -> chassis`。 - 关于路径规划: 使用 NAV2 默认的 Global Planner 作为全局路径规划器,pb_omni_pid_pursuit_controller 作为路径跟踪器。 - namespace: 为了后续拓展多机器人,本项目引入 namespace 的设计,与 ROS 相关的 node, topic, action 等都加入了 namespace 前缀。如需查看 tf tree,请使用命令 `ros2 run rqt_tf_tree rqt_tf_tree --ros-args -r /tf:=tf -r /tf_static:=tf_static -r __ns:=/red_standard_robot1` - LiDAR: Livox mid360 倒置安装在龙门架上。 注:仿真环境中,实际上 point pattern 为 velodyne 样式的机械式扫描。此外,由于仿真器中输出的 PointCloud 缺少部分 field,导致 point_lio 无法正常估计状态,故仿真器输出的点云经过 [ign_sim_pointcloud_tool](./ign_sim_pointcloud_tool/) 处理添加 `time` field。 - 文件结构 ```plaintext . ├── fake_vel_transform # 虚拟速度参考坐标系,以应对云台扫描模式自旋 ├── ign_sim_pointcloud_tool # 仿真器点云处理工具 ├── livox_ros_driver2 # Livox 驱动 ├── loam_interface # point_lio 等里程计算法接口 ├── pb_teleop_twist_joy # 手柄控制 ├── pb2025_nav_bringup # 启动文件 ├── pb2025_sentry_nav # 功能包描述 ├── pb_omni_pid_pursuit_controller # 路径跟踪控制器 ├── point_lio # 里程计 ├── pointcloud_to_laserscan # 将 terrain_map 转换为 laserScan 表示障碍物(仅 SLAM 模式) ├── sensor_scan_generation # 点云坐标变换 ├── small_gicp_relocalization # 重定位 ├── terrain_analysis # 车体 4m 内地形分析,障碍物高度写入 intensity └── terrain_analysis_ext # 车体 4m 外地形分析,障碍物高度写入 intensity ``` ## 2. Quick Start ### 2.1 Option 1: Docker #### 2.1.1 Setup Environment - [Docker](https://docs.docker.com/engine/install/) - 允许 Docker Container 访问宿主机 X11 显示 ```bash xhost +local:docker ``` #### 2.1.2 Create Container ```bash docker run -it --rm --name sentry_nav \ --network host \ -e "DISPLAY=$DISPLAY" \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -v /dev:/dev \ ghcr.io/your-org/sentry_nav:1.3.1 ``` ### 2.2 Option 2: Build From Source #### 2.2.1 Setup Environment - Ubuntu 22.04 - ROS: [Humble](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debs.html) - 配套仿真包:[rmu_gazebo_simulator](https://github.com/your-org/rmu_gazebo_simulator) - Install [small_icp](https://github.com/koide3/small_gicp): ```bash sudo apt install -y libeigen3-dev libomp-dev git clone https://github.com/koide3/small_gicp.git cd small_gicp mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release && make -j sudo make install ``` #### 2.2.2 Create Workspace ```bash mkdir -p ~/ros_ws cd ~/ros_ws ``` ```bash git clone --recursive https://github.com/your-org/sentry_nav.git src/sentry_nav ``` 下载先验点云: 先验点云用于 point_lio 和 small_gicp,文件较大请自行下载。 > 当前 point_lio with prior_pcd 在大场景易漂移,待优化 #### 2.2.3 Build ```bash rosdep install -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y ``` ```bash colcon build --parallel-workers 4 ``` > [!NOTE] > 推荐使用 `--symlink-install`,修改配置文件无需重新编译。 ### 2.3 Running 启动后在 RViz 中使用 `Nav2 Goal` 发布目标点。 #### 2.3.1 仿真 单机器人导航: ```bash ros2 launch pb2025_nav_bringup rm_navigation_simulation_launch.py \ world:=rmul_2026 \ slam:=False ``` 单机器人建图: ```bash ros2 launch pb2025_nav_bringup rm_navigation_simulation_launch.py \ slam:=True ``` 保存栅格地图: ```bash ros2 run nav2_map_server map_saver_cli -f --ros-args -r __ns:=/red_standard_robot1 ``` 多机器人(实验性): ```bash ros2 launch pb2025_nav_bringup rm_multi_navigation_simulation_launch.py \ world:=rmul_2024 \ robots:=" \ red_standard_robot1={x: 0.0, y: 0.0, yaw: 0.0}; \ blue_standard_robot1={x: 5.6, y: 1.4, yaw: 3.14}; \ " ``` #### 2.3.2 实车 建图模式: ```bash ros2 launch pb2025_nav_bringup rm_navigation_reality_launch.py \ slam:=True \ use_robot_state_pub:=True ``` 保存栅格地图: ```bash ros2 run nav2_map_server map_saver_cli -f --ros-args -r __ns:=/red_standard_robot1 ``` 导航模式: ```bash ros2 launch standard_robot_pp_ros2 standard_robot_pp_ros2.launch.py ros2 launch pb2025_nav_bringup rm_navigation_reality_launch.py \ world:=rmul_2026 \ slam:=False \ use_robot_state_pub:=True ros2 launch pb2025_vision_bringup rm_vision_reality_launch.py ros2 launch pb2025_sentry_behavior pb2025_sentry_behavior_launch.py ros2 action send_goal /pb2025_sentry_behavior_server/execute_tree btcpp_ros2_interfaces/action/ExecuteTree "{tree_id: 'rmul_2025', payload: ''}" ``` ### 2.4 Launch Arguments | 符号 | 含义 | | ---- | ---------- | | 🤖 | 实车可用 | | 🖥️ | 仿真可用 | | 可用 | 参数 | 描述 | 类型 | 默认 | |-----|-----|-----|-----|-----| | 🤖 🖥️ | namespace | 机器人命名空间 | string | red_standard_robot1 | | 🤖 🖥️ | use_sim_time | 使用仿真时间 | bool | 仿真True,实车False | | 🤖 🖥️ | slam | 建图模式 | bool | False | | 🤖 🖥️ | world | 地图/赛场名称 | string | rmuc_2025 | | 🤖 🖥️ | map | 地图文件路径 | string | 自动匹配world | | 🤖 🖥️ | prior_pcd_file | 先验点云路径 | string | 自动匹配world | | 🤖 🖥️ | params_file | 导航参数文件 | string | 仿真/实车各自默认 | | 🤖 🖥️ | rviz_config_file | RViz配置 | string | 默认配置 | | 🤖 🖥️ | autostart | 自动启动nav2 | bool | True | | 🤖 🖥️ | use_composition | 组件式启动 | bool | True | | 🤖 🖥️ | use_respawn | 节点崩溃自动重启 | bool | False | | 🤖 🖥️ | use_rviz | 启动RViz | bool | True | | 🤖 | use_robot_state_pub | 发布机器人TF | bool | False | > 更多部署细节参见项目 Wiki ### 2.5 手柄控制 默认启用 PS4 手柄控制,键位见 `nav2_params.yaml` 中 `teleop_twist_joy_node` 配置。 --- ### 常用命令 ```bash source install/setup.bash ``` 建图启动: ```bash ros2 launch pb2025_nav_bringup rm_navigation_reality_launch.py \ slam:=True \ use_robot_state_pub:=True ``` 保存地图: ```bash ros2 run nav2_map_server map_saver_cli -f cd1 --ros-args -r map:=/map ``` 查看目标点话题: ```bash ros2 topic echo /goal_pose ``` 单独编译: ```bash colcon build --packages-select pb2025_nav_bringup colcon build --packages-select pb2025_sentry_behavior ```