in bisk/tasks/hurdleslimbo.py [0:0]
def get_observation(self):
no = self.next_obstacle_index()
if no < len(self.obstacle_pos):
next_obstacle_type = self.obstacle_type[no]
xpos = self.robot_pos[0]
nm = self.p.named.model
if next_obstacle_type == 0:
next_obstacle_d = nm.geom_pos[f'hurdle-{no}'][0] - xpos
next_obstacle_h = nm.geom_pos[f'hurdle-{no}'][2] * 2
else:
next_obstacle_d = nm.geom_pos[f'bar-{no}'][0] - xpos
next_obstacle_h = (
nm.geom_pos[f'bar-{no}'][2] + nm.geom_size[f'bar-{no}'][0]
)
else:
next_obstacle_d = 10.0
next_obstacle_h = 0.1
next_obstacle_cleared = no < self.max_obstacles_cleared
return {
'observation': super().get_observation(),
'next_obstacle': np.array(
[
next_obstacle_type,
next_obstacle_d,
next_obstacle_h,
not next_obstacle_cleared,
]
),
}