def basic_task(): """ A simple task involving initing a JSBSimInstance to test multiprocessing. """ model = aircraft.cessna172P time.sleep(0.05) fdm = Simulation(aircraft=model) fdm.run() time.sleep(0.05) return 0
def task_step(self, sim: Simulation, action: Sequence[float], sim_steps: int) \ -> Tuple[NamedTuple, float, bool, Dict]: # input actions for prop, command in zip(self.action_variables, action): sim[prop] = command # run simulation for _ in range(sim_steps): sim.run() self._update_custom_properties(sim) state = self.State(*(sim[prop] for prop in self.state_variables)) done = self._is_terminal(sim) reward = self._get_reward(state, sim) if self.debug: self._validate_state(state, done, action, reward) self._store_reward(reward, sim) self.last_state = state info = {'reward': reward, 'action': action} return state, reward, done, info