(self, input_data, timestamp)
| 165 | return steer, throttle, brake, target_speed |
| 166 | |
| 167 | def run_step(self, input_data, timestamp): |
| 168 | if not self.initialized: |
| 169 | self._init() |
| 170 | |
| 171 | # change weather for visual diversity |
| 172 | if self.step % 10 == 0: |
| 173 | index = random.choice(range(len(WEATHERS))) |
| 174 | self.weather_id = WEATHERS_IDS[index] |
| 175 | weather = WEATHERS[WEATHERS_IDS[index]] |
| 176 | print (self.weather_id, weather) |
| 177 | self._world.set_weather(weather) |
| 178 | |
| 179 | data = self.tick(input_data) |
| 180 | gps = self._get_position(data) |
| 181 | |
| 182 | near_node, near_command = self._waypoint_planner.run_step(gps) |
| 183 | far_node, far_command = self._command_planner.run_step(gps) |
| 184 | |
| 185 | steer, throttle, brake, target_speed = self._get_control(near_node, far_node, data) |
| 186 | |
| 187 | control = carla.VehicleControl() |
| 188 | control.steer = steer + 1e-2 * np.random.randn() |
| 189 | control.throttle = throttle |
| 190 | control.brake = float(brake) |
| 191 | |
| 192 | if self.step % 10 == 0 and self.save_path is not None: |
| 193 | self.save(near_node, far_node, near_command, steer, throttle, brake, target_speed, data) |
| 194 | |
| 195 | return control |
| 196 | |
| 197 | def _should_brake(self): |
| 198 | actors = self._world.get_actors() |
nothing calls this directly
no test coverage detected