Ask Your Question

Navigation Stack: Invalid argument passed to canTransform argument source_frame in tf2 frame_ids cannot be empty

asked 2016-01-26 00:46:23 -0500

automate gravatar image

updated 2016-02-02 00:15:35 -0500

Hi, I am trying to get the navigation stack working. I am publishing odometry data, tf data and laser scan to Navigation stack. But I get "Invalid argument passed to canTransform argument source_frame in tf2 frame_ids cannot be empty" error when I initialize Rviz

Navfn ROS topic gives error "For Frame []: Frame [] does not exist". "Transform: [Sender =Unknown Publisher]"I am not able to generate any path to goal for my robot. Any ideas?

I am using Ubuntu 14.04 and ROS Indigo

Edited part: More details Here is the link to the source code: I run the run_all script to get all things running. These are the steps that are undertaken: 1.Run roscore

  1. Run houkuyo_node (frame laser)
  2. Run robot_tf_publisher which is a static transform publisher between base_link and laser
  3. Run odometry_publisher code. I have written a subscriber which takes data from /cmd_vel topic and publishes it as output of odometry
  4. Run move_base which configures all the costmap params. The link above has details about all the apramers that I configured.
  5. run rviz

Questions that I have are - can i use odom as the global frame. Have I configured the odometry_publisher subscriber correctly? Thanks

I have edited the code as guided. Path is not generated yet. Link to tf tree pic rviz source frame id error

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-02-08 22:30:41 -0500

automate gravatar image

The issue I guess was I wasn't using a static map for global costmap I had to state: static_map:false and rolling window: true. Now the robot navigates to goal position.

edit flag offensive delete link more

answered 2016-01-26 02:07:56 -0500

mgruhler gravatar image

updated 2016-02-01 01:52:21 -0500

Yep, you do have an empty frame_id somewhere... (REVELATION! ;-) ) Thus, it is unclear to the navigation in wich coordinate system you send the information.

Make sure that all topics that you publish and are required by the navigation (Odometry, LaserScan, GoalPose, ... maybe some more) actually contain a valid frame_id. Most probably, the frame_id of your goal is empty, but this is just a guess. Does this error pop up frequently or just when you send a goal?

The warning in rviz pops up quite frequently if there is an "empty" topic being published which should be displayed. But I'm guessing this has nothing to do with your problem of not being able to send a goal.


  1. Why do you use a shell script to start all this? This is what launch files are for...
  2. You could use odom as the global frame. However, this is discouraged, as odometry is error prone. Usually you need a localization node (e.g. amcl) which provides corrections of the errors in odometry if you want to arrive somewhere with respect to global coordinate system (e.g. in a building reach a specific room, you need to give the coordinates of that room with respect to a global fixed coordinate system). This is not what odom can provide... Also, the odom frame usually is located at the place where the base_link is at startup of the robot. Thus, for "relative" navigation with respect to that frame given a perfect robot, it would be okay... Then, the following would make sense as well.
  3. I guess you followed this tutorial in creating the odom publisher. Usually, the odometry should not be taken from the cmd_vel sent in, but rather from what the robot is actually executing, e.g. from motor encoders. To your question: You have an error in how you handle the input from cmd_vel (besides having the subscriber commented out). You need to use the new_vel which is written by the subscriber in the main loop as well, otherwise you'll only have the defaults of 0.0. What will also not work is the move_base launch file, due to (probably) not finding the package my_robot_name_2dnav here.
edit flag offensive delete link more


Thanks for the reply @mig. The "/move_base/NavfnROS/plan" topic has empty frame_id. However the frame_id in /move_base/goal is not empty it is -"odom". One another observation is when I do not use Subscriber and call back function during publishing odometry data everything works fine

automate gravatar image automate  ( 2016-01-26 22:48:27 -0500 )edit

So how and where should I pass the frame_id?

automate gravatar image automate  ( 2016-01-26 22:50:23 -0500 )edit

Depending on your localization, costmap configuration and planner, there are several parameters where you can set the frame_id. Also, if you send the goal from rviz, the fixed_frame specifies the frame of the move_base_simple/goal topic. So maybe you need to change this to map.

mgruhler gravatar image mgruhler  ( 2016-01-27 01:04:55 -0500 )edit

Also, what do you mean with "using Subscriber and callback function during publishing odometry"? If you broadcast the odom->base_link transform using a tf broadcaster, everything should be fine... Best link to the source code, edit your answer with precise steps that you follow and the behviour

mgruhler gravatar image mgruhler  ( 2016-01-27 01:06:36 -0500 )edit

Hey @mig i have edited my question and added link to source code. I want to take /cmd_vel data and pass it to odom. That is the reason for having tf subscriber and callback function during publishing odometry.

automate gravatar image automate  ( 2016-01-31 18:26:54 -0500 )edit

@mig thanks for the detailed response. My purpose here is to simulate navigation stack. Take data from /cmd_vel topic and feed into odometry. Later I will use global data from mav_ros for passing data from pixhawk to navigation stack.For that purpose isnt it fine if i dont use amcl?

automate gravatar image automate  ( 2016-02-02 00:09:59 -0500 )edit

I edited the code. I incorporate the odometry file edits that you pointed out. Thanks. Edited the code - here I am yet not able to generate path to goal and get the robot to follow path. Link to tf tree,rviz added in bottom of my question

automate gravatar image automate  ( 2016-02-02 00:12:49 -0500 )edit

Are there any other errors? The rviz image shows many obstacles right in front of the robot, so it cannot plan a path through there. though the error with the empty frame_id for the plan is still strange. Also, as what you shared is certainly not your workspace, this cannot be reproduced.

mgruhler gravatar image mgruhler  ( 2016-02-02 03:34:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-01-26 00:46:23 -0500

Seen: 10,370 times

Last updated: Feb 08 '16