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

How can I subscribe joint_controller/state from dynamixel

asked 2013-10-06 23:17:48 -0600

unais gravatar image


I write the following code to subscribe . How can I get the current pos data.

import rospy
from dynamixel_msgs import JointState

def callback(data):
    print "callback"
    print data

def listener():
    rospy.init_node('starter', anonymous=True)
    rospy.Subscriber("/joint6_controller/state", current_pos, callback)

if __name__ == '__main__':
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-07 13:14:28 -0600

jdorich gravatar image

updated 2013-10-07 13:15:20 -0600

In the callback

current_position = data.current_pos

should do the trick. Also note, that this:

rospy.Subscriber("/joint6_controller/state", current_pos, callback)

should be this:

rospy.Subscriber("/joint6_controller/state", JointState, callback)

The dynamixel controller Joint State message documentation is here. If you want to access any other member, just call "data.[member name goes here]".

Hope this helps.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-10-06 23:17:48 -0600

Seen: 613 times

Last updated: Oct 07 '13