__main__.py 2.58 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

5
ROBOTS = [
Pep Marti Saumell's avatar
Pep Marti Saumell committed
6
7
8
    'anymal', 'anymal_kinova', 'hyq', 'solo', 'solo12', 'talos', 'talos_arm',
    'talos_legs', 'kinova', 'tiago', 'tiago_no_hand', 'icub', 'ur5', 'romeo',
    'hector', 'double_pendulum'
9
]
10

Guilhem Saurel's avatar
Guilhem Saurel committed
11
12
13
14
15
parser = ArgumentParser()
parser.add_argument('robot', nargs='?', default=ROBOTS[0], choices=ROBOTS)

args = parser.parse_args()

16
17
18
19
20
if args.robot == 'anymal':
    anymal = robots_loader.loadANYmal()
    anymal.initViewer(loadModel=True)
    anymal.display(anymal.q0)

21
22
23
24
25
elif args.robot == 'anymal_kinova':
    anymal = robots_loader.loadANYmal(withArm='kinova')
    anymal.initViewer(loadModel=True)
    anymal.display(anymal.q0)

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

31
elif args.robot == 'solo':
Carlos Mastalli's avatar
Carlos Mastalli committed
32
33
34
35
    solo = robots_loader.loadSolo()
    solo.initViewer(loadModel=True)
    solo.display(solo.q0)

36
elif args.robot == 'solo12':
Carlos Mastalli's avatar
Carlos Mastalli committed
37
38
39
40
    solo = robots_loader.loadSolo(False)
    solo.initViewer(loadModel=True)
    solo.display(solo.q0)

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

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

51
elif args.robot == 'talos_legs':
Guilhem Saurel's avatar
Guilhem Saurel committed
52
    talos_legs = robots_loader.loadTalosLegs()
53
54
55
    talos_legs.initViewer(loadModel=True)
    talos_legs.display(talos_legs.q0)

56
57
58
59
60
elif args.robot == 'kinova':
    kinova = robots_loader.loadKinova()
    kinova.initViewer(loadModel=True)
    kinova.display(kinova.q0)

Guilhem Saurel's avatar
Guilhem Saurel committed
61
elif args.robot == 'tiago':
Guilhem Saurel's avatar
Guilhem Saurel committed
62
    tiago = robots_loader.loadTiago()
Carlos Mastalli's avatar
Carlos Mastalli committed
63
    tiago.initViewer(loadModel=True)
64
65
    tiago.display(tiago.q0)

Guilhem Saurel's avatar
Guilhem Saurel committed
66
elif args.robot == 'tiago_no_hand':
Guilhem Saurel's avatar
Guilhem Saurel committed
67
    tiago_no_hand = robots_loader.loadTiagoNoHand()
Carlos Mastalli's avatar
Carlos Mastalli committed
68
    tiago_no_hand.initViewer(loadModel=True)
69
70
    tiago_no_hand.display(tiago_no_hand.q0)

Guilhem Saurel's avatar
Guilhem Saurel committed
71
elif args.robot == 'icub':
Guilhem Saurel's avatar
Guilhem Saurel committed
72
    icub = robots_loader.loadICub()
Carlos Mastalli's avatar
Carlos Mastalli committed
73
    icub.initViewer(loadModel=True)
74
    icub.display(icub.q0)
Guilhem Saurel's avatar
Guilhem Saurel committed
75
76
77
78
79

elif args.robot == 'ur5':
    ur5 = robots_loader.loadUR()
    ur5.initViewer(loadModel=True)
    ur5.display(ur5.q0)
Pep Marti Saumell's avatar
Pep Marti Saumell committed
80

Guilhem Saurel's avatar
Guilhem Saurel committed
81
82
83
84
elif args.robot == 'romeo':
    romeo = robots_loader.loadRomeo()
    romeo.initViewer(loadModel=True)
    romeo.display(romeo.q0)
85
86
87
88
89
90

if args.robot == 'hector':
    hector = robots_loader.loadHector()
    hector.initViewer(loadModel=True)
    hector.display(hector.q0)

Pep Marti Saumell's avatar
Pep Marti Saumell committed
91
if args.robot == 'double_pendulum':
92
93
94
    planar2dof = robots_loader.load2dof()
    planar2dof.initViewer(loadModel=True)
    planar2dof.display(planar2dof.q0)