in bisk/tasks/gaps.py [0:0]
def init_sim(self, root: mjcf.RootElement, frameskip: int = 5):
W = 8
add_fwd_corridor(root, W)
root.find('geom', 'floor').remove()
# Base platform
H = 0.1
root.asset.add(
'material',
name='mat_base',
reflectance=0.5,
shininess=1,
specular=1,
texrepeat=[1, 1],
texuniform=True,
texture='tex_plane',
)
root.asset.add(
'texture',
name='tex_lava',
type='2d',
file=f'{asset_path()}/lava.png',
)
root.asset.add(
'material',
name='mat_gaps',
reflectance=0.5,
shininess=1,
specular=1,
texrepeat=[1, 1],
texuniform=True,
texture='tex_lava',
)
add_box(
root,
f'base',
size=[(W + 4) / 2, W, H],
pos=[(-W + 4) / 2, 0, -H],
conaffinity=1,
material='mat_base',
)
# 200 platforms should be enough for everybody
self.n_platforms = 200
root.asset.add(
'material',
name='mat_platform',
reflectance=0.5,
shininess=1,
specular=1,
)
for i in range(self.n_platforms):
o = (i % 2) * 0.1
add_box(
root,
f'platform-{i}',
size=[1, W, H],
pos=[2, 0, -H],
material='mat_platform',
rgba=[0.2 + o, 0.3 + o, 0.4 + o, 1.0],
)
# Gaps are placed 5cm below
g = add_box(
root,
f'gap-{i}',
size=[1, W, H],
pos=[2, 0, -H - 0.05],
material='mat_gaps',
)
super().init_sim(root, frameskip)