RobotnikAutomation / rbcar_sim

Robotnik Car Simulation Packages
BSD 2-Clause "Simplified" License
38 stars 25 forks source link

Tf tree unconnected for rbcar #7

Open karanchawla opened 7 years ago

karanchawla commented 7 years ago

@RomanRobotnik I've been trying to access the base_footprint using the lookupTransform method in tf and even though my terminal shows that the link exists, like so

At time 2176.573
- Translation: [-0.750, 0.198, 0.350]
- Rotation: in Quaternion [0.000, 0.003, -0.133, 0.991]
            in RPY (radian) [0.000, 0.006, -0.268]
            in RPY (degree) [0.006, 0.332, -15.341]

Every time I try to access it via code it fails. My node that is trying to listen to the aforementioned transform is:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import tf
import math

if __name__ == "__main__":
  rospy.init_node("tf_listener")
  #tfBuffer = tf2_ros.Buffer()
  #listener = tf2_ros.TransformListener(tfBuffer)
  listener = tf.TransformListener()
  rate = rospy.Rate(10.0)
  listener.waitForTransform("odom","base_link", rospy.Time(), rospy.Duration(4.0))
  while not rospy.is_shutdown():
    try:
      now = rospy.Time.now()
      #(trans,rot) = tfBuffer.lookup_transform('odom', 'base_footprint', now)
      listener.waitForTransform('odom', 'base_link', now, rospy.Duration(2.0))
      (trans,rot) = listener.lookupTransform('odom', 'base_link', now)
    except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):
      rospy.loginfo("No transform")
      continue
    rate.sleep()

If I try to print the tf using the command evince frames.pdf I get the following image, I'm not sure why the tf is unable to make the connection odom->base_footprint->base_link frames.pdf