Help needed with TF issues .

asked 2018-02-27 22:33:46 -0500

updated 2018-02-28 01:37:24 -0500

jayess gravatar image

Hey , i am working on a 4 wheel drive differential robot , I am using Rosserial to talk to the arduino (cmd_vel) and arduino publishes back (tf , in which the odom is there).

Timed out waiting for transform from base_link to map to become available before running costmap, tf error: Could not find a connection between 'map' and 'base_link' because they are not part of the same tree.Tf has two or more unconnected trees.. canTransform returned after 0.101146 timeout was 0.1.

image description

As you can see from the image , the error is No transform from camera to odom . I have done all simulations and it works properly ,but when i am using the Real robot , this error pops up .

What could be the error , the possibilities that i could think of are the below

  1. The frames not being synced , will i have to subscribe to a /clock topic on the arduino to synchronize the /tf topic .
  2. /odom as a dedicated topic doesnt exist .

Also can someone explain me the differences between

  1. /odometry/filtered image description
  2. /velocity_controller/odom image description
  3. /tf topic image description

image description

Additional information , the Arduino code which communicates to kangaroo x2.

enter code here

#include <ros.h>
#include <std_msgs/Empty.h>
#include <ros/time.h>
#include <tf/tf.h>
#include <tf/transform_broadcaster.h>
#include <nav_msgs/Odometry.h>
#include <geometry_msgs/Twist.h>
#include <std_msgs/String.h>
#include <std_msgs/Empty.h>
#include <std_msgs/Bool.h>

#include <SoftwareSerial.h>
#include <Kangaroo.h>
#define TX_PIN 13 //s1
#define RX_PIN 12 //s2
// Arduino TX (pin 2) goes to Kangaroo S1
// Arduino RX (pin 3) goes to Kangaroo S2

// Independent mode channels on Kangaroo are, by default, '1' and '2'.
SoftwareSerial  SerialPort(RX_PIN, TX_PIN);

KangarooSerial  K(SerialPort);

#define Mixed_mode true
 bool position_control =  true;
 #ifdef Mixed_mode
   KangarooChannel Drive(K, 'D');
   KangarooChannel Turn(K, 'T');

#ifndef Mixed_mode
  KangarooChannel KL(K, '1');
  KangarooChannel KR(K, '2');

ros::NodeHandle  nh;
long WHEEL_DIST = 2 ;

std_msgs::Bool position_control_msg;
std_msgs::Bool mixed_mode_msg;


double x = 1.0;
double y = 0.0;
double theta = 1.57;

void cmd_velCallback( const geometry_msgs::Twist& CVel){
  //geometry_msgs::Twist twist = twist_msg;

   long vel_x = CVel.linear.x*200;

   long vel_th = -CVel.angular.z*200;

   x += cos(theta)*CVel.linear.x*0.1;
   y += sin(theta)*CVel.linear.x*0.1;
   theta += CVel.angular.z*0.1;

   long  speed_right = (vel_th*WHEEL_DIST)/2 + vel_x;
   long  speed_left = (vel_x*2) - speed_right;
   long right_vel = 0.0;
   long left_vel = 0.0;
   //right_vel = vel_th * WheelSeparation / 2.0;
   //left_vel = (-1) * right_vel;
   //left_vel = vel_x - vel_th * WheelSeparation / 2.0;
   //right_vel = vel_x + vel_th * WheelSeparation / 2.0;
    // turning

    #ifdef Mixed_mode
    if(int(vel_x) == 0 && int(vel_th)==0){  
      if (position_control){

   // forward / backward
   else if(abs(vel_x) > abs(vel_th)  ){ 
      if (position_control){
   // moving doing arcs
      if (position_control){


    #ifndef Mixed_mode
       KR.pi ...
edit retag flag offensive close merge delete


As you can see on your tf tree map and odom are linked together but not with the other tf which is the issue. Do you launch joint_state_publisher and robot_state_publisher ?

Delb gravatar image Delb  ( 2018-02-28 02:29:32 -0500 )edit

Thanks , just checked , i had missed to include joint_state_publisher .

Now the tf issues between base_link and odom is solved .

But when i am launching the freenect node for using the kinect , its still saying

"No transform from [camera_depth_frame] to [odom]"

chrissunny94 gravatar image chrissunny94  ( 2018-02-28 02:55:48 -0500 )edit

First, is your camera_depth_frame in your tf tree ? Also check in rviz on the display pannel -> Grid -> Reference Frame, is it <fixed frame=""> or have you redefined it (which you should do) ?

Delb gravatar image Delb  ( 2018-02-28 03:56:38 -0500 )edit

Yes camera_depth_frame is there in the tf tree. On Rviz i have tried setting the reference frame as /odom , /base_link , /camera_link .

Still doesnt work .

Infact the Tf tree changes when i launch the freenect node/

chrissunny94 gravatar image chrissunny94  ( 2018-02-28 04:36:23 -0500 )edit

This might be due to the topics you're publishing/subscribing in your code that are not the same as the freenect's ones, have you checked that ? That could be solved with some remapping.

Delb gravatar image Delb  ( 2018-02-28 05:01:51 -0500 )edit