里程计话题读取


源代码加注释

    <!-- 此文件为ego-planner基本启动文件-->
<launch>
  <!-- size of map, change the size inflate x, y, z according to your application -->
    <!-- 定义仅在launch文件中起作用的局部变量大小,即地图大小-->
  <arg name="map_size_x" value="40.0"/>
  <arg name="map_size_y" value="40.0"/>
  <arg name="map_size_z" value=" 3.0"/>

  <!-- topic of your odometry such as VIO or LIO -->
  <!-- 这里的odom_topic的value是由odom_world重映射得到,再将其value发布到/visual_slam/odom供给终端读取相应数值-->
  <arg name="odom_topic" value="/visual_slam/odom" />

  <!-- main algorithm params -->
  <!--嵌套复用advanced_param.xml,从而引入主要优化参数 -->
  <include file="$(find ego_planner)/launch/advanced_param.xml">

    <arg name="map_size_x_" value="$(arg map_size_x)"/>
    <arg name="map_size_y_" value="$(arg map_size_y)"/>
    <arg name="map_size_z_" value="$(arg map_size_z)"/>
    <arg name="odometry_topic" value="$(arg odom_topic)"/>

  
    <!-- camera pose: transform of camera frame in the world frame -->
    <!-- depth topic: depth image, 640x480 by default -->
    <!-- don't set cloud_topic if you already set these ones! -->
    <arg name="camera_pose_topic" value="/pcl_render_node/camera_pose"/>
    <arg name="depth_topic" value="/pcl_render_node/depth"/>

    <!-- topic of point cloud measurement, such as from LIDAR  -->
    <!-- don't set camera pose and depth, if you already set this one! -->
    <arg name="cloud_topic" value="/pcl_render_node/cloud"/>

    <!-- intrinsic params of the depth camera -->
    <arg name="cx" value="321.04638671875"/>
    <arg name="cy" value="243.44969177246094"/>
    <arg name="fx" value="387.229248046875"/>
    <arg name="fy" value="387.229248046875"/>

    <!-- maximum velocity and acceleration the drone will reach -->
    <arg name="max_vel" value="2.0" />
    <arg name="max_acc" value="3.0" />

    <!--always set to 1.5 times grater than sensing horizen-->
    <arg name="planning_horizon" value="7.5" /> 

    <!-- 1: use 2D Nav Goal to select goal  -->
    <!-- 2: use global waypoints below  -->
    <arg name="flight_type" value="2" />
    
    <!-- global waypoints -->
    <!-- It generates a piecewise min-snap traj passing all waypoints -->
    <arg name="point_num" value="5" />

    <arg name="point0_x" value="-15.0" />
    <arg name="point0_y" value="0.0" />
    <arg name="point0_z" value="1.0" />

    <arg name="point1_x" value="0.0" />
    <arg name="point1_y" value="15.0" />
    <arg name="point1_z" value="1.0" />

    <arg name="point2_x" value="15.0" />
    <arg name="point2_y" value="0.0" />
    <arg name="point2_z" value="1.0" />

    <arg name="point3_x" value="0.0" />
    <arg name="point3_y" value="-15.0" />
    <arg name="point3_z" value="1.0" />

    <arg name="point4_x" value="-15.0" />
    <arg name="point4_y" value="0.0" />
    <arg name="point4_z" value="1.0" />
    
  </include>

 <!-- trajectory server -->

 <!-- 节点所在的链接包ego_planner,节点对应的可执行文件名称traj_server,

 节点运行时对应的名称为traj_server,将节点的标准输出打印到终端屏幕screen -->

 <node pkg="ego_planner" name="traj_server" type="traj_server" output="screen">

  <remap from="/position_cmd" to="planning/pos_cmd"/>



  <remap from="/odom_world" to="$(arg odom_topic)"/>

  <param name="traj_server/time_forward" value="1.0" type="double"/>

 </node>

 <!-- 节点所在的链接包waypoint_generator,节点对应的可执行文件名称waypoint_generator,

 节点运行时对应的名称为waypoint_generator,将节点的标准输出打印到终端屏幕screen -->

 <node pkg="waypoint_generator" name="waypoint_generator" type="waypoint_generator" output="screen">

  <remap from="~odom" to="$(arg odom_topic)"/>     

  <remap from="~goal" to="/move_base_simple/goal"/>

  <remap from="~traj_start_trigger" to="/traj_start_trigger" />

  <param name="waypoint_type" value="manual-lonely-waypoint"/>   

 </node>

odom_topic里程计话题读取

1.查看话题

rostopic list

2.打开rqt

rqt_plot

3.添加topic

在topic处删掉/,然后打出/选择将要显示的话题,点击+按钮。

注意:如果添加了话题,无法点击+按钮添加,可能是话题数据的消息格式不对或者没有将话题选择到最底层。

解决办法:将要显示的话题数据保存到名为xxx.txt中,查看该话题的消息格式。

rostopic echo /topic_name > xxx.txt

然后根据消息格式在rqt的topic中补全即可。

例如:我们想看里程计odom中xyz数据,但是rostopic list得出的话题名称为:/visual_slam/odom,在rqt中输入该话题后无法点击+按钮。
解决办法:

rostopic echo /visual_slam/odom > odom.txt

根据得到的txt文档可以看出我们需要得到的xyz数据位于odom话题中的pose/pose/position下。所以我们应该在rqt中这样添加topic:

/visual_slam/odom/pose/pose/position/x
/visual_slam/odom/pose/pose/position/y
/visual_slam/odom/pose/pose/position/z

参考博客:里程计话题读取


文章作者: CaoDong street
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 CaoDong street !
  目录