upkie 9.0.0
Open-source wheeled biped robots
Loading...
Searching...
No Matches
UpkiePendulum Class Reference

Wrapper to make Upkie act as a wheeled inverted pendulum. More...

Public Member Functions

def __init__ (self, UpkieEnv env, float fall_pitch=1.0, bool left_wheeled=True, float max_ground_velocity=1.0)
 Initialize environment. More...
 
Tuple[np.ndarray, Dict] reset (self, *Optional[int] seed=None, Optional[dict] options=None)
 Resets the environment and get an initial observation. More...
 
Tuple[np.ndarray, float, bool, bool, dict] step (self, np.ndarray action)
 Run one timestep of the environment's dynamics. More...
 

Public Attributes

 observation_space
 Observation space.
 
 action_space
 Action space.
 
 env
 Internal upkie.envs.upkie_env.UpkieEnv environment.
 
 fall_pitch
 Fall detection pitch angle, in radians.
 
 left_wheeled
 Set to True (default) if the robot is left wheeled, that is, a positive turn of the left wheel results in forward motion. More...
 
 wheel_radius
 Robot wheel radius in meters.
 

Detailed Description

Wrapper to make Upkie act as a wheeled inverted pendulum.

When this wrapper is applied, Upkie keeps its legs straight and actions only affect wheel velocities. This way, it behaves like a wheeled inverted pendulum.

Note
For reinforcement learning with neural-network policies: the observation space and action space are not normalized.

Action space

The action corresponds to the ground velocity resulting from wheel velocities. The action vector is simply:

\[ a =\begin{bmatrix} \dot{p}^* \end{bmatrix} \]

where we denote by \(\dot{p}^*\) the commanded ground velocity in m/s, which is internally converted into wheel velocity commands. Note that, while this action is not normalized, [-1, 1] m/s is a reasonable range for ground velocities.

Observation space

Vectorized observations have the following structure:

\[ \begin{align*} o &= \begin{bmatrix} \theta \\ p \\ \dot{\theta} \\ \dot{p} \end{bmatrix} \end{align*} \]

where we denote by:

  • \(\theta\) the pitch angle of the base with respect to the world vertical, in radians. This angle is positive when the robot leans forward.
  • \(p\) the position of the average wheel contact point, in meters.
  • \(\dot{\theta}\) the body angular velocity of the base frame along its lateral axis, in radians per seconds.
  • \(\dot{p}\) the velocity of the average wheel contact point, in meters per seconds.

As with all Upkie environments, full observations from the spine (detailed in Observations) are also available in the info dictionary returned by the reset and step functions.


The documentation for this class was generated from the following file: