Skip to content

Commit

Permalink
Add robot pose and action to simulation view text
Browse files Browse the repository at this point in the history
  • Loading branch information
ll7 committed Mar 28, 2024
1 parent 250dafa commit ad87195
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions robot_sf/render/sim_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def render(self, state: VisualizableSimState):
self._draw_pedestrians(state.pedestrian_positions)
self._draw_robot(state.robot_pose)
self._augment_timestep(state.timestep)
self._add_text(state.timestep)
self._add_text(state.timestep, state)

# update the display
pygame.display.update()
Expand Down Expand Up @@ -351,12 +351,14 @@ def _augment_timestep(self, timestep: int):
text_surface = self.font.render(text, False, TEXT_COLOR)
self.screen.blit(text_surface, self.timestep_text_pos)

def _add_text(self, timestep: int):
def _add_text(self, timestep: int, state: VisualizableSimState):
text_lines = [
f'step: {timestep}',
f'scaling: {self.scaling}',
f'x-offset: {self.offset[0]/self.scaling:.2f}',
f'y-offset: {self.offset[1]/self.scaling:.2f}'
f'y-offset: {self.offset[1]/self.scaling:.2f}',
f'RobotPose: {state.robot_pose}',
f'RobotAction: {state.action.robot_action}'
]
for i, text in enumerate(text_lines):
text_surface = self.font.render(text, False, TEXT_COLOR)
Expand Down

0 comments on commit ad87195

Please sign in to comment.