Skip to content
Snippets Groups Projects
Commit 554ce5ee authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

use ArgumentParser

parent db11e872
No related merge requests found
......@@ -36,3 +36,10 @@ If you have never added robotpkg as a softwares repository, please follow first
4. The installation of example-robot-data:
sudo apt install robotpkg-example-robot-data
## Show the robot
(you will need pinocchio and its python bindings)
`python -m example_robot_data [hyq,talos,talos_arm,tiago,tiago_no_hand,icub]`
import sys
from argparse import ArgumentParser
from . import robots_loader
DISPLAY_HYQ = 'hyq' in sys.argv
DISPLAY_TALOS = 'talos' in sys.argv
DISPLAY_TALOS_ARM = 'talos_arm' in sys.argv
DISPLAY_TALOS_LEGS = 'talos_legs' in sys.argv
DISPLAY_TIAGO = 'tiago' in sys.argv
DISPLAY_TIAGO_NO_HAND = 'tiago_no_hand' in sys.argv
DISPLAY_ICUB = 'icub' in sys.argv
ROBOTS = ['hyq', 'talos', 'talos_arm', 'talos_legs', 'tiago', 'tiago_no_hand', 'icub']
if DISPLAY_HYQ:
parser = ArgumentParser()
parser.add_argument('robot', nargs='?', default=ROBOTS[0], choices=ROBOTS)
args = parser.parse_args()
if args.robot == 'hyq':
hyq = robots_loader.loadHyQ()
hyq.initViewer(loadModel=True)
hyq.initDisplay(loadModel=True)
hyq.display(hyq.q0)
if DISPLAY_TALOS:
elif args.robot == 'talos':
talos = robots_loader.loadTalos()
talos.initViewer(loadModel=True)
talos.initDisplay(loadModel=True)
talos.display(talos.q0)
if DISPLAY_TALOS_ARM:
elif args.robot == 'talos_arm':
talos_arm = robots_loader.loadTalosArm()
talos_arm.initViewer(loadModel=True)
talos_arm.initDisplay(loadModel=True)
talos_arm.display(talos_arm.q0)
if DISPLAY_TALOS_LEGS:
if args.robot == 'laso_legs':
talos_legs = robots_loader.loadTalosLegs()
talos_legs.initViewer(loadModel=True)
talos_legs.display(talos_legs.q0)
if DISPLAY_TIAGO:
elif args.robot == 'tiago':
tiago = robots_loader.loadTiago()
tiago.initViewer(loadModel=True)
tiago.initDisplay(loadModel=True)
tiago.display(tiago.q0)
if DISPLAY_TIAGO_NO_HAND:
elif args.robot == 'tiago_no_hand':
tiago_no_hand = robots_loader.loadTiagoNoHand()
tiago_no_hand.initViewer(loadModel=True)
tiago_no_hand.initDisplay(loadModel=True)
tiago_no_hand.display(tiago_no_hand.q0)
if DISPLAY_ICUB:
elif args.robot == 'icub':
icub = robots_loader.loadICub()
icub.initViewer(loadModel=True)
icub.initDisplay(loadModel=True)
icub.display(icub.q0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment