Browse Source

Included argument.

main
hello-sanchez 2 years ago
parent
commit
8c9e1297c5
2 changed files with 10 additions and 8 deletions
  1. +4
    -3
      example_6.md
  2. +6
    -5
      src/effort_sensing.py

+ 4
- 3
example_6.md View File

@ -44,17 +44,18 @@ class JointActuatorEffortSensor(hm.HelloNode):
"""
A class that sends multiple joint trajectory goals to a single joint.
"""
def __init__(self):
def __init__(self, export_data=False):
"""
Function that initializes the subscriber,and other features.
:param self: The self reference.
:param export_data: A boolean message type.
"""
hm.HelloNode.__init__(self)
self.sub = rospy.Subscriber('joint_states', JointState, self.callback)
self.joints = ['joint_lift']
self.joint_effort = []
self.save_path = '/home/hello-robot/catkin_ws/src/stretch_tutorials/stored_data'
self.export_data = False
self.export_data = export_data
def callback(self, msg):
"""
@ -140,7 +141,7 @@ class JointActuatorEffortSensor(hm.HelloNode):
if __name__ == '__main__':
try:
node = JointActuatorEffortSensor()
node = JointActuatorEffortSensor(export_data=True)
node.main()
except KeyboardInterrupt:
rospy.loginfo('interrupt received, so shutting down')

+ 6
- 5
src/effort_sensing.py View File

@ -29,12 +29,13 @@ class JointActuatorEffortSensor(hm.HelloNode):
"""
A class that sends multiple joint trajectory goals to a single joint.
"""
# Initialize the inhereted hm.Hellonode class.
def __init__(self):
def __init__(self, export_data=False):
"""
Function that initializes the subscriber,and other features.
:param self: The self reference.
:param export_data: A boolean message type.
"""
# Initialize the inhereted hm.Hellonode class.
hm.HelloNode.__init__(self)
# Set up a subscriber. We're going to subscribe to the topic "joint_states"
@ -50,7 +51,7 @@ class JointActuatorEffortSensor(hm.HelloNode):
self.save_path = '/home/hello-robot/catkin_ws/src/stretch_tutorials/stored_data'
# Create boolean data type for conditional statements if you want to export effort data.
self.export_data = False
self.export_data = export_data
def callback(self, msg):
@ -89,7 +90,7 @@ class JointActuatorEffortSensor(hm.HelloNode):
# Make the action call and send the goal. Also define the feedback and
# done callback function.
self.trajectory_client.send_goal(trajectory_goal, feedback_cb=self.feedback_callback, done_cb=self.done_callback)
rospy.loginfo('Sent stow goal = {0}'.format(trajectory_goal))
rospy.loginfo('Sent position goal = {0}'.format(trajectory_goal))
self.trajectory_client.wait_for_result()
@ -173,7 +174,7 @@ class JointActuatorEffortSensor(hm.HelloNode):
if __name__ == '__main__':
try:
# Declare object, node, from JointActuatorEffortSensor class
node = JointActuatorEffortSensor()
node = JointActuatorEffortSensor(export_data=True)
node.main()
except KeyboardInterrupt:
rospy.loginfo('interrupt received, so shutting down')

Loading…
Cancel
Save