(self, obz, reward, done)
| 60 | self.sess = None |
| 61 | |
| 62 | def act(self, obz, reward, done): |
| 63 | if obz is not None: |
| 64 | log.debug('steering %r', obz['steering']) |
| 65 | log.debug('throttle %r', obz['throttle']) |
| 66 | obz = self.preprocess_obz(obz) |
| 67 | |
| 68 | if self.should_record_recovery_from_random_actions: |
| 69 | action = self.toggle_random_action() |
| 70 | self.action_count += 1 |
| 71 | elif self.net is not None: |
| 72 | if obz is None or not obz['cameras']: |
| 73 | y = None |
| 74 | else: |
| 75 | image = obz['cameras'][0]['image'] |
| 76 | y = self.get_net_out(image) |
| 77 | action = self.get_next_action(obz, y) |
| 78 | else: |
| 79 | action = Action(has_control=(not self.path_follower_mode)) |
| 80 | |
| 81 | self.previous_action = action |
| 82 | self.step += 1 |
| 83 | |
| 84 | if obz and obz['is_game_driving'] == 1 and self.should_record: |
| 85 | self.obz_recording.append(obz) |
| 86 | # utils.save_camera(obz['cameras'][0]['image'], obz['cameras'][0]['depth'], |
| 87 | # os.path.join(self.sess_dir, str(self.total_obz).zfill(10))) |
| 88 | self.recorded_obz_count += 1 |
| 89 | else: |
| 90 | log.debug('Not recording frame') |
| 91 | |
| 92 | self.maybe_save() |
| 93 | |
| 94 | action = action.as_gym() |
| 95 | return action |
| 96 | |
| 97 | def get_next_action(self, obz, y): |
| 98 | log.debug('getting next action') |
no test coverage detected