upkie 6.1.0
Open-source wheeled biped robots
Loading...
Searching...
No Matches
upkie.utils.robot_state_randomization.RobotStateRandomization Class Reference

Domain randomization parameters for Upkie's state. More...

Public Member Functions

def __init__ (self, float roll=0.0, float pitch=0.0, float x=0.0, float z=0.0, float omega_x=0.0, float omega_y=0.0, Optional[np.ndarray] linear_velocity=None)
 Initialize sampler. More...
 
None update (self, Optional[float] roll=None, Optional[float] pitch=None, Optional[float] x=None, Optional[float] z=None, Optional[float] omega_x=None, Optional[float] omega_y=None, Optional[float] v_x=None, Optional[float] v_z=None)
 Update some fields. More...
 
ScipyRotation sample_orientation (self, np.random.Generator np_random)
 Sample an orientation within the given bounds. More...
 
np.ndarray sample_position (self, np.random.Generator np_random)
 Sample a position within the given bounds. More...
 
np.ndarray sample_angular_velocity (self, np.random.Generator np_random)
 Sample an angular velocity within the given bounds. More...
 
np.ndarray sample_linear_velocity (self, np.random.Generator np_random)
 Sample a linear velocity within the given bounds. More...
 

Public Attributes

 roll
 Amount of roll angle randomization, in radians.
 
 pitch
 Amount of pitch angle randomization, in radians.
 
 x
 Amount of x-axis position randomization, in meters.
 
 z
 Amount of z-axis position randomization, in meters.
 
 omega_x
 Amount of x-axis randomization on the angular-velocity vector, in rad/s.
 
 omega_y
 Amount of y-axis randomization on the angular-velocity vector, in rad/s.
 
 linear_velocity
 Magnitude of linear velocity randomization, as a 3D vector in m/s.
 

Detailed Description

Domain randomization parameters for Upkie's state.

Note
The API for this class is likely to change. Initially all its attributes where floating-point numbers due to a quick-and-dirty design decision.

Constructor & Destructor Documentation

◆ __init__()

def upkie.utils.robot_state_randomization.RobotStateRandomization.__init__ (   self,
float   roll = 0.0,
float   pitch = 0.0,
float   x = 0.0,
float   z = 0.0,
float   omega_x = 0.0,
float   omega_y = 0.0,
Optional[np.ndarray]   linear_velocity = None 
)

Initialize sampler.

Parameters
rollAmount of roll angle randomization, in radians.
pitchAmount of pitch angle randomization, in radians.
xAmount of x-axis position randomization, in meters.
zAmount of z-axis position randomization, in meters.
omega_xAmount of x-axis randomization on the angular-velocity vector, in rad/s.
omega_yAmount of y-axis randomization on the angular-velocity vector, in rad/s.
linear_velocityMagnitude of linear velocity randomization, as a 3D vector in m/s.

Member Function Documentation

◆ sample_angular_velocity()

np.ndarray upkie.utils.robot_state_randomization.RobotStateRandomization.sample_angular_velocity (   self,
np.random.Generator   np_random 
)

Sample an angular velocity within the given bounds.

Parameters
[in]np_randomNumPy random number generator.
Returns
Sampled angular-velocity vector.

◆ sample_linear_velocity()

np.ndarray upkie.utils.robot_state_randomization.RobotStateRandomization.sample_linear_velocity (   self,
np.random.Generator   np_random 
)

Sample a linear velocity within the given bounds.

Parameters
[in]np_randomNumPy random number generator.
Returns
Sampled linear-velocity vector.

◆ sample_orientation()

ScipyRotation upkie.utils.robot_state_randomization.RobotStateRandomization.sample_orientation (   self,
np.random.Generator   np_random 
)

Sample an orientation within the given bounds.

Parameters
[in]np_randomNumPy random number generator.
Returns
Sampled rotation matrix.

◆ sample_position()

np.ndarray upkie.utils.robot_state_randomization.RobotStateRandomization.sample_position (   self,
np.random.Generator  np_random 
)

Sample a position within the given bounds.

Parameters
[in]np_randomNumPy random number generator.
Returns
Sampled position vector.

◆ update()

None upkie.utils.robot_state_randomization.RobotStateRandomization.update (   self,
Optional[float]   roll = None,
Optional[float]   pitch = None,
Optional[float]   x = None,
Optional[float]   z = None,
Optional[float]   omega_x = None,
Optional[float]   omega_y = None,
Optional[float]   v_x = None,
Optional[float]   v_z = None 
)

Update some fields.

Parameters
rollRoll angle for the rotation from the randomized frame to the parent frame (Euler Z-Y-X convention).
pitchPitch angle for the rotation from the randomized frame to the parent frame (Euler Z-Y-X convention).
xTranslation of the randomized frame along the x-axis of the parent frame.
zTranslation of the randomized frame along the z-axis of the parent frame.
omega_xAngular velocity from the randomized frame to the parent frame, expressed in the randomized frame, along the x-axis.
omega_yAngular velocity from the randomized frame to the parent frame, expressed in the randomized frame, along the y-axis.
v_xLinear velocity from the randomized frame to the parent frame, expressed in the parent frame and along the x-axis.
v_zLinear velocity from the randomized frame to the parent frame, expressed in the parent frame and along the z-axis.

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