Ask Your Question
0

How can I subscribe joint_controller/state from dynamixel

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

unais gravatar image

Hi,

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)
    rospy.spin()


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

1 Answer

Sort by ยป oldest newest most voted
0

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

jdorich gravatar image

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 492 times

Last updated: Oct 07 '13