-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.py
85 lines (80 loc) · 2.98 KB
/
generate.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
85
import pyrosim.pyrosim as pyrosim
def Create_World():
x = 1.5
y = 1.5
z = 1.5
lenght = 1
width = 1
height = 1
pyrosim.Start_SDF("world.sdf")
pyrosim.Send_Cube(name="Box", pos=[x,y,z], size=[lenght, width, height])
pyrosim.End()
def Create_Robot():
x = 0
xj = 0
y = 0
yj = 0
z = 0.5
zj = 1
lenght = 1
width = 1
height = 1
pyrosim.Start_URDF("body.urdf")
pyrosim.Send_Cube(name="Link0", pos=[x,y,z], size=[lenght, width, height])
pyrosim.Send_Joint( name = "Link0_Link1" , parent= "Link0" , child = "Link1" , type = "revolute",
position = [xj,yj,zj])
pyrosim.Send_Cube(name="Link1",
pos=[x,y,z],
size=[lenght, width, height])
pyrosim.Send_Joint( name = "Link1_Link2" , parent= "Link1" , child = "Link2" , type = "revolute",
position = [xj,yj,zj])
pyrosim.Send_Cube(name="Link2",
pos=[x,y,z],
size=[lenght, width, height])
pyrosim.Send_Joint( name = "Link2_Link3" , parent= "Link2" , child = "Link3" , type = "revolute",
position = [xj+1,yj,zj-1])
pyrosim.Send_Cube(name="Link3",
pos=[x,y,z],
size=[lenght, width, height])
pyrosim.Send_Joint( name = "Link3_Link4" , parent= "Link3" , child = "Link4" , type = "revolute",
position = [xj+1,yj,zj-1])
pyrosim.Send_Cube(name="Link4",
pos=[x,y,z],
size=[lenght, width, height])
pyrosim.Send_Joint( name = "Link4_Link5" , parent= "Link4" , child = "Link5" , type = "revolute",
position = [xj,yj,zj-2])
pyrosim.Send_Cube(name="Link5",
pos=[x,y,z],
size=[lenght, width, height])
pyrosim.Send_Joint( name = "Link5_Link6" , parent= "Link5" , child = "Link6" , type = "revolute",
position = [xj,yj,zj-2])
pyrosim.Send_Cube(name="Link6",
pos=[x,y,z],
size=[lenght, width, height])
pyrosim.End()
def Create_Robot2():
x = 0
xj = -0.5
y = 0
yj = 0
z = 1.5
zj = 1
lenght = 1
width = 1
height = 1
pyrosim.Start_URDF("body2.urdf")
pyrosim.Send_Cube(name="Torso", pos=[x,y,z], size=[lenght, width, height])
pyrosim.Send_Joint(name = "Torso_BackLeg" , parent= "Torso" , child = "BackLeg" , type = "revolute",
position = [xj,yj,zj])
pyrosim.Send_Cube(name="BackLeg",
pos=[x-0.5,y,z-2],
size=[lenght, width, height])
pyrosim.Send_Joint(name = "Torso_FrontLeg" , parent= "Torso" , child = "FrontLeg" , type = "revolute",
position = [0.5,0,1])
pyrosim.Send_Cube(name="FrontLeg",
pos=[x+0.5,y,z-2],
size=[lenght, width, height])
pyrosim.End()
#Create_Robot()
Create_Robot2()
Create_World()