example_reading_sensors.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib
00003 import rospy
00004 from std_msgs.msg import Float64
00005 from sr_robot_msgs.msg import JointMusclePositionControllerState
00006 import math
00007 
00008 # A callback function for the state messages we are reading.
00009 status = None
00010 
00011 
00012 def state_cb(data):
00013     global status
00014     status = data
00015 
00016 rospy.init_node('example_reading_sensors')
00017 
00018 # Set up the subscriber so we can read the data, each joint publishes its
00019 # own state.
00020 rospy.Subscriber('/sh_ffj3_muscle_position_controller/state',
00021                  JointMusclePositionControllerState, state_cb)
00022 
00023 print "Try moving ffj3"
00024 r = rospy.Rate(1)  # hz
00025 while not rospy.is_shutdown():
00026     if status:
00027         print "ffj3 position:%s radians  pressure0:%s pressure1:%s" % (status.process_value,
00028                                                                        status.muscle_pressure_0,
00029                                                                        status.muscle_pressure_1)
00030     r.sleep()


sr_edc_muscle_tools
Author(s): Mark Pitchless
autogenerated on Mon Jul 1 2019 20:06:25