openni_tracker listener cannot find 'openni_depth_frame' (groovy)
Following a tutorial (can't post link) to write an tf listener for the frames openni_tracker publishes. Here is my listener:
#!/usr/bin/python
from kinect import Kinect
kin = Kinect()
for i in xrange(10):
print i, kin.get_posture()
Here is the kinect class file:
#!/usr/bin/python
import roslib
roslib.load_manifest('kinect_listener')
import rospy
import tf
BASE_FRAME = '/openni_depth_frame'
FRAMES = [
'head',
'neck',
'torso',
'left_shoulder',
'left_elbow',
'left_hand',
'left_hip',
'left_knee',
'left_foot',
'right_shoulder',
'right_elbow',
'right_hand',
'right_hip',
'right_knee',
'right_foot',
]
rospy.Duration()
class Kinect:
def __init__(self, name='kinect_listener', user=1):
rospy.init_node(name, anonymous=True)
self.listener = tf.TransformListener()
self.user = user
def get_posture(self):
#try:
frames = []
for frame in FRAMES:
trans, rot = self.listener.lookupTransform(BASE_FRAME,
"/%s_%d" % (frame, self.user), LAST)
frames.append((trans, rot))
return frames
#except (tf.LookupException,
# tf.ConnectivityException,
# tf.ExtrapolationException):
# raise IndexError
When I run this I get this error:
Traceback (most recent call last):
File "/home/robotlab/catkin_ws/src/kinect_listener/src/kinect_listener.py", line 8, in <module>
print i, kin.get_posture()
File "/home/robotlab/catkin_ws/src/kinect_listener/src/kinect.py", line 49, in get_posture
"/%s_%d" % (frame, self.user), LAST)
tf.LookupException: Frame id /openni_depth_frame does not exist! Frames (1):
Which doesn't make sense because when I run rostopic echo tf
I can see the frame and the published transforms (for example):
frame_id: /openni_depth_frame
child_frame_id: /right_foot_1
transform:
translation:
x: 1.04582212435
y: -0.372131748083
z: -0.909085018278
rotation:
x: 0.499999999997
y: 0.500001836603
z: 0.499999999997
w: 0.499998163397
Why can rostopic
see the frame fine but my code cannot? I already did the Psi pose in front of the kinect when I ran openni_tracker.
Asked by cooly64x on 2013-04-17 13:40:02 UTC
Comments
Hey, i try to run the example too, but I get the same Error like you. I have no idea how to solve this problem, because the terminal shows me, that the user is calibrated. Maybe anyone run this example and can help us. Thanks for solution approaches
Asked by Turtlebot23 on 2013-08-26 23:19:21 UTC
Did you find a solution??
Asked by G212 on 2015-12-22 18:20:52 UTC