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

Revision history [back]

Dear nouf,

did you remember to set use_sim_time param to true?

rosparam set use_sim_time true

Please note that your odometry publisher node has a problem in main loop:

ros::spinOnce();       

[...]

odom_broadcaster.sendTransform(odom_trans);

[...]

odom_pub.publish(odom);

r.sleep();

Following execution flow you:

  • broadcast tf;
  • publish odom topic;
  • wait for rate;
  • invoke ros::spinOnce().

I remember you that tf and topics are not really published until you invoke ros::spinOnce(): so, basically, you are publishing this information with one second delay. I suggest you to move ros::spinOnce() just after odom topic publisher line.

Hope this help...

Dear nouf,

did you remember to set use_sim_time param to true?

rosparam set use_sim_time true

Please note that your odometry publisher node has a problem in main loop:

ros::spinOnce();       

[...]

odom_broadcaster.sendTransform(odom_trans);

[...]

odom_pub.publish(odom);

r.sleep();

Following execution flow you:

  • broadcast tf;
  • publish odom topic;
  • wait for rate;
  • invoke ros::spinOnce().

I remember you that tf and topics are not really published until you invoke ros::spinOnce(): so, basically, you are publishing this information with one second delay. I suggest you to move ros::spinOnce() just after odom topic publisher line.

Hope this help...

UPDATE

First: I suggest you to modify your code in order to have tf published in right way. Further more you are broadcasting odom -> base_link transformation with at 1Hz rate and base_link -> base_laser transformation at 100Hz and this is not a good practice. I cannot tell you that this will fix your problem but you should fix them before go on.

Second: run

rosrun tf view_frames

and

roswtf

The first will create a PDF contains the tf tree pf your robot: you can us it in order to be sure tf chain is not broken. The second will start some automatic diagnostic tool in order to check your transformation health status.

Dear nouf,

did you remember to set use_sim_time param to true?

rosparam set use_sim_time true

Please note that your odometry publisher node has a problem in main loop:

ros::spinOnce();       

[...]

odom_broadcaster.sendTransform(odom_trans);

[...]

odom_pub.publish(odom);

r.sleep();

Following execution flow you:

  • broadcast tf;
  • publish odom topic;
  • wait for rate;
  • invoke ros::spinOnce().

I remember you that tf and topics are not really published until you invoke ros::spinOnce(): so, basically, you are publishing this information with one second delay. I suggest you to move ros::spinOnce() just after odom topic publisher line.

Hope this help...

UPDATE

First: I suggest you to modify your code in order to have tf published in right way. Further more you are broadcasting odom -> base_link transformation with at 1Hz rate and base_link -> base_laser transformation at 100Hz and this is not a good practice. I cannot tell you that this will fix your problem but you should fix them before go on.

Second: run

rosrun tf view_frames

and

roswtf

The first will create a PDF contains the tf tree pf your robot: you can us it in order to be sure tf chain is not broken. The second will start some automatic diagnostic tool in order to check your transformation health status.

UPDATE

Sorry for late reply.... there a lot of inconsistence in your tf tree:

  • map -> odom transformation is missing. This is usually provided by AMCL or some SLAM node (gmapping, hector slam...);
  • posted log refer to a base_laser frame but in your tf tree you named it laser_link (I assume both them refer to laser frame of course :-) );
  • base_link -> camera_link transformation is missing. If should be provided by robot_state_publisher too.

Try to fix those issues. Can you also post output from roswtf?

Dear nouf,

did you remember to set use_sim_time param to true?

rosparam set use_sim_time true

Please note that your odometry publisher node has a problem in main loop:

ros::spinOnce();       

[...]

odom_broadcaster.sendTransform(odom_trans);

[...]

odom_pub.publish(odom);

r.sleep();

Following execution flow you:

  • broadcast tf;
  • publish odom topic;
  • wait for rate;
  • invoke ros::spinOnce().

I remember you that tf and topics are not really published until you invoke ros::spinOnce(): so, basically, you are publishing this information with one second delay. I suggest you to move ros::spinOnce() just after odom topic publisher line.

Hope this help...

UPDATE

First: I suggest you to modify your code in order to have tf published in right way. Further more you are broadcasting odom -> base_link transformation with at 1Hz rate and base_link -> base_laser transformation at 100Hz and this is not a good practice. I cannot tell you that this will fix your problem but you should fix them before go on.

Second: run

rosrun tf view_frames

and

roswtf

The first will create a PDF contains the tf tree pf your robot: you can us it in order to be sure tf chain is not broken. The second will start some automatic diagnostic tool in order to check your transformation health status.

UPDATE

Sorry for late reply.... there a lot of inconsistence in your tf tree:

  • map -> odom transformation is missing. This is usually should be provided by AMCL or some SLAM node (gmapping, hector slam...);gmapping;
  • posted log refer to a base_laser frame but in your tf tree you named it laser_link (I assume both them refer to laser frame of course :-) );
  • base_link -> camera_link transformation is missing. If should be provided by robot_state_publisher too.

Try to fix those issues. Can you also post output from roswtf?

Dear nouf,

did you remember to set use_sim_time param to true?

rosparam set use_sim_time true

Please note that your odometry publisher node has a problem in main loop:

ros::spinOnce();       

[...]

odom_broadcaster.sendTransform(odom_trans);

[...]

odom_pub.publish(odom);

r.sleep();

Following execution flow you:

  • broadcast tf;
  • publish odom topic;
  • wait for rate;
  • invoke ros::spinOnce().

I remember you that tf and topics are not really published until you invoke ros::spinOnce(): so, basically, you are publishing this information with one second delay. I suggest you to move ros::spinOnce() just after odom topic publisher line.

Hope this help...

UPDATE

First: I suggest you to modify your code in order to have tf published in right way. Further more you are broadcasting odom -> base_link transformation with at 1Hz rate and base_link -> base_laser transformation at 100Hz and this is not a good practice. I cannot tell you that this will fix your problem but you should fix them before go on.

Second: run

rosrun tf view_frames

and

roswtf

The first will create a PDF contains the tf tree pf your robot: you can us it in order to be sure tf chain is not broken. The second will start some automatic diagnostic tool in order to check your transformation health status.

UPDATE

Sorry for late reply.... there a lot of inconsistence in your tf tree:

  • map -> odom transformation is missing. This should be provided by gmapping;gmapping so if it was not running when you get view frames this is ok;
  • posted log refer to a base_laser frame but in your tf tree you named it laser_link (I assume both them refer to laser frame of course :-) );
  • base_link -> camera_link transformation is missing. If should be provided by robot_state_publisher too.

Try to fix those issues. Can you also post output from roswtf?