mdp
Modules:
| Name | Description |
|---|---|
actions |
|
commands |
|
events |
|
observations |
|
rewards |
|
Classes:
| Name | Description |
|---|---|
FlightActionMapper |
Map batched normalized actions into controller targets, wrench, or RPM. |
FlightMappingConfig |
Mapping-range configuration for normalized action scaling. |
Mixer |
Map batched thrust and moment demands to rotor speed commands. |
VehicleParams |
Generic multi-rotor vehicle physics. |
RotorDynamics |
Batched motor dynamics model for rotor thrust and torque. |
FlightControlAction |
Body torque control action term. |
FlightControlActionCfg |
See :class: |
UniformPoseCommandGlobal |
Command generator that generates pose commands containing a 3-D position and heading. |
UniformPoseCommandGlobalCfg |
Configuration for the uniform 3D-pose command generator. |
Functions:
| Name | Description |
|---|---|
randomize_action_term_attr |
Randomize a selected action-term attribute. |
randomize_controller_params |
Randomize controller gains and command limits attached to an action term. |
randomize_mixer_params |
Randomize mixer parameters attached to an action term. |
randomize_rotor_params |
Randomize rotor parameters attached to an action term. |
randomize_mapping_params |
Randomize action-mapper runtime parameters attached to an action term. |
root_euler_w |
Euler angles of the root in world frame. |
lin_vel_l2 |
Penalize base linear velocity using L2 squared kernel. |
ang_vel_l2 |
Penalize base angular velocity using L2 squared kernel. |
pos_error_l2 |
Penalize asset pos from its target pos using L2 squared kernel. |
pos_error_tanh |
Penalize asset pos from its target pos using tanh kernel. |
yaw_error_l2 |
Penalize heading error from target heading using L2 squared kernel. |
yaw_error_tanh |
Penalize heading error from target heading using tanh kernel. |
FlightActionMapper
FlightActionMapper(control_mode: str, params: VehicleParams = VehicleParams(), mapping: FlightMappingConfig | None = None, control_mask: dict | None = None, num_envs: int = 1, device=None, *, backend: BackendName | None = None, xp: ModuleType | None = None)
Map batched normalized actions into controller targets, wrench, or RPM.
Initialize the batched action mapper and backend namespace.
Methods:
| Name | Description |
|---|---|
randomize |
Randomize. |
action_to_collective_acc |
Action to collective acc. |
collective_acc_to_thrust |
Collective acc to thrust. |
action_to_collective_thrust |
Action to collective thrust. |
decode_action |
Decode normalized batched action into a runtime-neutral control request. |
map_action |
Resolve normalized batched action into simulation rotor RPM commands. |
Attributes:
| Name | Type | Description |
|---|---|---|
requires_controller |
bool
|
Requires controller. |
requires_controller
property
requires_controller: bool
Requires controller.
randomize
randomize(env_ids=None, randomization: dict | None = None)
Randomize.
action_to_collective_acc
action_to_collective_acc(action: ArrayLike, mixer) -> ArrayLike
Action to collective acc.
collective_acc_to_thrust
collective_acc_to_thrust(collective_acc: ArrayLike) -> ArrayLike
Collective acc to thrust.
action_to_collective_thrust
action_to_collective_thrust(action: ArrayLike, mixer) -> ArrayLike
Action to collective thrust.
decode_action
decode_action(action: ArrayLike, mixer, *, state: ControllerState | None = None) -> FlightMapping
Decode normalized batched action into a runtime-neutral control request.
map_action
map_action(action: ArrayLike, mixer, *, state: ControllerState | None = None, flight_controller: ControllerBase | None = None) -> FlightMapping
Resolve normalized batched action into simulation rotor RPM commands.
FlightMappingConfig
dataclass
FlightMappingConfig(velocity_range: tuple[float, float, float] | None = None, acceleration_range: tuple[float, float, float] | None = None, attitude_range: tuple[float, float, float] | None = None, body_rate_range: tuple[float, float, float] | None = (2.0, 2.0, 2.0), rel_rotation: bool = False, rotation_step_len: float | None = None)
Mapping-range configuration for normalized action scaling.
Methods:
| Name | Description |
|---|---|
from_params |
Build mapping ranges from vehicle parameters. |
resolve |
Resolve config overrides into concrete mapping ranges. |
from_params
classmethod
from_params(params: VehicleParams) -> FlightMappingConfig
Build mapping ranges from vehicle parameters.
resolve
resolve(params: VehicleParams) -> FlightMappingConfig
Resolve config overrides into concrete mapping ranges.
Mixer
Mixer(params: VehicleParams = VehicleParams(), num_envs: int = 1, device=None, *, backend: BackendName | None = None, xp: ModuleType | None = None, allocation_mode: Literal['pinv', 'saturation'] = 'pinv')
Map batched thrust and moment demands to rotor speed commands.
The default "pinv" allocator applies direct pseudo-inverse allocation.
"saturation" enables a staged trim strategy: roll/pitch authority is
trimmed first if needed, and yaw authority is allocated from the remaining
rotor-speed margin.
Initialize the mixer matrix and backend namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
VehicleParams
|
Vehicle parameters used to build the allocation matrix. |
VehicleParams()
|
|
int
|
Number of parallel environments represented by the batch. |
1
|
|
Optional backend device, mainly used by Torch. |
None
|
|
|
BackendName | None
|
Explicit Array API backend. If omitted, NumPy is used when
|
None
|
|
ModuleType | None
|
Pre-resolved Array API namespace. Overrides |
None
|
|
Literal['pinv', 'saturation']
|
|
'pinv'
|
Methods:
| Name | Description |
|---|---|
randomize |
Randomize mixer parameters for selected environments. |
calculate_rotor_commands |
Allocate |
randomize
randomize(env_ids=None, randomization: dict | None = None)
Randomize mixer parameters for selected environments.
calculate_rotor_commands
calculate_rotor_commands(control: ArrayLike) -> ArrayLike
Allocate [thrust, roll, pitch, yaw] controls to rotor RPM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ArrayLike
|
Batched control array with shape |
required |
Returns:
| Type | Description |
|---|---|
ArrayLike
|
Batched rotor speed magnitudes with shape |
VehicleParams
dataclass
VehicleParams(*, rho: float = 1.184, g: float = 9.81, sim_dt: float = 0.01, step_dt: float = 0.01, randomization: dict[str, dict[str, tuple[float, float]]] = dict(), mass: float = 2.1, inertia: list = (lambda: [[0.015, 0.0, 0.0], [0.0, 0.0348, 0.0], [0.0, 0.0, 0.042503]])(), x: float = 0.0952, y: float = 0.114423, h: float = -0.0125, alpha: float = math.radians(8.0), diameter: float = 0.476, Cdx: float = 0.5, r_p: float = 0.0775, Ct: float = 0.666, Cq: float = 0.0716, theta0: float = math.radians(14.6), thetaTip: float = math.radians(6.8), theta1: float = math.nan, lock: float = 0.6051, cT: float = math.nan, cM: float = math.nan, spin_dir: tuple[float, float, float, float] = (1.0, 1.0, -1.0, -1.0), tau_f: float = 0.01, tau_m: float = 0.05, max_rpm: float = 10000.0, init_rpm: float = math.nan, rotor_rpm_rate_limit: float = 50000.0, tau_up: float = math.nan, tau_down: float = math.nan, mpc_xy_vel_max: float = 12.0, mpc_z_vel_max_up: float = 3.0, mpc_z_vel_max_dn: float = 1.5, mpc_acc_hor_max: float = 5.0, mpc_acc_up_max: float = 4.0, mpc_acc_down_max: float = 3.0, mpc_man_tilt_max: float = math.radians(35.0), mc_rollrate_max: float = math.radians(220.0), mc_pitchrate_max: float = math.radians(220.0), mc_yawrate_max: float = math.radians(200.0))
Generic multi-rotor vehicle physics.
The base class carries LAV2-compatible defaults for the shared multi-rotor
parameters so that VehicleParams() continues to produce a working
LAV2-flavoured flight configuration (without track / airframe specifics).
Concrete subclasses add robot-specific locomotion and geometry:
TrackVehicleParams— LAV2: tracked ground locomotion + ducted airframeTiltWheelVehicleParams— ATMO: tilting arms + two side motors whose belt transmissions synchronize four wheel shells
Methods:
| Name | Description |
|---|---|
__post_init__ |
Calculate derived parameters and resolve default sentinels. |
Attributes:
| Name | Type | Description |
|---|---|---|
rho |
float
|
Air density (kg/m³). |
g |
float
|
Gravitational acceleration (m/s²). |
sim_dt |
float
|
Simulation time step (s). |
step_dt |
float
|
Control time step (s). |
randomization |
dict[str, dict[str, tuple[float, float]]]
|
Per-component parameter-randomisation scale ranges. |
mass |
float
|
Total vehicle mass (kg — LAV2 default; override for other robots). |
inertia |
list
|
Inertia matrix (kg*m^2). |
x |
float
|
Arm length in x — rotor moment-arm for roll (m). |
y |
float
|
Arm length in y — rotor moment-arm for pitch (m). |
h |
float
|
CG height below rotor plane (m, negative = below). |
alpha |
float
|
Duct / rotor cant angle about y-axis (rad — 0 for flat rotors like ATMO). |
diameter |
float
|
Overall vehicle diameter (m). |
Cdx |
float
|
Body drag coefficient. |
r_p |
float
|
Propeller radius (m). |
Ct |
float
|
Thrust coefficient (blade-element). |
Cq |
float
|
Torque coefficient (blade-element). |
theta0 |
float
|
Blade root pitch angle (rad). |
thetaTip |
float
|
Blade tip pitch angle (rad). |
theta1 |
float
|
Blade twist (rad), defaults to theta0 - thetaTip. |
lock |
float
|
Lock number. |
cT |
float
|
Thrust coefficient T = cT·rpm² (N / rpm²); defaults from Ct. |
cM |
float
|
Reaction-torque coefficient M = cM·rpm² (N·m / rpm²); defaults from Cq. |
spin_dir |
tuple[float, float, float, float]
|
Rotor spin direction signs; + means clockwise, - means counter-clockwise. |
tau_f |
float
|
Motor filter time constant (s). |
tau_m |
float
|
Legacy motor time constant (s). |
max_rpm |
float
|
Maximum rotor speed (rpm — LAV2 default). |
init_rpm |
float
|
Initial rotor speed — defaults to 0.2·max_rpm. |
rotor_rpm_rate_limit |
float
|
Rotor-speed rate-of-change limit (rpm/s). |
tau_up |
float
|
Motor spin-up time constant (s), defaults to tau_m. |
tau_down |
float
|
Motor spin-down time constant (s), defaults to tau_m. |
mpc_xy_vel_max |
float
|
Maximum horizontal velocity setpoint magnitude in m/s (0 - 20). |
mpc_z_vel_max_up |
float
|
Maximum upward velocity setpoint in m/s (0.5 - 8). |
mpc_z_vel_max_dn |
float
|
Maximum downward velocity setpoint magnitude in m/s (0.5 - 4). |
mpc_acc_hor_max |
float
|
Maximum horizontal acceleration setpoint magnitude in m/s^2 (2 - 15). |
mpc_acc_up_max |
float
|
Maximum upward acceleration setpoint in m/s^2 (2 - 15). |
mpc_acc_down_max |
float
|
Maximum downward acceleration setpoint magnitude in m/s^2 (2 - 15). |
mpc_man_tilt_max |
float
|
Maximum manual tilt angle in radians (deg: 0 - 90). |
mc_rollrate_max |
float
|
Maximum roll-rate setpoint in rad/s (deg/s: 0 - 1800). |
mc_pitchrate_max |
float
|
Maximum pitch-rate setpoint in rad/s (deg/s: 0 - 1800). |
mc_yawrate_max |
float
|
Maximum yaw-rate setpoint in rad/s (deg/s: 0 - 1800). |
rho
class-attribute
instance-attribute
rho: float = 1.184
Air density (kg/m³).
g
class-attribute
instance-attribute
g: float = 9.81
Gravitational acceleration (m/s²).
sim_dt
class-attribute
instance-attribute
sim_dt: float = 0.01
Simulation time step (s).
step_dt
class-attribute
instance-attribute
step_dt: float = 0.01
Control time step (s).
randomization
class-attribute
instance-attribute
randomization: dict[str, dict[str, tuple[float, float]]] = field(default_factory=dict)
Per-component parameter-randomisation scale ranges.
mass
class-attribute
instance-attribute
mass: float = 2.1
Total vehicle mass (kg — LAV2 default; override for other robots).
inertia
class-attribute
instance-attribute
inertia: list = field(default_factory=lambda: [[0.015, 0.0, 0.0], [0.0, 0.0348, 0.0], [0.0, 0.0, 0.042503]])
Inertia matrix (kg*m^2).
x
class-attribute
instance-attribute
x: float = 0.0952
Arm length in x — rotor moment-arm for roll (m).
y
class-attribute
instance-attribute
y: float = 0.114423
Arm length in y — rotor moment-arm for pitch (m).
h
class-attribute
instance-attribute
h: float = -0.0125
CG height below rotor plane (m, negative = below).
alpha
class-attribute
instance-attribute
alpha: float = math.radians(8.0)
Duct / rotor cant angle about y-axis (rad — 0 for flat rotors like ATMO).
diameter
class-attribute
instance-attribute
diameter: float = 0.476
Overall vehicle diameter (m).
Cdx
class-attribute
instance-attribute
Cdx: float = 0.5
Body drag coefficient.
r_p
class-attribute
instance-attribute
r_p: float = 0.0775
Propeller radius (m).
Ct
class-attribute
instance-attribute
Ct: float = 0.666
Thrust coefficient (blade-element).
Cq
class-attribute
instance-attribute
Cq: float = 0.0716
Torque coefficient (blade-element).
theta0
class-attribute
instance-attribute
theta0: float = math.radians(14.6)
Blade root pitch angle (rad).
thetaTip
class-attribute
instance-attribute
thetaTip: float = math.radians(6.8)
Blade tip pitch angle (rad).
theta1
class-attribute
instance-attribute
theta1: float = math.nan
Blade twist (rad), defaults to theta0 - thetaTip.
lock
class-attribute
instance-attribute
lock: float = 0.6051
Lock number.
cT
class-attribute
instance-attribute
cT: float = math.nan
Thrust coefficient T = cT·rpm² (N / rpm²); defaults from Ct.
cM
class-attribute
instance-attribute
cM: float = math.nan
Reaction-torque coefficient M = cM·rpm² (N·m / rpm²); defaults from Cq.
spin_dir
class-attribute
instance-attribute
spin_dir: tuple[float, float, float, float] = (1.0, 1.0, -1.0, -1.0)
Rotor spin direction signs; + means clockwise, - means counter-clockwise.
LAV2 defaults to rotors 0/1 clockwise and 2/3 counter-clockwise, so the
signs are (+,+,-,-).
tau_f
class-attribute
instance-attribute
tau_f: float = 0.01
Motor filter time constant (s).
tau_m
class-attribute
instance-attribute
tau_m: float = 0.05
Legacy motor time constant (s).
max_rpm
class-attribute
instance-attribute
max_rpm: float = 10000.0
Maximum rotor speed (rpm — LAV2 default).
init_rpm
class-attribute
instance-attribute
init_rpm: float = math.nan
Initial rotor speed — defaults to 0.2·max_rpm.
rotor_rpm_rate_limit
class-attribute
instance-attribute
rotor_rpm_rate_limit: float = 50000.0
Rotor-speed rate-of-change limit (rpm/s).
tau_up
class-attribute
instance-attribute
tau_up: float = math.nan
Motor spin-up time constant (s), defaults to tau_m.
tau_down
class-attribute
instance-attribute
tau_down: float = math.nan
Motor spin-down time constant (s), defaults to tau_m.
mpc_xy_vel_max
class-attribute
instance-attribute
mpc_xy_vel_max: float = 12.0
Maximum horizontal velocity setpoint magnitude in m/s (0 - 20).
mpc_z_vel_max_up
class-attribute
instance-attribute
mpc_z_vel_max_up: float = 3.0
Maximum upward velocity setpoint in m/s (0.5 - 8).
mpc_z_vel_max_dn
class-attribute
instance-attribute
mpc_z_vel_max_dn: float = 1.5
Maximum downward velocity setpoint magnitude in m/s (0.5 - 4).
mpc_acc_hor_max
class-attribute
instance-attribute
mpc_acc_hor_max: float = 5.0
Maximum horizontal acceleration setpoint magnitude in m/s^2 (2 - 15).
mpc_acc_up_max
class-attribute
instance-attribute
mpc_acc_up_max: float = 4.0
Maximum upward acceleration setpoint in m/s^2 (2 - 15).
mpc_acc_down_max
class-attribute
instance-attribute
mpc_acc_down_max: float = 3.0
Maximum downward acceleration setpoint magnitude in m/s^2 (2 - 15).
mpc_man_tilt_max
class-attribute
instance-attribute
mpc_man_tilt_max: float = math.radians(35.0)
Maximum manual tilt angle in radians (deg: 0 - 90).
mc_rollrate_max
class-attribute
instance-attribute
mc_rollrate_max: float = math.radians(220.0)
Maximum roll-rate setpoint in rad/s (deg/s: 0 - 1800).
mc_pitchrate_max
class-attribute
instance-attribute
mc_pitchrate_max: float = math.radians(220.0)
Maximum pitch-rate setpoint in rad/s (deg/s: 0 - 1800).
mc_yawrate_max
class-attribute
instance-attribute
mc_yawrate_max: float = math.radians(200.0)
Maximum yaw-rate setpoint in rad/s (deg/s: 0 - 1800).
__post_init__
__post_init__()
Calculate derived parameters and resolve default sentinels.
RotorDynamics
RotorDynamics(params: VehicleParams = VehicleParams(), num_envs: int = 1, device=None, *, backend: BackendName | None = None, xp: ModuleType | None = None)
Bases: DynamicsBase
Batched motor dynamics model for rotor thrust and torque.
This is the backend-agnostic Array API implementation. It keeps
the same low-pass motor response, RPM rate limiting, quadratic thrust/torque
coefficients, and motor-direction torque signs while operating on
(num_envs, 4) batches.
See :mod:lav2.dynamics.numpy.rotor and :mod:lav2.dynamics.torch.rotor
for the legacy backend-specific implementations.
Initialize rotor dynamics and backend arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
VehicleParams
|
Vehicle parameters used by the motor model. |
VehicleParams()
|
|
int
|
Number of parallel environments represented by the batch. |
1
|
|
Optional backend device, mainly used by Torch. |
None
|
|
|
BackendName | None
|
Explicit Array API backend name. |
None
|
|
ModuleType | None
|
Pre-resolved Array API namespace. Overrides |
None
|
Methods:
| Name | Description |
|---|---|
randomize |
Randomize motor parameters for selected environments. |
update |
Update motor state and return thrust/torque outputs. |
reset |
Reset selected environments to initial rotor speeds. |
Attributes:
| Name | Type | Description |
|---|---|---|
params |
VehicleParams
|
Vehicle parameters for the dynamics model. |
params
instance-attribute
params: VehicleParams = params
Vehicle parameters for the dynamics model.
randomize
randomize(env_ids=None, randomization: dict[str, tuple[float, float]] | None = None)
Randomize motor parameters for selected environments.
update
update(commands: ArrayLike) -> ArrayLike
Update motor state and return thrust/torque outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ArrayLike
|
Desired rotor speeds with shape |
required |
Returns:
| Type | Description |
|---|---|
ArrayLike
|
Batched thrusts followed by torques with shape |
reset
reset(env_ids=None)
Reset selected environments to initial rotor speeds.
FlightControlAction
FlightControlAction(cfg: FlightControlActionCfg, env: ManagerBasedRlEnv)
Bases: ActionTerm
Body torque control action term.
This action term applies a wrench to the drone body frame based on action commands
Attributes:
| Name | Type | Description |
|---|---|---|
cfg |
FlightControlActionCfg
|
The configuration of the action term. |
cfg
instance-attribute
cfg: FlightControlActionCfg = cfg
The configuration of the action term.
FlightControlActionCfg
dataclass
FlightControlActionCfg(*, class_type: type[ActionTerm] = FlightControlAction, entity_name: str = 'robot', actuator_names: tuple[str, ...] = ('thrust0', 'thrust1', 'thrust2', 'thrust3', 'torque0', 'torque1', 'torque2', 'torque3'), params: VehicleParams = VehicleParams(), gains: dict | None = None, limits: dict | None = None, controller: str = 'FlightController', control_mode: str = 'cmd_motor_speeds', mapping: FlightMappingConfig = FlightMappingConfig())
Bases: ActionTermCfg
See :class:FlightControlAction for more details.
Attributes:
| Name | Type | Description |
|---|---|---|
class_type |
type[ActionTerm]
|
Class of the action term. |
entity_name |
str
|
Name of the asset in the environment for which the commands are generated. |
actuator_names |
tuple[str, ...]
|
Ordered rotor wrench actuator names matching |
params |
VehicleParams
|
Vehicle parameters. |
gains |
dict | None
|
Optional gains configuration for the flight controller. See FlightController for details. |
limits |
dict | None
|
Optional command-limit configuration passed directly to the flight controller. |
controller |
str
|
Controller class name. Options: 'FlightController' (PID), 'GeoControl'. |
control_mode |
str
|
Control mode, options: cmd_motor_thrusts, cmd_motor_speeds, cmd_ctbm, cmd_ctbr, cmd_ctatt, cmd_acc, cmd_vel, cmd_pos. |
mapping |
FlightMappingConfig
|
Action-mapping range overrides resolved against |
class_type
class-attribute
instance-attribute
class_type: type[ActionTerm] = FlightControlAction
Class of the action term.
entity_name
class-attribute
instance-attribute
entity_name: str = 'robot'
Name of the asset in the environment for which the commands are generated.
actuator_names
class-attribute
instance-attribute
actuator_names: tuple[str, ...] = ('thrust0', 'thrust1', 'thrust2', 'thrust3', 'torque0', 'torque1', 'torque2', 'torque3')
Ordered rotor wrench actuator names matching RotorDynamics.update() output.
params
class-attribute
instance-attribute
params: VehicleParams = field(default_factory=VehicleParams)
Vehicle parameters.
gains
class-attribute
instance-attribute
gains: dict | None = None
Optional gains configuration for the flight controller. See FlightController for details.
limits
class-attribute
instance-attribute
limits: dict | None = None
Optional command-limit configuration passed directly to the flight controller.
controller
class-attribute
instance-attribute
controller: str = 'FlightController'
Controller class name. Options: 'FlightController' (PID), 'GeoControl'.
control_mode
class-attribute
instance-attribute
control_mode: str = 'cmd_motor_speeds'
Control mode, options: cmd_motor_thrusts, cmd_motor_speeds, cmd_ctbm, cmd_ctbr, cmd_ctatt, cmd_acc, cmd_vel, cmd_pos.
rotorpy ref: - https://github.com/spencerfolk/rotorpy/blob/main/rotorpy/learning/quadrotor_environments.py#L319C1-L350C12 - https://github.com/spencerfolk/rotorpy/blob/main/rotorpy/vehicles/multirotor.py#L997
TODO: also align control modes with px4, see: https://docs.px4.io/v1.14/en/flight_modes/offboard
mapping
class-attribute
instance-attribute
mapping: FlightMappingConfig = field(default_factory=FlightMappingConfig)
Action-mapping range overrides resolved against params.
The default mapping is an intentional policy-facing behavior rather than a direct reflection of the parameter-derived controller ranges.
UniformPoseCommandGlobal
UniformPoseCommandGlobal(cfg: UniformPoseCommandGlobalCfg, env: ManagerBasedRlEnv)
Bases: CommandTerm
Command generator that generates pose commands containing a 3-D position and heading.
The command generator samples uniform 3D positions around the environment origin. The
heading command is either set to point towards the target or is sampled uniformly.
This can be configured through the :attr:UniformPoseCommandGlobalCfg.simple_heading
parameter in the configuration.
Initialize the command generator class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
UniformPoseCommandGlobalCfg
|
The configuration parameters for the command generator. |
required |
|
ManagerBasedRlEnv
|
The environment object. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
cfg |
UniformPoseCommandGlobalCfg
|
Configuration for the command generator. |
command |
Tensor
|
The desired 3D-pose in base frame. Shape is (num_envs, 4). |
cfg
instance-attribute
cfg: UniformPoseCommandGlobalCfg
Configuration for the command generator.
command
property
command: Tensor
The desired 3D-pose in base frame. Shape is (num_envs, 4).
UniformPoseCommandGlobalCfg
dataclass
UniformPoseCommandGlobalCfg(*, class_type: type = UniformPoseCommandGlobal, entity_name: str, simple_heading: bool, ranges: Ranges, viz: VizCfg = VizCfg())
Bases: CommandTermCfg
Configuration for the uniform 3D-pose command generator.
Classes:
| Name | Description |
|---|---|
Ranges |
Uniform distribution ranges for the position commands. |
Attributes:
| Name | Type | Description |
|---|---|---|
entity_name |
str
|
Name of the asset in the environment for which the commands are generated. |
simple_heading |
bool
|
Whether to use simple heading or not. |
ranges |
Ranges
|
Distribution ranges for the position commands. |
entity_name
instance-attribute
entity_name: str
Name of the asset in the environment for which the commands are generated.
simple_heading
instance-attribute
simple_heading: bool
Whether to use simple heading or not.
If True, the heading is in the direction of the target position.
ranges
instance-attribute
ranges: Ranges
Distribution ranges for the position commands.
Ranges
dataclass
Ranges(pos_x: tuple[float, float], pos_y: tuple[float, float], pos_z: tuple[float, float], heading: tuple[float, float])
Uniform distribution ranges for the position commands.
Attributes:
| Name | Type | Description |
|---|---|---|
pos_x |
tuple[float, float]
|
Range for the x position (in m). |
pos_y |
tuple[float, float]
|
Range for the y position (in m). |
pos_z |
tuple[float, float]
|
Range for the z position (in m). |
heading |
tuple[float, float]
|
Heading range for the position commands (in rad). |
pos_x
instance-attribute
pos_x: tuple[float, float]
Range for the x position (in m).
pos_y
instance-attribute
pos_y: tuple[float, float]
Range for the y position (in m).
pos_z
instance-attribute
pos_z: tuple[float, float]
Range for the z position (in m).
heading
instance-attribute
heading: tuple[float, float]
Heading range for the position commands (in rad).
Used only if :attr:simple_heading is False.
randomize_action_term_attr
randomize_action_term_attr(env: ManagerBasedRlEnv, env_ids: Tensor | None, action_term_name: str = 'flight_control_action', attr_name: str = '_flight_controller', **kwargs) -> None
Randomize a selected action-term attribute.
randomize_controller_params
randomize_controller_params(env: ManagerBasedRlEnv, env_ids: Tensor | None, action_term_name: str = 'flight_control_action', controller_attr: str = '_flight_controller', limits: dict | None = None, params: dict[str, tuple[float, float]] | None = None, randomize_gains: bool | dict = False) -> None
Randomize controller gains and command limits attached to an action term.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict | None
|
Min/max limit ranges forwarded to |
None
|
|
dict[str, tuple[float, float]] | None
|
Physical parameter ranges (mass, g) for |
None
|
|
bool | dict
|
|
False
|
randomize_mixer_params
randomize_mixer_params(env: ManagerBasedRlEnv, env_ids: Tensor | None, action_term_name: str = 'flight_control_action', mixer_attr: str = '_mixer', param_range: dict[str, tuple[float, float]] | None = None) -> None
Randomize mixer parameters attached to an action term.
randomize_rotor_params
randomize_rotor_params(env: ManagerBasedRlEnv, env_ids: Tensor | None, action_term_name: str = 'flight_control_action', rotor_attr: str = '_rotor_dynamics', param_range: dict[str, tuple[float, float]] | None = None) -> None
Randomize rotor parameters attached to an action term.
randomize_mapping_params
randomize_mapping_params(env: ManagerBasedRlEnv, env_ids: Tensor | None, action_term_name: str = 'flight_control_action', mapper_attr: str = '_mapper', param_range: dict[str, tuple[float, float]] | None = None) -> None
Randomize action-mapper runtime parameters attached to an action term.
root_euler_w
root_euler_w(env: ManagerBasedRlEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg('robot')) -> torch.Tensor
Euler angles of the root in world frame.
lin_vel_l2
lin_vel_l2(env: ManagerBasedRlEnv, asset_cfg: SceneEntityCfg = _DEFAULT_ASSET_CFG) -> torch.Tensor
Penalize base linear velocity using L2 squared kernel.
ang_vel_l2
ang_vel_l2(env: ManagerBasedRlEnv, asset_cfg: SceneEntityCfg = _DEFAULT_ASSET_CFG) -> torch.Tensor
Penalize base angular velocity using L2 squared kernel.
pos_error_l2
pos_error_l2(env: ManagerBasedRlEnv, command_name: str) -> torch.Tensor
Penalize asset pos from its target pos using L2 squared kernel.
pos_error_tanh
pos_error_tanh(env: ManagerBasedRlEnv, command_name: str, std: float = 0.8) -> torch.Tensor
Penalize asset pos from its target pos using tanh kernel.
yaw_error_l2
yaw_error_l2(env: ManagerBasedRlEnv, command_name: str) -> torch.Tensor
Penalize heading error from target heading using L2 squared kernel.
yaw_error_tanh
yaw_error_tanh(env: ManagerBasedRlEnv, command_name: str, std: float = 0.8) -> torch.Tensor
Penalize heading error from target heading using tanh kernel.