cartographer和ROS的坐标系关系

Posted long5683

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cartographer和ROS的坐标系关系相关的知识,希望对你有一定的参考价值。

 参考定义见:backpack_3d.lua
    Local map frame是一次slam过程中的原点。但是现在cartographer支持Incremental mapping。global map是整个地图的原点,local map是每一次建图的原点。
    map_frame = “map”:cartographer中使用的全局坐标系,最好保持默认,否则ROS的Rviz不认识其它的定义,导致无法可视化建图过程。
    tracking_frame=”base_link”:机器人中心坐标系,其它传感器数据都是以这个为基础进行插入的,它是整个SLAM系统的核心坐标系;cartographer_ros里面有个tf_bridge的类就是专门用来查询其它坐标系到此坐标系的转换关系。
    published_frame = “base_link”
    odom_frame = “odom” :published_frame与odom_frame配合使用,如果参数provide_odom_frame = true 那么最后可视化时,发布的转换消息是从 published_frame->odom_frame->map_frame, 也即cartographer内部计算出了未经回环检测的局部图坐标到优化后的全局图坐标之间的转换关系并发布了出来。在跑官网的二维背包例子时,在map坐标周围一直跳动的odom就是这个玩意。

技术图片

1.3 ROS坐标系规范

    ROS坐标系规范:REP (定义了坐标系命名规范及各自的含义)

    base_link (机器人底盘坐标系)
        The coordinate frame called base_link is rigidly attached to the mobile robot base. The base_link can be attached to the base in any arbitrary position or orientation; for every hardware platform there will be a different place on the base that provides an obvious point of reference.

    base_laser
        激光雷达的坐标系,与激光雷达的安装点有关,其与base_link的tf为固定的。

    odom (用于短期局部参考)
        The coordinate frame called odom is a world-fixed frame. The pose of a mobile platform in the odom frame can drift over time, without any bounds. This drift makes the odom frame useless as a long-term global reference. However, the pose of a robot in the odom frame is guaranteed to be continuous, meaning that the pose of a mobile platform in the odom frame always evolves in a smooth way, without discrete jumps.
        In a typical setup the odom frame is computed based on an odometry source, such as wheel odometry, visual odometry or an inertial measurement unit.
        The odom frame is useful as an accurate, short-term local reference, but drift makes it a poor frame for long-term reference.

    map (用于长期全局参考)
        The coordinate frame called map is a world-fixed frame, with its Z-axis pointing upwards. The pose of a mobile platform, relative to the map frame, should not significantly drift over time. The map frame is not continuous, meaning the pose of a mobile platform in the map frame can change in discrete jumps at any time.
        In a typical setup, a localization component constantly re-computes the robot pose in the map frame based on sensor observations, therefore eliminating drift, but causing discrete jumps when new sensor information arrives.
        The map frame is useful as a long-term global reference, but discrete jumps in position estimators make it a poor reference frame for local sensing and acting.

    earth (用于多个机器人的场景)
        The coordinate frame called earth is the origin of ECEF.
        This frame is designed to allow the interaction of multiple robots in different map frames. If the application only needs one map the earth coordinate frame is not expected to be present. In the case of running with multiple maps simultaneously the map and odom and base_link frames will need to be customized for each robot. If running multiple robots and bridging data between them, the transform frame_ids can remain standard on each robot if the other robots’ frame_ids are rewritten.
        If the map frame is globally referenced the publisher from earth to map can be a static transform publisher. Otherwise the earth to map transform will usually need to be computed by taking the estimate of the current global position and subtracting the current estimated pose in the map to get the estimated pose of the origin of the map.
        In case the map frame’s absolute positon is unknown at the time of startup, it can remain detached until such time that the global position estimation can be adaquately evaluated. This will operate in the same way that a robot can operate in the odom frame before localization in the map frame is initialized.

    坐标系间的关系
        每个坐标系只有一个父坐标系,可以有多个子坐标系
        坐标系间的树形结构如下所示:
        earth --> map --> odom --> base_link
        对于只有一个机器人的环境,在起始位置,map与odom坐标系是重合的。随着时间的推移是不重合的,而出现的偏差就是里程计的累积误差。那map–>odom的tf怎么得到?就是在一些校正传感器合作校正的package比如gmapping会给出一个位置估计(localization),这可以得到map–>base_link的tf,所以估计位置和里程计位置的偏差也就是odom与map的坐标系偏差。所以,如果你的odom计算没有错误,那么map–>odom的tf就是0.

    Axis Orientation (坐标轴方向)
        In relation to a body the standard is:
            x forward
            y left
            z up
           技术图片

以上是关于cartographer和ROS的坐标系关系的主要内容,如果未能解决你的问题,请参考以下文章

cartographer 调参-lua文件配置参考文档

cartographer给ros开放的接口

cartographer 调参-ROS API 文档

Rplidar学习—— rplidar使用cartographer_ros进行地图云生成

萌新向cartographer_ros最新安装指南 2019-12

代码修改记录-cartographer_ros Run函数