-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot_zoo.py
84 lines (73 loc) · 4.28 KB
/
robot_zoo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from revolve2.core.modular_robot import Core, Body, Module, Brick, ActiveHinge
from direct_tree.direct_tree_genotype import DirectTreeGenotype
import math
"""
All the robots bodies are stored here
Use one of the functions to create your robot
"""
def make_ant_body() -> DirectTreeGenotype:
body = Body()
body.core.left = ActiveHinge(0.0)
body.core.left.attachment = Brick(0.0)
body.core.right = ActiveHinge(0.0)
body.core.right.attachment = Brick(0.0)
body.core.back = ActiveHinge(math.pi / 2)
body.core.back.attachment = Brick(math.pi / 2)
body.core.back.attachment.left = ActiveHinge(0.0)
body.core.back.attachment.left.attachment = Brick(0.0)
body.core.back.attachment.right = ActiveHinge(0.0)
body.core.back.attachment.right.attachment = Brick(0.0)
body.core.back.attachment.front = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment = Brick(math.pi / 2)
body.core.back.attachment.front.attachment.left = ActiveHinge(0.0)
body.core.back.attachment.front.attachment.left.attachment = Brick(0.0)
body.core.back.attachment.front.attachment.right = ActiveHinge(0.0)
body.core.back.attachment.front.attachment.right.attachment = Brick(0.0)
return DirectTreeGenotype(body)
def make_gecko_body() -> DirectTreeGenotype:
body = Body()
body.core.left = ActiveHinge(0.0)
body.core.left.attachment = Brick(0.0)
body.core.right = ActiveHinge(0.0)
body.core.right.attachment = Brick(0.0)
body.core.back = ActiveHinge(math.pi / 2)
body.core.back.attachment = Brick(math.pi / 2)
body.core.back.attachment.front = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment = Brick(math.pi / 2)
body.core.back.attachment.front.attachment.left = ActiveHinge(0.0)
body.core.back.attachment.front.attachment.left.attachment = Brick(0.0)
body.core.back.attachment.front.attachment.right = ActiveHinge(0.0)
body.core.back.attachment.front.attachment.right.attachment = Brick(0.0)
return DirectTreeGenotype(body)
def make_super_ant_body() -> DirectTreeGenotype:
body = Body()
# head and first set of arms
body.core.left = ActiveHinge(0.0)
body.core.left.attachment = ActiveHinge(math.pi / 2)
body.core.left.attachment.attachment = Brick(0.0)
body.core.right = ActiveHinge(0.0)
body.core.right.attachment = ActiveHinge(math.pi / 2)
body.core.right.attachment.attachment = Brick(0.0)
# second part of the body and arms
body.core.back = ActiveHinge(math.pi / 2)
body.core.back.attachment = Brick(math.pi / 2)
body.core.back.attachment.front = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment = Brick(math.pi / 2)
body.core.back.attachment.front.attachment.left = ActiveHinge(0.0)
body.core.back.attachment.front.attachment.left.attachment = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment.left.attachment.attachment = Brick(0.0)
body.core.back.attachment.front.attachment.right = ActiveHinge(0.0)
body.core.back.attachment.front.attachment.right.attachment = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment.right.attachment.attachment = Brick(0.0)
# third part of the body and arms
body.core.back.attachment.front.attachment.front = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment.front.attachment = Brick(math.pi / 2)
body.core.back.attachment.front.attachment.front.attachment.front = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment.front.attachment.front.attachment = Brick(math.pi / 2)
body.core.back.attachment.front.attachment.front.attachment.front.attachment.left = ActiveHinge(0.0)
body.core.back.attachment.front.attachment.front.attachment.front.attachment.left.attachment = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment.front.attachment.front.attachment.left.attachment.attachment = Brick(math.pi / 2)
body.core.back.attachment.front.attachment.front.attachment.front.attachment.right = ActiveHinge(0.0)
body.core.back.attachment.front.attachment.front.attachment.front.attachment.right.attachment = ActiveHinge(math.pi / 2)
body.core.back.attachment.front.attachment.front.attachment.front.attachment.right.attachment.attachment = Brick(math.pi / 2)
return DirectTreeGenotype(body)