Skip to content

Commit e4b510e

Browse files
committed
load walls (WORKS with onnx_controller caac798f)
1 parent 8965bee commit e4b510e

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

go2_simulation/bullet_wrapper.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def __init__(self, node, timestep):
3333
self.x_offset = 3.0
3434
self.z_offset = 0.0
3535

36+
self.load_walls()
3637
self.load_obstacles()
3738

38-
3939
def init_pybullet(self, timestep):
4040
cid = pybullet.connect(pybullet.SHARED_MEMORY)
4141
if cid < 0:
@@ -113,7 +113,6 @@ def init_pybullet(self, timestep):
113113
forces=[0.0 for i in range(12)],
114114
)
115115

116-
117116
self.w_T_b = np.eye(4)
118117

119118
# Finite differences to compute acceleration
@@ -122,6 +121,25 @@ def init_pybullet(self, timestep):
122121

123122
assert pybullet.isNumpyEnabled(), "Numpy not enabled in PyBullet!"
124123

124+
def load_walls(self):
125+
half_extents = [10.0, 0.1, 2.0]
126+
col_id = pybullet.createCollisionShape(pybullet.GEOM_BOX, halfExtents=half_extents)
127+
vis_id = pybullet.createVisualShape(
128+
pybullet.GEOM_BOX, halfExtents=half_extents, rgbaColor=[1, 0, 0, 1]
129+
)
130+
box_id = pybullet.createMultiBody(
131+
baseMass=0,
132+
baseCollisionShapeIndex=col_id,
133+
baseVisualShapeIndex=vis_id,
134+
basePosition=[10.0, self.box_half_width + .1, 1.],
135+
)
136+
box_id = pybullet.createMultiBody(
137+
baseMass=0,
138+
baseCollisionShapeIndex=col_id,
139+
baseVisualShapeIndex=vis_id,
140+
basePosition=[10.0, -self.box_half_width - .1, 1.],
141+
)
142+
125143
def load_obstacles(self):
126144
half_extents = [self.box_half_length, self.box_half_width, self.box_half_height]
127145

0 commit comments

Comments
 (0)