-
Notifications
You must be signed in to change notification settings - Fork 0
/
ballBotInfo.lua
executable file
·70 lines (61 loc) · 2.47 KB
/
ballBotInfo.lua
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
-- Example of script defining construction info for a simple 2 parts robot.
-- Helper function to create the geometry of the head.
local newHead = require("robots/parts/newHead")
-- Various dimensions of the robot parts.
local BODY_RADIUS = 0.35
local HEAD_RADIUS = 0.2
local NECK_LENGTH = 0.05
local MARGIN = 0.01
local ballBotInfo= insight.newRobotInfo{
-- list of body parts (physics engine shapes), indexed by their names.
parts= {
Torso= {
type= "Sphere",
params= {
radius= BODY_RADIUS,
density= 1000,
}
},
Head= newHead(HEAD_RADIUS, BODY_RADIUS, NECK_LENGTH-MARGIN, 1000),
},
-- name of the base part (this is the position read & written by Lua methods)
basePart= "Torso",
-- list of joints indexed by their names.
joints= {
Neck= {
-- Names of the 2 body parts of this joint.
convexPart= "Torso",
concavePart= "Head",
info= {
-- 3 degree of freedom joint (x: twist axis).
type= "Spherical",
params= {
-- Position of the pivot points relative to each part.
convexTransform= {
rotation= {axis= {0,0,1}, angle= math.pi/2},
position= {0, 0, 0},
},
concaveTransform= {
rotation= {axis={0,0,1}, angle= math.pi/2},
position= {0, -BODY_RADIUS-NECK_LENGTH-3/8*HEAD_RADIUS, 0},
},
-- Initial relative orientation of the 2 parts.
startRotation= {0,0,0,1},
-- Maximum angle about each axis from the neutral position (> PI: no restriction).
limits= {math.huge, math.huge, math.huge},
-- Maximum motor torque about each axis.
maxMotorTorque= {1, 5, 5},
-- Damping coefficients (higher -> more friction).
frictionCoefficients= {0.25, 0.25, 0.25},
-- Disable automatic addition of joint geometry to the parts.
generateConvexShape= false,
-- Density of created parts (not used here).
density= 1000,
-- Radius of the ball of the joint (not used here).
radius= 0,
},
},
},
},
}
return ballBotInfo