__main__.py 1.64 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
from argparse import ArgumentParser
Guilhem Saurel's avatar
Guilhem Saurel committed
2

Guilhem Saurel's avatar
Guilhem Saurel committed
3
from . import robots_loader
4

Guilhem Saurel's avatar
Guilhem Saurel committed
5
ROBOTS = ['hyq', 'solo', 'solo12', 'talos', 'talos_arm', 'talos_legs', 'tiago', 'tiago_no_hand', 'icub', 'ur5']
6

Guilhem Saurel's avatar
Guilhem Saurel committed
7
8
9
10
11
12
parser = ArgumentParser()
parser.add_argument('robot', nargs='?', default=ROBOTS[0], choices=ROBOTS)

args = parser.parse_args()

if args.robot == 'hyq':
Guilhem Saurel's avatar
Guilhem Saurel committed
13
    hyq = robots_loader.loadHyQ()
Carlos Mastalli's avatar
Carlos Mastalli committed
14
    hyq.initViewer(loadModel=True)
15
16
    hyq.display(hyq.q0)

Carlos Mastalli's avatar
Carlos Mastalli committed
17
18
19
20
21
22
23
24
25
26
if args.robot == 'solo':
    solo = robots_loader.loadSolo()
    solo.initViewer(loadModel=True)
    solo.display(solo.q0)

if args.robot == 'solo12':
    solo = robots_loader.loadSolo(False)
    solo.initViewer(loadModel=True)
    solo.display(solo.q0)

Guilhem Saurel's avatar
Guilhem Saurel committed
27
elif args.robot == 'talos':
Guilhem Saurel's avatar
Guilhem Saurel committed
28
    talos = robots_loader.loadTalos()
Carlos Mastalli's avatar
Carlos Mastalli committed
29
    talos.initViewer(loadModel=True)
30
31
    talos.display(talos.q0)

Guilhem Saurel's avatar
Guilhem Saurel committed
32
elif args.robot == 'talos_arm':
Guilhem Saurel's avatar
Guilhem Saurel committed
33
    talos_arm = robots_loader.loadTalosArm()
Carlos Mastalli's avatar
Carlos Mastalli committed
34
    talos_arm.initViewer(loadModel=True)
35
36
    talos_arm.display(talos_arm.q0)

Carlos Mastalli's avatar
Carlos Mastalli committed
37
if args.robot == 'talos_legs':
Guilhem Saurel's avatar
Guilhem Saurel committed
38
    talos_legs = robots_loader.loadTalosLegs()
39
40
41
    talos_legs.initViewer(loadModel=True)
    talos_legs.display(talos_legs.q0)

Guilhem Saurel's avatar
Guilhem Saurel committed
42
elif args.robot == 'tiago':
Guilhem Saurel's avatar
Guilhem Saurel committed
43
    tiago = robots_loader.loadTiago()
Carlos Mastalli's avatar
Carlos Mastalli committed
44
    tiago.initViewer(loadModel=True)
45
46
    tiago.display(tiago.q0)

Guilhem Saurel's avatar
Guilhem Saurel committed
47
elif args.robot == 'tiago_no_hand':
Guilhem Saurel's avatar
Guilhem Saurel committed
48
    tiago_no_hand = robots_loader.loadTiagoNoHand()
Carlos Mastalli's avatar
Carlos Mastalli committed
49
    tiago_no_hand.initViewer(loadModel=True)
50
51
    tiago_no_hand.display(tiago_no_hand.q0)

Guilhem Saurel's avatar
Guilhem Saurel committed
52
elif args.robot == 'icub':
Guilhem Saurel's avatar
Guilhem Saurel committed
53
    icub = robots_loader.loadICub()
Carlos Mastalli's avatar
Carlos Mastalli committed
54
    icub.initViewer(loadModel=True)
55
    icub.display(icub.q0)
Guilhem Saurel's avatar
Guilhem Saurel committed
56
57
58
59
60

elif args.robot == 'ur5':
    ur5 = robots_loader.loadUR()
    ur5.initViewer(loadModel=True)
    ur5.display(ur5.q0)