DOCUMENT IT

This commit is contained in:
2019-02-25 21:00:42 +01:00
parent c987f7362b
commit fbb09ebf8f
9 changed files with 136 additions and 8 deletions

View File

@@ -1,4 +1,6 @@
#! /usr/bin/env python
"""The node performing the imitation."""
from argparse import ArgumentParser
from math import radians
@@ -18,6 +20,7 @@ TORSO = False
def controller_factory(ctrl):
"""Create a controller depending on the command line argument."""
if ctrl == 'nao_cartesian':
return lambda my_arm_xyz, side: nao_cart_movement(my_arm_xyz, side)
@@ -45,8 +48,8 @@ if __name__ == '__main__':
ll = tf.TransformListener()
while not rospy.is_shutdown():
rospy.Rate(20).sleep()
if not _inform_masterloop('imitate'):
rospy.Rate(20).sleep() # Run at 20 Hz or something
if not _inform_masterloop('imitate'): # Try to seize the control
continue
rospy.logdebug('IMITATOR: ACTIVE')
@@ -61,7 +64,7 @@ if __name__ == '__main__':
# except Exception as e:
# rospy.logwarn(e)
for i, side in enumerate(['L', 'R'], 1):
for i, side in enumerate(['L', 'R'], 1): # One arm at a time
try:
a0, _ = ll.lookupTransform(
'odom',
@@ -79,6 +82,9 @@ if __name__ == '__main__':
my_arm_xyz = np.array(arm) - np.array(a0)
# rospy.loginfo('{}'.format(my_arm_xyz))
# rospy.loginfo('{}'.format(dumb(my_arm_xyz, side)))
imitation_cycle(my_arm_xyz, side)
imitation_cycle(my_arm_xyz, side) # Do the actuation
# Set hands to sane positions
mp.setAngles(('LWristYaw', 'RWristYaw'),
(radians(-70), radians(70)), 0.3)