modified input parser

This commit is contained in:
Jonas
2018-06-22 19:05:58 +02:00
parent 6d92dfcaec
commit ef5c38fad5

View File

@@ -278,28 +278,30 @@ if __name__ == '__main__':
# rest # rest
# kick # kick
# try to readout arguments parser = argparse.ArgumentParser()
try: parser.add_argument("-s", "--stand", action="store_true",
args=sys.argv[1] help="let the robot stand up")
except NameError: parser.add_argument("-k", "--kick", action="store_true",
args='' help="let the robot do a fancy kick")
parser.add_argument("-r", "--rest", action="store_true",
help="let the robot rest")
args = parser.parse_args()
# check input argument # bring robot in stand_up position
if args: if args.stand:
striker.mover.stand_up()
# bring robot in stand_up position # bring robot in rest postion
if args == 'stand': elif args.rest:
striker.mover.stand_up() striker.mover.rest()
# bring robot in rest postion # perform a fancy kick
elif args == 'rest': elif args.kick:
striker.mover.rest() striker.mover.stand_up()
striker.mover.kick()
# perform a fancy kick striker.mover.rest()
elif args == 'kick':
striker.mover.stand_up()
striker.mover.kick()
striker.mover.rest()
# perform normal state-machine if no input argument is given # perform normal state-machine if no input argument is given
else: else: