在ROS noetic上安装cartographer

  • Post author:
  • Post category:其他




在ROS noetic上安装cartographer

记录一下在ROS noetic上安装cartographer的过程。


官方ros文档

,官方文档很详细,建议看着官方文档配置。



安装

  1. 首先需要安装好ros noetic:

    ros-noetic-desktop-full
sudo apt-get update
sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow
  1. 新建一个catkin_ws,catkin_google_ws可以改成别的你想要的名字。如果raw.githubusercontent.com上不去的话,懂得都懂,或者可以修改

    /etc/hosts

    中的主机IP映射。
mkdir catkin_google_ws
cd catkin_google_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
  1. 下面的rosdep init可能会报错,如果无法执行的话可以,这一步出错的话进行第4步,否则直接跳到第5步。
sudo rosdep init
rosdep update
  1. 使用国内的rosdepc工具
sudo pip install rosdepc
sudo rosdepc init
rosdepc update

致谢:https://mp.weixin.qq.com/s/VGs8oWdhHH6XsHcx21lN4Q

  1. 安装abseil-cpp依赖,如果和ros的abseil产生冲突的话,执行第6步,否则跳到7
src/cartographer/scripts/install_abseil.sh
  1. 卸载ros的abseil
sudo apt-get remove ros-${ROS_DISTRO}-abseil-cpp
  1. build and install
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash #如果用zsh的话,把.bash替换成.zsh



测试

文件很大,测一个看看效果得了。如果demo能够运行起来,那么恭喜你已经完成了cartographer的安装。

下载并测试2d demo

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag

下载并测试3d demo

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag


更多测试



在自己的环境中运行

cartographer的配置不像其他slam算法是通过launch文件来设置的,而是通过lua脚本来配置的。示例配置脚本的路径如下:

catkin_google_ws/src/cartographer_ros/cartographer_ros/configuration_files
backpack_2d.lua #如果想使用2d
backpack_3d.lua #如果想使用3d

把示例文件拷贝到你的工作区命名为

my_robot.lua

,之后编辑

my_robot.lua

文件来满足你自己的机器人的需要。


官方配置文档

参数的含义,机翻的:


  • map_frame

    • The ROS frame ID to use for publishing submaps, the parent frame of poses, usually “map”.
    • 用于发布子图的 ROS 框架 ID,姿势的父框架,通常是“地图”。

  • tracking_frame

    • The ROS frame ID of the frame that is tracked by the SLAM algorithm. If an IMU is used, it should be at its position, although it might be rotated. A common choice is “imu_link”.
    • SLAM算法跟踪的帧的ROS帧ID。如果使用 IMU,它应该在它的位置,尽管它可能会被旋转。一个常见的选择是“imu_link”。

  • published_frame

    • The ROS frame ID to use as the child frame for publishing poses. For example “odom” if an “odom” frame is supplied by a different part of the system. In this case the pose of “odom” in the

      map_frame

      will be published. Otherwise, setting it to “base_link” is likely appropriate.
    • 用作发布姿势的子框架的 ROS 框架 ID。例如,如果“odom”框架由系统的不同部分提供,则为“odom”。在这种情况下,将发布 map_frame 中“odom”的位姿。否则,将其设置为“base_link”可能是合适的。

  • odom_frameodom_frame

    • Only used if

      provide_odom_frame

      is true. The frame between

      published_frame

      and

      map_frame

      to be used for publishing the (non-loop-closed) local SLAM result. Usually “odom”.
    • 仅在 provide_odom_frame 为真时使用。 published_frame 和 map_frame 之间的帧,用于发布(非闭环)本地 SLAM 结果。通常是“odom”。

  • provide_odom_frame

    • If enabled, the local, non-loop-closed, continuous pose will be published as the

      odom_frame

      in the

      map_frame

      .
    • 如果启用,本地的、非闭环的、连续的姿势将作为 odom_frame 发布在 map_frame 中。

  • publish_frame_projected_to_2d

    • If enabled, the published pose will be restricted to a pure 2D pose (no roll, pitch, or z-offset). This prevents potentially unwanted out-of-plane poses in 2D mode that can occur due to the pose extrapolation step (e.g. if the pose shall be published as a ‘base-footprint’-like frame)
    • 如果启用,发布的姿势将被限制为纯 2D 姿势(无滚动、俯仰或 z 偏移)。这可以防止在 2D 模式下由于姿势外推步骤而可能发生的潜在不想要的平面外姿势(例如,如果姿势应发布为类似“base-footprint”的帧)

  • use_odometry

    • If enabled, subscribes to

      nav_msgs/Odometry

      on the topic “odom”. Odometry must be provided in this case, and the information will be included in SLAM.
    • 如果启用,则订阅主题“odom”的 nav_msgs/Odometry。在这种情况下必须提供里程计,并且该信息将包含在 SLAM 中。

  • use_nav_sat

    • If enabled, subscribes to

      sensor_msgs/NavSatFix

      on the topic “fix”. Navigation data must be provided in this case, and the information will be included in the global SLAM.
    • 如果启用,订阅 sensor_msgs/NavSatFix 主题“fix”。在这种情况下必须提供导航数据,并且该信息将包含在全局 SLAM 中。

  • use_landmarks

    • If enabled, subscribes to

      cartographer_ros_msgs/LandmarkList

      on the topic “landmarks”. Landmarks must be provided, as

      cartographer_ros_msgs/LandmarkEntry

      within

      cartographer_ros_msgs/LandmarkList

      . If

      cartographer_ros_msgs/LandmarkEntry

      data is provided the information will be included in the SLAM accoding to the ID of the

      cartographer_ros_msgs/LandmarkEntry

      . The

      cartographer_ros_msgs/LandmarkList

      should be provided at a sample rate comparable to the other sensors. The list can be empty but has to be provided because Cartographer strictly time orders sensor data in order to make the landmarks deterministic. However it is possible to set the trajectory builder option “collate_landmarks” to false and allow for a non-deterministic but also non-blocking approach.如果启用,订阅主题“landmarks”的cartographer_ros_msgs/LandmarkList。
    • 必须提供地标,作为 cartographer_ros_msgs/LandmarkList 中的 cartographer_ros_msgs/LandmarkEntry。如果提供了 cartographer_ros_msgs/LandmarkEntry 数据,则该信息将包含在 SLAM 中,对应于 cartographer_ros_msgs/LandmarkEntry 的 ID。 cartographer_ros_msgs/LandmarkList 应以与其他传感器相当的采样率提供。该列表可以为空,但必须提供,因为 Cartographer 严格按时间排序传感器数据,以使地标具有确定性。然而,可以将轨迹构建器选项“collate_landmarks”设置为 false,并允许使用非确定性但也非阻塞的方法。

  • num_laser_scans

    • Number of laser scan topics to subscribe to. Subscribes to

      sensor_msgs/LaserScan

      on the “scan” topic for one laser scanner, or topics “scan_1”, “scan_2”, etc. for multiple laser scanners.
    • 要订阅的激光扫描主题数。订阅 sensor_msgs/LaserScan 的“scan”主题以获取一台激光扫描仪,或订阅“scan_1”、“scan_2”等主题以获取多台激光扫描仪。

  • num_multi_echo_laser_scans

    • Number of multi-echo laser scan topics to subscribe to. Subscribes to

      sensor_msgs/MultiEchoLaserScan

      on the “echoes” topic for one laser scanner, or topics “echoes_1”, “echoes_2”, etc. for multiple laser scanners.
    • 要订阅的多回波激光扫描主题数。订阅 sensor_msgs/MultiEchoLaserScan 关于“echoes”主题的一个激光扫描仪,或主题“echoes_1”、“echoes_2”等,用于多个激光扫描仪。

  • num_subdivisions_per_laser_scan

    • Number of point clouds to split each received (multi-echo) laser scan into. Subdividing a scan makes it possible to unwarp scans acquired while the scanners are moving. There is a corresponding trajectory builder option to accumulate the subdivided scans into a point cloud that will be used for scan matching.
    • 将每个接收到的(多回波)激光扫描分割成的点云数量。细分扫描可以解开扫描仪移动时获取的扫描。有一个相应的轨迹构建器选项可将细分扫描累积到将用于扫描匹配的点云中。

  • num_point_clouds

    • Number of point cloud topics to subscribe to. Subscribes to

      sensor_msgs/PointCloud2

      on the “points2” topic for one rangefinder, or topics “points2_1”, “points2_2”, etc. for multiple rangefinders.
    • 要订阅的点云主题数。订阅一个测距仪的“points2”主题的sensor_msgs/PointCloud2,或多个测距仪的“points2_1”、“points2_2”等主题。

  • lookup_transform_timeout_sec

    • Timeout in seconds to use for looking up transforms using

      tf2

      .
    • 用于使用 tf2 查找转换的超时(以秒为单位)。

  • submap_publish_period_sec

    • Interval in seconds at which to publish the submap poses, e.g. 0.3 seconds.
    • 发布子图姿势的时间间隔(以秒为单位),例如0.3 秒。

  • pose_publish_period_sec

    • Interval in seconds at which to publish poses, e.g. 5e-3 for a frequency of 200 Hz.
    • 发布姿势的时间间隔(以秒为单位),例如对于 200 Hz 的频率,请参见 5e-3。

  • publish_to_tf

    • Enable or disable providing of TF transforms.
    • 启用或禁用提供 TF 转换。

  • publish_tracked_pose

    • Enable publishing of tracked pose as a

      geometry_msgs/PoseStamped

      to topic “tracked_pose”.
    • 启用将跟踪姿势作为geometry_msgs/PoseStamped 发布到主题“tracked_pose”。

  • trajectory_publish_period_sec

    • Interval in seconds at which to publish the trajectory markers, e.g. 30e-3 for 30 milliseconds.
    • 发布轨迹标记的时间间隔(以秒为单位),例如30e-3 持续 30 毫秒。

  • rangefinder_sampling_ratio

    • Fixed ratio sampling for range finders messages.
    • 范围查找器消息的固定比率采样。

  • odometry_sampling_ratio

    • Fixed ratio sampling for odometry messages.
    • 里程计消息的固定比率采样。

  • fixed_frame_sampling_ratio

    • Fixed ratio sampling for fixed frame messages.
    • 固定帧消息的固定比率采样。

  • imu_sampling_ratio

    • Fixed ratio sampling for IMU messages.
    • IMU 消息的固定比率采样。

  • landmarks_sampling_ratio

    • Fixed ratio sampling for landmarks messages.
    • 地标消息的固定比率采样。



版权声明:本文为TATPofACT原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。