-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSPLAssets.py
53 lines (49 loc) · 2.3 KB
/
SPLAssets.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
# SPL Assets
import pybullet as pb
from math import pi
def LoadSPLField(client):
pb.loadURDF("models/spl-22-field.urdf",
basePosition=[0,0,0],
baseOrientation=pb.getQuaternionFromEuler([pi/2,0,0]),
useFixedBase=1,
flags=pb.URDF_USE_MATERIAL_COLORS_FROM_MTL,
physicsClientId=client)
def LoadSPLGoalPosts(client):
# Currently, the goalpost uses a convex mesh, i.e. objects can't pass the goal line.
# Might need to break the goalpost into 2 or more convex parts and combine them in urdf.
pb.loadURDF("models/spl-goalpost-v3.urdf",
basePosition=[-4.5,0,0.05],
baseOrientation=pb.getQuaternionFromEuler([pi/2,0,0]),
useFixedBase=1,
flags=pb.URDF_USE_MATERIAL_COLORS_FROM_MTL,
#pb.GEOM_FORCE_CONCAVE_TRIMESH |
#pb.GEOM_CONCAVE_INTERNAL_EDGE,
physicsClientId=client)
pb.loadURDF("models/spl-goalpost-v3.urdf",
basePosition=[4.5,0,0.05],
baseOrientation=pb.getQuaternionFromEuler([pi/2,0,pi]),
useFixedBase=1,
flags=pb.URDF_USE_MATERIAL_COLORS_FROM_MTL,
#pb.URDF_INITIALIZE_SAT_FEATURES |
#pb.GEOM_FORCE_CONCAVE_TRIMESH |
#pb.GEOM_CONCAVE_INTERNAL_EDGE,
physicsClientId=client)
def SpawnSPLBall(client, position=[0, 0, 1], source="pybullet"):
if source == "pybullet":
# This is from pybullet
# Might need to adjust the size and mass of the ball
ball = pb.loadURDF("soccerball.urdf",[0,1,1], globalScaling=0.1)
pb.changeDynamics(ball,-1,
mass=0.0005,
linearDamping=0,
angularDamping=0,
rollingFriction=0.001,
spinningFriction=0.001)
pb.changeVisualShape(ball,-1,rgbaColor=[0.8,0.8,0.8,1])
elif source == "custom":
# This was made by me
pb.loadURDF("models/spl-22-ball.urdf",
basePosition=[0.3,0,0.3],
baseOrientation=pb.getQuaternionFromEuler([0,0,0]),
flags=pb.URDF_USE_MATERIAL_COLORS_FROM_MTL,
physicsClientId=client)