arguments for scripts(maybe useful?)
This commit is contained in:
@@ -15,8 +15,26 @@ _inform_masterloop = inform_masterloop_factory('imitator')
|
||||
TORSO = False
|
||||
|
||||
|
||||
def controller_factory(ctrl):
|
||||
if ctrl == 'nao_cartesian':
|
||||
return lambda my_arm_xyz, side: nao_cart_movement(my_arm_xyz, side)
|
||||
|
||||
if ctrl == 'dumb':
|
||||
cfunc = dumb
|
||||
elif ctrl == 'our_cartesian':
|
||||
cfunc = our_cartesian
|
||||
return lambda my_arm_xyz, side: movement(my_arm_xyz, side, cfunc)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
rospy.init_node('imitator')
|
||||
ap = ArgumentParser()
|
||||
ap.add_argument('--controller', default='dumb', const='dumb', nargs='?',
|
||||
choices=['dumb', 'nao_cartesian', 'our_cartesian'],
|
||||
help='Choose the controller for arm motions')
|
||||
args, _ = ap.parse_known_args()
|
||||
imitation_cycle = controller_factory(args.controller)
|
||||
|
||||
rospy.wait_for_service('inform_masterloop')
|
||||
|
||||
ll = tf.TransformListener()
|
||||
@@ -56,4 +74,4 @@ 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)))
|
||||
movement(my_arm_xyz, side, dumb)
|
||||
imitation_cycle(my_arm_xyz, side)
|
||||
|
||||
@@ -140,9 +140,12 @@ if __name__ == '__main__':
|
||||
|
||||
rospy.init_node('masterloop')
|
||||
ap = ArgumentParser()
|
||||
ap.add_argument('-i', '--autoimitate',
|
||||
help='Switch between moving and imitating automatically',
|
||||
action='store_true')
|
||||
aig = ap.add_mutually_exclusive_group(required=False)
|
||||
aig.add_argument('--autoimitate', dest='autoimitate',
|
||||
action='store_true')
|
||||
aig.add_argument('--no-autoimitate', dest='autoimitate',
|
||||
action='store_false')
|
||||
ap.set_defaults(autoimitate=False)
|
||||
args, _ = ap.parse_known_args()
|
||||
|
||||
AI = args.autoimitate
|
||||
|
||||
Reference in New Issue
Block a user