example_reading_sensors.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib; roslib.load_manifest('sr_edc_muscle_tools')
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 def state_cb(data):
00011     global status
00012     status = data
00013 
00014 rospy.init_node('example_reading_sensors')
00015 
00016 # Set up the subscriber so we can read the data, each joint publishes its own state.
00017 rospy.Subscriber('/sh_ffj3_muscle_position_controller/state',
00018                  JointMusclePositionControllerState, state_cb)
00019 
00020 print "Try moving ffj3"
00021 r = rospy.Rate(1) # hz
00022 while not rospy.is_shutdown():
00023    if status:
00024         print "ffj3 position:%s radians  pressure0:%s pressure1:%s"%(status.process_value, status.muscle_pressure_0, status.muscle_pressure_1)
00025    r.sleep()


sr_edc_muscle_tools
Author(s): Mark Pitchless
autogenerated on Thu Aug 27 2015 15:16:21