ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

TF not moving in navigation stack

asked 2019-02-19 03:02:33 -0500

IvyKK gravatar image

updated 2019-02-22 02:27:45 -0500

Hi there, I'm following the wiki tutorial for the navigation stack, however, when I launch it, - the tf in the map seems not moving when I physically move it and - it doesn't move as well when I tried to use 2D pose estimate as well. But the local footprint polygon and laser scanning data flashes continuously between the tf and the selected location.

Anyone knows what the problem is? (will that be because of the static tf publisher of odom to footprint?)

Here's the robot_configuration.launch

<launch>
  <node name="ydlidar_node"  pkg="ydlidar"  type="ydlidar_node" output="screen"/>    

  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" 
    args="0.0 0.0 0.0 0 0 0.0 /map /odom 40" />
  <node pkg="tf" type="static_transform_publisher" name="odom_to_basefootprint" 
        args="0.0 0.0 0.0 0 0 0.0 /odom /base_footprint 40" />
  <node pkg="tf" type="static_transform_publisher" name="base_footprint_to_base_link"
    args="0 0.0 0 0.0 0.0  0.0 /base_footprint /base_link 40" />
  <node pkg="tf" type="static_transform_publisher" name="base_link_to_laser_frame"
    args="0.2245 0.0 0 1.57 3.14  0.0 /base_link /laser_frame 40" />

  <node pkg="rf2o_laser_odometry" type="rf2o_laser_odometry_node" name="rf2o_laser_odometry">
    <param name="laser_scan_topic" value="/scan"/>        
    <param name="base_frame_id" value="/base_link"/>            
    <param name="odom_frame_id" value="/odom" />               
    <param name="freq" value="6.0"/>                        
  </node>

  <node pkg="rviz" type="rviz" name="rviz" 
    args="-d $(find mobilet_2dnav)/rviz_cfg/configuration.rviz"/>

</launch>

and the move_base.launch

<launch>

   <master auto="start"/>
 <!-- Run the map server --> 
    <node name="map_server" pkg="map_server" type="map_server" args="$(find mobilet_2dnav)/maps/office_4.yaml"/>

 <!--- Run AMCL --> 
    <include file="$(find amcl)/examples/amcl_diff.launch" />

   <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <rosparam file="$(find mobilet_2dnav)/param/costmap_common_params.yaml" command="load" ns="global_costmap" /> 
    <rosparam file="$(find mobilet_2dnav)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find mobilet_2dnav)/param/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find mobilet_2dnav)/param/global_costmap_params.yaml" command="load" /> 
    <rosparam file="$(find mobilet_2dnav)/param/base_local_planner_params.yaml" command="load" />
 </node>

</launch>

Any help will be appreciated! Thanks

Edit: followed Delb's suggestions, I changed parameter of the rf2o_laser_odometry node:

 <node pkg="rf2o_laser_odometry" type="rf2o_laser_odometry_node" name="rf2o_laser_odometry" output="screen">
    <param name="laser_scan_topic" value="/scan"/>        # topic where the lidar scans are being published
    <param name="odom_topic" value="/odom_rf2o" />      # topic where tu publish the odometry estimations
    <param name="publish_tf" value="true" />                     # wheter or not to publish the tf::transform (base->odom)
    <param name="base_frame_id" value="/base_footprint"/>      # frame_id (tf) of the mobile robot base. A tf transform from the laser_frame to the base_frame is mandatory
    <param name="odom_frame_id" value="/odom" />                 # frame_id (tf) to publish the odometry estimations    
    <param name="init_pose_from_topic" value="" />        # (Odom topic) Leave empty to start at point (0,0)
    <param name="freq" value="6.0"/>                               # Execution frequency.
    <param name="verbose" value="true" />  
  </node>

and my tf_tree:image description image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-02-19 05:23:35 -0500

Delb gravatar image

updated 2019-02-20 03:15:06 -0500

You are defining to much static transforms. The static transform won't move since they are static so your robot won't move at all.

The AMCL is responsible to publish the tf between map and odom so you have a conflict between AMCL and your static transform. Moreover it's your node rf2_laser_odometry that will deal with the tf between base_link and odom so all you have to do is get rid of these nodes :

  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" 
    args="0.0 0.0 0.0 0 0 0.0 /map /odom 40" />
  <node pkg="tf" type="static_transform_publisher" name="odom_to_basefootprint" 
        args="0.0 0.0 0.0 0 0 0.0 /odom /base_footprint 40" />

You probably need to change the parameter base_frame_id to :

<param name="base_frame_id" value="/base_footprint"/>

Edit : There are too much parameters for your node rf2o_laser_odometry, it should be like that :

 <node pkg="rf2o_laser_odometry" type="rf2o_laser_odometry_node" name="rf2o_laser_odometry" output="screen">
    <param name="laser_scan_topic" value="/scan"/>               
    <param name="base_frame_id" value="/base_footprint"/>
    <param name="odom_frame_id" value="/odom" /> 
    <param name="freq" value="6.0"/> 
  </node>

I've deleted the other params because they don't exist for this node. For the frequence I would set a higher rate, at least the same as for the static transforms (40).

For odom you can choose whatever you want as long as the other nodes needing odom (the topic not the frame) are correctly remapped (that's why I would keep it as odom).

For roswtf I don't know why you have those warnings the tf tree looks right (even more if you say that the frame moves correctly), maybe it's due to the frequence or simply because of your rviz configuration which was using the old static transforms that you have now removed. Maybe if you try launching rviz with the default configuration and then running roswtf the warning might disappear.

edit flag offensive delete link more

Comments

Million Thanks Delb! tf moves correspondingly now! just when i run roswtf, it shows:

WARNING The following node subscriptions are unconnected:
 * /rf2o_laser_odometry:
   * /tf_static
 * /amcl:
   * /tf_static

am I missing anything? or should they be connected in other way?

IvyKK gravatar image IvyKK  ( 2019-02-20 02:26:38 -0500 )edit

Also, I noticed that /odom seems publishing nothing while /odom_rf2o does, do I need to change it to /odom? Hope you can answer! Thanks!

IvyKK gravatar image IvyKK  ( 2019-02-20 02:31:12 -0500 )edit

Have you modified the node rf2o_laser_odometry ? It should publish odom not odom_rf2o. About roswtf, can you edit your question to add a picture of the tf_tree ? Also if you could detail what you've changed exactly that would be clearer.

Delb gravatar image Delb  ( 2019-02-20 02:40:58 -0500 )edit

just edited the question for more info. Should I actually change the "odom_topic" to /odom too?

IvyKK gravatar image IvyKK  ( 2019-02-20 02:52:06 -0500 )edit

I have tried a while, but not sure why when I delete the line for "publish_tf" and "init_pose_from_topic", the lidar doesn't publish data (while it is still spinning), so I keep both lines.

IvyKK gravatar image IvyKK  ( 2019-02-21 00:52:37 -0500 )edit

Also found that rf2o node seems just take data from /scan (while lidar is installed upside down as indicated in static tf.), so robot moves to right in reality but moving to left in the map.But from here,the node does subcribe tf..do you have idea of this?

IvyKK gravatar image IvyKK  ( 2019-02-21 01:06:11 -0500 )edit

That might be due to how you define the static frame here :

args="0.2245 0.0 0 1.57 3.14  0.0 /base_link /laser_frame 40"

That indicates that you rotate the frame around x by pi/2 but also around y by pi. You should only rotate around x by pi.

Delb gravatar image Delb  ( 2019-02-21 01:23:57 -0500 )edit

My bad description.. I actually flipped the lidar upside down and turned it around z for pi/2.. and tf displayed is correct.. I used the above static transform for hector slam for creating map, and the tf moves correspondingly when I move the robot..just not so sure why it doesn't right here...

IvyKK gravatar image IvyKK  ( 2019-02-22 01:15:30 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-02-19 03:02:33 -0500

Seen: 1,757 times

Last updated: Feb 22 '19