Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"base_link" passed to lookupTransform argument source_frame does not exist. #15

Open
WhiteLiu opened this issue Jun 9, 2018 · 10 comments

Comments

@WhiteLiu
Copy link

WhiteLiu commented Jun 9, 2018

Hi thank you for your code.
I ran your code and met an error like this:

[ERROR] [1528530745.560135159]: "base_link" passed to lookupTransform argument target_frame does not exist.

[ INFO] [1528530745.559015472]: [rf2o] Got first Laser Scan .... Configuring node
[ERROR] [1528530745.560135159]: "base_link" passed to lookupTransform argument target_frame does not exist.
[ WARN] [1528530746.569180836]: [rf2o] Waiting for laser_scans....
[ INFO] [1528530746.661969013]: [rf2o] execution time (ms): 91.300003
[ INFO] [1528530746.676619586]: [rf2o] LASERodom = [4069212109502419162988500261007533596520888707133573213859607748348110515496760309981862588138470268977128520817500006621411228751297971167098020859225051821089437351108771130319817666818819669645829339015406038234995868260893555460825585568622722783847935664509926986887330137400246874722674231063085056.000000 4066711308156252521498569006646583609358738761244122237589932837151753773253692050786982401862174574216475381377992770159294349940622886256477694310438370100219056345371907693761619041847029112729922483984368441720851675221915465985159064573964201893388144139083926388282577724119488248465991518744739840.000000 0.000000]
[ERROR] [1528530746.677118076]: "base_link" passed to lookupTransform argument source_frame does not exist.
[ INFO] [1528530747.678349221]: BASEodom = [4069212109502419162988500261007533596520888707133573213859607748348110515496760309981862588138470268977128520817500006621411228751297971167098020859225051821089437351108771130319817666818819669645829339015406038234995868260893555460825585568622722783847935664509926986887330137400246874722674231063085056.000000 4066711308156252521498569006646583609358738761244122237589932837151753773253692050786982401862174574216475381377992770159294349940622886256477694310438370100219056345371907693761619041847029112729922483984368441720851675221915465985159064573964201893388144139083926388282577724119488248465991518744739840.000000 1.570796]

[rf2o] COV_ODO:  6.26805e-06 -8.59658e-06 -3.56644e-06
-8.59658e-06  1.37278e-05  5.87134e-06
-3.56644e-06  5.87134e-06  9.11759e-05

[rf2o] COV_ODO:  2.55766e-06 -6.19651e-08  1.72826e-06
-6.19651e-08   1.3884e-06  1.72536e-06
 1.72826e-06  1.72536e-06  2.55973e-05

[rf2o] COV_ODO:  7.7434e-08 1.39265e-07 2.64753e-07
1.39265e-07  3.1925e-07  5.8949e-07
2.64753e-07  5.8949e-07 4.96849e-06

[rf2o] COV_ODO: 4.31645e-08 -6.6744e-09 2.08869e-08
-6.6744e-09 6.47693e-08 8.08363e-08
2.08869e-08 8.08363e-08   5.405e-07

[rf2o] COV_ODO:  1.78388e-08 -2.09421e-09   5.8128e-09
-2.09421e-09  1.98805e-08 -4.36148e-10
  5.8128e-09 -4.36148e-10  8.87997e-08
[ INFO] [1528530747.942551513]: [rf2o] execution time (ms): 262.619995
[ INFO] [1528530747.944603284]: [rf2o] LASERodom = [4069212109502419162988500261007533596520888707133573213859607748348110515496760309981862588138470268977128520817500006621411228751297971167098020859225051821089437351108771130319817666818819669645829339015406038234995868260893555460825585568622722783847935664509926986887330137400246874722674231063085056.000000 4066711308156252521498569006646583609358738761244122237589932837151753773253692050786982401862174574216475381377992770159294349940622886256477694310438370100219056345371907693761619041847029112729922483984368441720851675221915465985159064573964201893388144139083926388282577724119488248465991518744739840.000000 0.000000]
[ERROR] [1528530747.945146877]: "base_link" passed to lookupTransform argument source_frame does not exist.
[ INFO] [1528530748.946347242]: BASEodom = [4069212109502419162988500261007533596520888707133573213859607748348110515496760309981862588138470268977128520817500006621411228751297971167098020859225051821089437351108771130319817666818819669645829339015406038234995868260893555460825585568622722783847935664509926986887330137400246874722674231063085056.000000 4066711308156252521498569006646583609358738761244122237589932837151753773253692050786982401862174574216475381377992770159294349940622886256477694310438370100219056345371907693761619041847029112729922483984368441720851675221915465985159064573964201893388144139083926388282577724119488248465991518744739840.000000 1.570796]

[rf2o] COV_ODO:  3.99492e-06  -6.1891e-06  1.31348e-06
 -6.1891e-06  9.64553e-06 -2.02555e-06
 1.31348e-06 -2.02555e-06  4.50428e-05

[rf2o] COV_ODO:  5.28336e-06  1.30654e-06 -1.02118e-06

lookupTransform is a function from MRPT.

template <int DIM>
FrameLookUpStatus FrameTransformer<DIM>::lookupTransform(
	const std::string & target_frame,
	const std::string & source_frame,
	typename base_t::lightweight_pose_t & child_wrt_parent,
	const mrpt::system::TTimeStamp query_time,
	const double timeout_secs)
{
	ASSERTMSG_(timeout_secs == .0, "timeout_secs!=0: Blocking calls not supported yet!");
	ASSERTMSG_(query_time == INVALID_TIMESTAMP, "`query_time` different than 'latest' not supported yet!");

	const auto &it_src = m_pose_edges_buffer.find(source_frame);
	if (it_src == m_pose_edges_buffer.end()) {
		return LKUP_UNKNOWN_FRAME;
	}

	const auto &it_dst = it_src->second.find(target_frame);
	if (it_dst == it_src->second.end()) {
		return LKUP_NO_CONNECTIVITY;
	}

	const TF_TreeEdge & te = it_dst->second;
	child_wrt_parent = te.pose;

	return LKUP_GOOD;
}

Is this OK?
I don't know how to solve this.Thank you!

@SyarifFakhri
Copy link

Bump, i'm having the same issue

@subodh-malgonde
Copy link

subodh-malgonde commented Sep 10, 2018

I was getting the same error when trying to play back data from a bag file. The mistake was launching all the static transforms and the rf2o_laser_odometry_node node in the same launch file.

rf2o_laser_odometry_node needs all the transforms to be published before it is started. Starting things in the following order fixed it for me:

  1. Start roscore & publish static transforms
  2. Play back data from the bag file
  3. Start rf2o_laser_odometry_node

EDIT: I am getting the same error again, eventhough I am following the following steps. My tf tree is alright, it looks like this:

screen shot 2018-09-11 at 12 27 43 pm

But I am getting an error:

[ERROR] [1536648967.296507406]: "base_footprint" passed to lookupTransform argument target_frame does not exist.
[ERROR] [1536648968.304547065]: "laser" passed to lookupTransform argument target_frame does not exist.

@HaoQChen
Copy link

It seem that, it can't get the first laser data before the tf_listener.lookupTransform(base_frame_id, last_scan.header.frame_id, ros::Time(0), transform); in CLaserOdometry2DNode.cpp. So last_scan.header.frame_id will be empty at that time which cause the error. You can fix that by change the last_scan.header.frame_id with your own frame_id.

@pfs-db
Copy link

pfs-db commented Mar 28, 2019

@HaoQChen Hey a tried what you sad but didn't worked could you take a look at my files to give a hit about what to do?

tf_listener.lookupTransform(base_frame_id, last_scan.header.frame_id, ros::Time::now(), transform);//tf_listener.lookupTransform(base_frame_id, last_scan.header.frame_id, ros::Time::now(), transform)
terminal:
rosgraph
frames.pdf

freitasufsc@freitasufsc-X510UR:~/mybot_ws$ roslaunch chefbot_bringup laser_odom.launch
... logging to /home/freitasufsc/.ros/log/2dcfaeba-518f-11e9-b2e6-6432a8107b10/roslaunch-freitasufsc-X510UR-12910.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://freitasufsc-X510UR:36325/

SUMMARY

PARAMETERS

  • /rf2o_laser_odometry/base_frame_id: /base_link
  • /rf2o_laser_odometry/freq: 6.0
  • /rf2o_laser_odometry/init_pose_from_topic: /base_pose_ground...
  • /rf2o_laser_odometry/laser_scan_topic: /scan
  • /rf2o_laser_odometry/odom_frame_id: /odom
  • /rf2o_laser_odometry/odom_topic: /odom_rf2o
  • /rf2o_laser_odometry/publish_tf: True
  • /rf2o_laser_odometry/verbose: True
  • /rosdistro: kinetic
  • /rosversion: 1.12.14

NODES
/
rf2o_laser_odometry (rf2o_laser_odometry/rf2o_laser_odometry_node)

ROS_MASTER_URI=http://localhost:11311

process[rf2o_laser_odometry-1]: started with pid [12927]
[ INFO] [1553801340.848430500]: Initializing RF2O node...
[ERROR] [1553801340.863565618]: "base_link" passed to lookupTransform argument target_frame does not exist.
[ INFO] [1553801341.864708296]: Listening laser scan from topic: /scan
[ WARN] [1553801342.032327728]: Waiting for laser_scans....
[ WARN] [1553801342.198729339]: Waiting for laser_scans....
[ WARN] [1553801342.365142766]: Waiting for laser_scans....
[ WARN] [1553801342.532535214]: Waiting for laser_scans....

// Launch file

<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_link"/>                       # 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="/base_pose_ground_truth" />  # (Odom topic) Leave empty to start at point (0,0)
<param name="freq" value="6.0"/>                                       # Execution frequency.
<param name="verbose" value="true"/>                                  # verbose

For more details you can send me email for [email protected]

@pfs-db
Copy link

pfs-db commented Mar 28, 2019

It seem that, it can't get the first laser data before the tf_listener.lookupTransform(base_frame_id, last_scan.header.frame_id, ros::Time(0), transform); in CLaserOdometry2DNode.cpp. So last_scan.header.frame_id will be empty at that time which cause the error. You can fix that by change the last_scan.header.frame_id with your own frame_id.

Hey.

@HaoQChen
Copy link

HaoQChen commented Mar 29, 2019

last_scan.header.frame_id

In your case, you should specify which last_scan.header.frame_id is, like that tf_listener.lookupTransform(base_frame_id, "my_laser_frame", ros::Time::now(), transform);. Cause last_scan.header.frame_id is still empty at that time, you need to specify it in string type.

I think this happen may due to the slow publication of laser data.

@pfs-db
Copy link

pfs-db commented Mar 29, 2019

last_scan.header.frame_id

In your case, you should specify which last_scan.header.frame_id is, like that tf_listener.lookupTransform(base_frame_id, "my_laser_frame", ros::Time::now(), transform);. Cause last_scan.header.frame_id is still empty at that time, you need to specify it in string type.

I think this happen may due to the slow publication of laser data.

<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="false" />                              # 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="10.0"/>                                       # Execution frequency.
<param name="verbose" value="true"/>                                  # verbose

///////////////////////////////////////////////////////////////////////////////////////////

try
{
tf_listener.lookupTransform(base_frame_id, "laser", ros::Time::now(), transform);//tf_listener.lookupTransform(base_frame_id, last_scan.header.frame_id, ros::Time::now(), transform)
retrieved = true;
}
catch (tf::TransformException &ex)
{
ROS_ERROR("%s",ex.what());
ros::Duration(1.0).sleep();
retrieved = false;
}

I changed the code and the freq argumento but didn't solve my problem

ERROR example:

roslaunch chefbot_bringup laser_odom.launch
... logging to /home/freitasufsc/.ros/log/1df61088-5220-11e9-8f24-6432a8107b10/roslaunch-freitasufsc-X510UR-9346.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://freitasufsc-X510UR:46401/

SUMMARY

PARAMETERS

  • /rf2o_laser_odometry/base_frame_id: /base_footprint
  • /rf2o_laser_odometry/freq: 10.0
  • /rf2o_laser_odometry/init_pose_from_topic:
  • /rf2o_laser_odometry/laser_scan_topic: /scan
  • /rf2o_laser_odometry/odom_frame_id: /odom
  • /rf2o_laser_odometry/odom_topic: /odom_rf2o
  • /rf2o_laser_odometry/publish_tf: False
  • /rf2o_laser_odometry/verbose: True
  • /rosdistro: kinetic
  • /rosversion: 1.12.14

NODES
/
rf2o_laser_odometry (rf2o_laser_odometry/rf2o_laser_odometry_node)

ROS_MASTER_URI=http://localhost:11311

process[rf2o_laser_odometry-1]: started with pid [9363]
[ INFO] [1553863402.566448685]: Initializing RF2O node...
[ERROR] [1553863402.577841631]: "base_footprint" passed to lookupTransform argument target_frame does not exist.
[ INFO] [1553863403.578956223]: Listening laser scan from topic: /scan
[ INFO] [1553863403.579351838]: [rf2o] Got first Laser Scan .... Configuring node
[ INFO] [1553863403.579686735]: [rf2o] Setting origin at:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
[ INFO] [1553863403.690967071]: [rf2o] execution time (ms): 11.174555
[ INFO] [1553863403.692179698]: [rf2o] LASERodom = [0.000000 0.000000 0.000000]
[ INFO] [1553863403.692585833]: BASEodom = [0.000000 0.000000 0.000000]
[ WARN] [1553863403.820856620]: [rf2o] ERROR: Eigensolver couldn't find a solution. Pose is not updated
[ WARN] [1553863403.880217589]: Waiting for laser_scans....
[ WARN] [1553863404.018521529]: [rf2o] ERROR: Eigensolver couldn't find a solution. Pose is not updated
[ WARN] [1553863404.106977271]: [rf2o] ERROR: Eigensolver couldn't find a solution. Pose is not updated
[ WARN] [1553863404.179389881]: Waiting for laser_scans....
[ WARN] [1553863404.315291173]: [rf2o] ERROR: Eigensolver couldn't find a solution. Pose is not updated
[ WARN] [1553863404.418857389]: [rf2o] ERROR: Eigensolver couldn't find a solution. Pose is not updated
[ WARN] [1553863404.498856061]: [rf2o] ERROR: Eigensolver couldn't find a solution. Pose is not updated

frames.pdf

My code doesn't publish the tf odom

My entire code can be found https://github.com/PabloFreitasUfsc/AGV_ROS

@ivywongkk
Copy link

I have similar problem, but seems to be solved after adding a waitForTransfrom
For the CLaserOdometry2DNode.cpp,
I add a line
tf_listener.waitForTransform("/base_footprint","/laser_frame", ros::Time(), ros::Duration(5.0));
before the tf_listener.lookupTransform
I also changed the frame.id to /base_footprint and /laser_frame as HaoQChen suggested

@procopiostein
Copy link

this is caused by a race condition.
the method that looks up the transform between base and laser frame is called at the constructor, and it uses the frame of the last received laser message.
But in many cases no laser message will have been received when the constructor is called, therefore the lookup fails.

I did a fix for it by calling waitForMessage (for the scan) just before the lookup.

Here is another solution, by moving said method out of the constructor to the laser callback: #24

@weihaoysgs
Copy link

maybe is your rviz config error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants