nonholonomic#
Nonholonomic vehicle system.
- class gym_socks.envs.nonholonomic.NonholonomicVehicleEnv(*args, **kwargs)[source]#
Nonholonomic vehicle system.
Bases:
gym_socks.envs.dynamical_system.DynamicalSystemA nonholonomic vehicle (car-like) is typically modeled using what are known as “unicycle” dynamics. It is useful for modeling vehicles which can move forward and backward, and incorporates a steering angle or heading. The inputs are the velocity and change in steering angle.
- action_space = None#
The action (input) space of the system.
- close()[source]#
Override close in your subclass to perform any necessary cleanup.
Environments will automatically
close()themselves when garbage collected or when the program exits.
- cost(time, state, action)[source]#
Cost function for the system.
Warning
This function is typically not used in SOCKS, but is included here for compatibility with OpenAI gym, which returns the cost from the
step()function.
- dynamics(time, state, action, disturbance)[source]#
Dynamics for the system.
\[\dot{x} = f(x, u, w)\]- Parameters
time – The time variable.
state – The state of the system at the current time step.
action – The control action applied at the current time step.
disturbance – A realization of a random variable representing process noise.
- Returns
The state of the system at the next time step.
- generate_disturbance(time, state, action)[source]#
Generate a disturbance.
Note
Override
generate_disturbance()in subclasses to modify the disturbance properties, such as the scale or distribution.
- generate_observation(time, state, action)[source]#
Generate an observation from the system.
\[y = h(x, u, v)\]- Parameters
time – The time variable.
state – The state of the system at the current time step.
action – The control action applied at the current time step.
- Returns
An observation of the system at the current time step.
Note
Override
generate_observation()in subclasses if the system is partially observable. By default, the function returns the system state directly, meaning it is fully observable.
- property np_random#
Random number generator.
- observation_space = None#
The space of system observations.
Note
The observation space typically only differs from the state space if the system is partially observable. If this is the case,
generate_observation()should be defined to return an element of the observation space.
- render(mode='human')[source]#
Renders the environment.
This method must be overridden in subclasses in order to enable rendering. Not all environments support rendering.
- Parameters
mode – the mode to render with
- property sampling_time#
Sampling time, in seconds.
- seed(seed=None)[source]#
Sets the seed of the random number generator.
- Parameters
seed – Integer value representing the random seed.
- Returns
The seed of the RNG.
- state_space = None#
The state space of the system.
Note
By convention, in controls theory the state space of the system is the set of all possible states that the system can have. OpenAI Gym’s convention is to ignore the underlying state space, opting to use only the
observation_space.
- step(action, time=0)[source]#
Advances the system forward one time step.
- Parameters
time – Time of the simulation. Used primarily for time-varying systems.
action – Action (input) applied to the system at the current time step.
- Returns
A tuple
(obs, cost, done, info), whereobsis the observation vector. Generally, it is the state of the system corrupted by some measurement noise. If the system is fully observable, this is the actual state of the system at the next time step.costis the cost (reward) obtained by the system for taking action u in state x and transitioning to state y. In general, this is not typically used withDynamicalSystemmodels.doneis a flag to indicate the simulation has terminated. Usually toggled by guard conditions, which terminates the simulation if the system violates certain operating constraints.infois a dictionary containing extra information.