modified input parser
This commit is contained in:
@@ -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")
|
||||||
|
|
||||||
# check input argument
|
args = parser.parse_args()
|
||||||
if args:
|
|
||||||
|
|
||||||
# bring robot in stand_up position
|
# bring robot in stand_up position
|
||||||
if args == 'stand':
|
if args.stand:
|
||||||
striker.mover.stand_up()
|
striker.mover.stand_up()
|
||||||
|
|
||||||
# bring robot in rest postion
|
# bring robot in rest postion
|
||||||
elif args == 'rest':
|
elif args.rest:
|
||||||
striker.mover.rest()
|
striker.mover.rest()
|
||||||
|
|
||||||
|
# perform a fancy kick
|
||||||
|
elif args.kick:
|
||||||
|
striker.mover.stand_up()
|
||||||
|
striker.mover.kick()
|
||||||
|
striker.mover.rest()
|
||||||
|
|
||||||
# perform a fancy kick
|
|
||||||
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user