Implementation of Pendulum task. More...
Classes | |
| struct | Action |
| Implementation of action of Pendulum. More... | |
| class | State |
| Implementation of state of Pendulum. More... | |
Public Member Functions | |
| Pendulum (const double maxAngularVelocity=8, const double maxTorque=2.0, const double dt=0.05) | |
| Construct a Pendulum instance using the given values. More... | |
| double | AngleNormalize (double theta) const |
| This function calculates the normalized anlge for a particular theta. More... | |
| State | InitialSample () const |
| Initial theta is randomly generated within [-pi, pi]. More... | |
| double | Sample (const State &state, const Action &action, State &nextState) const |
| Dynamics of Pendulum. More... | |
| double | Sample (const State &state, const Action &action) const |
| Dynamics of Pendulum. More... | |
Implementation of Pendulum task.
The inverted pendulum swingup problem is a classic problem in the control literature. In this version of the problem, the pendulum starts in a random position, and the goal is to swing it up so it stays upright
Definition at line 30 of file pendulum.hpp.
|
inline |
Construct a Pendulum instance using the given values.
| maxAngularVelocity | Maximum angular velocity. |
| maxTorque | Maximum torque. |
| dt | The differential value. |
Definition at line 97 of file pendulum.hpp.
|
inline |
This function calculates the normalized anlge for a particular theta.
| theta | The un-normalized angle. |
Definition at line 180 of file pendulum.hpp.
References M_PI.
Referenced by Pendulum::Sample().
|
inline |
Initial theta is randomly generated within [-pi, pi].
Initial angular velocity is randomly generated within [-1, 1].
Definition at line 167 of file pendulum.hpp.
References Pendulum::State::AngularVelocity(), M_PI, mlpack::math::Random(), and Pendulum::State::Theta().
Dynamics of Pendulum.
Get reward and next state based on current state and current action.
| state | The current state. |
| action | The current action. |
| nextState | The next state. |
Definition at line 114 of file pendulum.hpp.
References Pendulum::Action::action, Pendulum::AngleNormalize(), Pendulum::State::AngularVelocity(), M_PI, and Pendulum::State::Theta().
Referenced by Pendulum::Sample().
Dynamics of Pendulum.
Get reward based on current state and current action
| state | The current state. |
| action | The current action. |
Definition at line 155 of file pendulum.hpp.
References Pendulum::Sample().