def draw_everything(self, cr): sim_state = self.input.boot_obs map_width = self.config.width map_height = self.config.height plotting_params = self.config.plotting_params with cairo_save(cr): cr.rectangle(0, 0, map_width, map_height) cr.clip() # TODO: implement trace vehicles_cairo_display_all(cr, map_width, map_height, sim_state, **plotting_params)
def draw_everything(self, cr): boot_obs = self.input.boot_obs if 'id_episode' in boot_obs: id_episode = boot_obs['id_episode'].item() else: id_episode = '' id_vehicle = boot_obs['id_robot'].item() if 'extra' in boot_obs: extra = boot_obs['extra'].item() else: extra = {} def extra_draw_world(cr): if 'servonav' in extra: plot_servonave(cr, extra['servonav']) if 'servoing_poses' in extra: plot_servoing_poses(cr, extra['servoing_poses']) plotting_params = self.config.plotting_params plotting_params['extra_draw_world'] = extra_draw_world sidebar_params = self.config.sidebar_params # todo: check sim_state = extra['robot_state'] observations_values = boot_obs['observations'] commands = boot_obs['commands'] commands_source = boot_obs['commands_source'].item() timestamp = boot_obs['time_from_episode_start'].item() with cairo_save(cr): if self.config.display_sidebar: padding = 0.03 * self.config.width map_width = self.config.width - 2 * padding map_height = self.config.height - 2 * padding cr.translate(padding, padding) else: map_width = self.config.width map_height = self.config.height with cairo_save(cr): cr.rectangle(0, 0, map_width, map_height) cr.clip() # TODO: implement trace vehicles_cairo_display_all(cr, map_width, map_height, sim_state, **plotting_params) if self.config.display_sidebar: cr.set_line_width(1) cr.set_source_rgb(0, 0, 0) cr.rectangle(0, 0, map_width, map_height) cr.stroke() if self.config.display_sidebar: with cairo_transform(cr, t=[self.config.width, 0]): create_sidebar(cr, width=self.config.sidebar_width, height=self.config.height, sim_state=sim_state, id_vehicle=id_vehicle, id_episode=id_episode, timestamp=timestamp, observations_values=observations_values, commands_values=commands, commands_source=commands_source, **sidebar_params)