[Documentation] [TitleIndex] [WordIndex

(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Sending Commands [python]

Description: Simply sends a command to the Shadow Hand from python.

Tutorial Level:

Contents

The following python code will send one target (of 1.5 radians) to FFJ3. First we initialise the node (to register it with the rest of the ROS ecosystem). We then create a publisher to be able to stream some data to the correct topic. Finally we publish the target we want to send.

   1 import roslib; roslib.load_manifest('sr_example')
   2 import rospy
   3 from std_msgs.msg import Float64
   4 
   5 rospy.init_node('shadowhand_command_publisher_python')
   6 pub = rospy.Publisher('sh_ffj3_position_controller/command', Float64, latch=True)
   7 pub.publish(1.5)
   8 
   9 rospy.spin()


2019-09-21 13:13