Dynamics¶
Dynamics¶
-
class
gym_collision_avoidance.envs.dynamics.Dynamics.
Dynamics
(agent)¶ Class to convert an agent’s action to change in state
There is a fundamental issue in passing the agent to the Dynamics. There should be a State object or something like that.
Parameters: agent – ( Agent
) the Agent whose state should be updated-
step
(action, dt)¶ Dummy method to be implemented by each Dynamics subclass
-
update_ego_frame
()¶ Update agent’s heading and velocity by converting those values from the global to ego frame.
This should be run every time
step
is called (add tostep
?)
-
UnicycleDynamics¶
-
class
gym_collision_avoidance.envs.dynamics.UnicycleDynamics.
UnicycleDynamics
(agent)¶ Convert a speed & heading to a new state according to Unicycle Kinematics model.
-
step
(action, dt)¶ In the global frame, assume the agent instantaneously turns by
heading
and moves forward atspeed
fordt
seconds. Add that offset to the current position. Update the velocity in the same way. Also update the agent’s turning direction (only used by CADRL).Parameters: - action (list) – [delta heading angle, speed] command for this agent
- dt (float) – time in seconds to execute
action
-
UnicycleDynamicsMaxTurnRate¶
-
class
gym_collision_avoidance.envs.dynamics.UnicycleDynamicsMaxTurnRate.
UnicycleDynamicsMaxTurnRate
(agent)¶ Convert a speed & heading to a new state according to Unicycle Kinematics model, but limit the maximum turning rate.
max_turn_rate is currently hard-coded to 3 rad/s…
-
step
(action, dt)¶ The desired change in heading divided by dt is the desired turning rate. Clip this to remain within plus/minus max_turn_rate. Then, propagate using the UnicycleDynamics model instead. Should update this to call UnicycleDynamics’s step instead of re-writing.
Parameters: - action (list) – [delta heading angle, speed] command for this agent
- dt (float) – time in seconds to execute
action
-