ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

moving sr_hand ros fuerte with code

asked 2013-04-04 04:28:38 -0500

phmferreira gravatar image

updated 2014-04-20 14:09:25 -0500

ngrennan gravatar image

I tried to move de hand with rostopic and this work very well

 rostopic pub /sh_ffj3_mixed_position_velocity_controller/command std_msgs/Float64 -- 10

And I tried to make this with code.

import roslib; roslib.load_manifest('rospy_tutorials')

import rospy
from std_msgs.msg import *

def talker():
    pub = rospy.Publisher('sh_ffj3_mixed_position_velocity_controller/command', Float64)
    value = 10

if __name__ == '__main__':
    except rospy.ROSInterruptException: pass

But this didn't work. The model in the gazebo gui does not move.

This the result of this execution:

/opt/ros/fuerte/share/rospy_tutorials$ rosrun beginner_tutorials[INFO] [WallTime: 1365084692.814065] [0.000000] 10

Anyone knows what is wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-04 11:20:58 -0500

tfoote gravatar image

It is likely that you need to keep the node up long enough to allow the connection to be established, and then the data sent. rostopic pub does this by setting the topic to be latched, so the last sent message will be sent to a new subscriber upon estabilishing a connection, and then waiting 3 seconds before quitting to allow the connection to be established.

edit flag offensive delete link more


You can also add: rospy.spin() to keep the node up and running until you kill it, and then send your targets from a loop.

Ugo gravatar image Ugo  ( 2013-04-04 20:19:22 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2013-04-04 04:28:38 -0500

Seen: 135 times

Last updated: Apr 04 '13