RVIZ中的fixed frame选项以及“For frame [XX]: Fixed Frame [map] does not exist”

RVIZ 使用的时候如果fixed frame选项设置不正确,那么就会无法显示显示相应的数据信息,并提示一下错误:“For frame [XX]: Fixed Frame [map] does not exist”
官方文档对该选项的解释为:

The Fixed Frame/固定参考系
The more-important of the two frames is the fixed frame. The fixed frame is the reference frame used to denote the “world” frame. This is usually the “map”, or “world”, or something similar, but can also be, for example, your odometry frame.
If the fixed frame is erroneously set to, say, the base of the robot, then all the objects the robot has ever seen will appear in front of the robot, at the position relative to the robot at which they were detected. For correct results, the fixed frame should not be moving relative to the world.
If you change the fixed frame, all data currently being shown is cleared rather than re-transformed.
The Target Frame
The target frame is the reference frame for the camera view. For example, if your target frame is the map, you’ll see the robot driving around the map. If your target frame is the base of the robot, the robot will stay in the same place while everything else moves relative to it.
http://wiki.ros.org/rviz/UserGuide#Coordinate_Frames

RVIZ中的fixed frame选项以及“For frame [XX]: Fixed Frame [map] does not exist”_第1张图片如果显示不了topic报frame 、transform之类错误,就有两个办法,
1.把global fixed frame设成topic自己所在的坐标系,按照上图的显示,应该改为tramcar;
2.用tf包工具发布global fixed frame到topic所在坐标系的tf关系,例如:

 rosrun tf static_transform_publisher 0.0 0.0 0.0 0.0 0.0 0.0 map xxx 100 ;//将xxx映射为map

那么还有一个疑问: topic自己所在的坐标系名字(上图中为tramcar)是在那里设定的?
我们知道topic这一项(即话题的名字,上图中对应的是/cloud)是在程序里面指定的,同理消息的参考坐标系信息记录在消息的frame_id中,该值可以在程序中直接通过给消息头的frame_id字段赋值的方式指定也可以在.cfg配置文件中事先指定。查看一个消息的 fix frame:

   rostopic echo /cloud | grep frame_id

RVIZ中的fixed frame选项以及“For frame [XX]: Fixed Frame [map] does not exist”_第2张图片
The frame_id in a message specifies the point of reference for data contained in that message.
消息的头 std_msgs/Header header中通常会有该信息 。标准头信息主要包括:seq是消息的顺序标识,不需要手动设置,发布节点在发布消息时,会自动累加。stamp 是消息中与数据相关联的时间戳,例如激光数据中,时间戳对应激光数据的采集时间点。frame_id 是消息中与数据相关联的参考系id,例如在在激光数据中,frame_id对应激光数据采集的参考系。

例如LaserScan消息结构:

    std_msgs/Header header    #   标准头信息
    uint32 seq
    time stamp           
    string frame_id        # in frame frame_id, angles are measured around  the positive Z axis (counterclockwise, if Z is up) with zero angle being forward along the x axis                              
    float32 angle_min        # start angle of the scan [rad]
    float32 angle_max        # end angle of the scan [rad]
    float32 angle_increment  # angular distance between measurements [rad]
    float32 time_increment   # time between measurements [seconds] - if your scanner
                             # is moving, this will be used in interpolating position of 3d points
    float32 scan_time        # time between scans [seconds
    float32 range_min        # minimum range value [m]
    float32 range_max        # maximum range value [m]
    float32[] ranges         # range data [m] (Note: values < range_min or > range_max should be discarded)
    float32[] intensities    # intensity data [device-specific units].  If your device does not provide intensities, please leave the array empty.

修改完正确的Fixed Frame:
RVIZ中的fixed frame选项以及“For frame [XX]: Fixed Frame [map] does not exist”_第3张图片

你可能感兴趣的:(Linux)