跳转至

mdp

模块:

名称 描述
actions
commands
rewards

类:

名称 描述
FlightActionMapper

Map batched normalized actions into controller targets, wrench, or RPM.

Mixer

Map batched thrust and moment demands to rotor speed commands.

AerodynamicEffects

Compute drag, ground effect, and planar near-wall effect in batches.

AerodynamicEffectsCfg

Environment-specific aerodynamic-effect configuration.

VehicleParams

Generic multi-rotor vehicle physics.

RotorDynamics

Batched motor dynamics model for rotor thrust and torque.

FlightControlActionManager

Base class for action managers that control actuators.

HeadingVelocityCommandRange

4-D velocity command range: vx, vy, vz, wz.

HeadingVelocityCommandManager

Velocity command manager with heading-based yaw rate control and z velocity.

函数:

名称 描述
wrap_to_pi

Wraps input angles (in radians) to the range :math:[-\pi, \pi].

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.

command_tracking_lin_vel

Reward for tracking commanded linear velocity (xyz axes).

command_tracking_ang_vel

Reward for tracking commanded angular velocity (yaw).

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.

方法:

名称 描述
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.

属性:

名称 类型 描述
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.

返回:

类型 描述
ArrayLike

The total collective acceleration array.

collective_acc_to_thrust

collective_acc_to_thrust(collective_acc: ArrayLike) -> ArrayLike

Collective acc to thrust.

返回:

类型 描述
ArrayLike

The total thrust array.

action_to_collective_thrust

action_to_collective_thrust(action: ArrayLike, mixer) -> ArrayLike

Action to collective thrust.

返回:

类型 描述
ArrayLike

The total thrust array.

decode_action

decode_action(action: ArrayLike, mixer, *, state: ControllerState | None = None) -> FlightMapping

Decode normalized batched action into a runtime-neutral control request.

返回:

类型 描述
FlightMapping

FlightMapping dictionary containing control requests.

引发:

类型 描述
ValueError

If state is missing when required for control mode.

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.

返回:

类型 描述
FlightMapping

FlightMapping dictionary containing RPM commands and wrench details.

引发:

类型 描述
ValueError

If flight_controller is missing for mapped modes.

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.

参数:

名称 类型 描述 默认

params

VehicleParams

Vehicle parameters used to build the allocation matrix.

VehicleParams()

num_envs

int

Number of parallel environments represented by the batch.

1

device

Optional backend device, mainly used by Torch.

None

backend

BackendName | None

Explicit Array API backend. If omitted, NumPy is used when device is None and Torch otherwise for compatibility.

None

xp

ModuleType | None

Pre-resolved Array API namespace. Overrides backend.

None

allocation_mode

Literal['pinv', 'saturation']

"pinv" for direct pseudo-inverse allocation or "saturation" for staged saturation-aware allocation.

'pinv'

方法:

名称 描述
randomize

Randomize mixer parameters for selected environments.

calculate_rotor_commands

Allocate [thrust, roll, pitch, yaw] controls to rotor RPM.

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.

参数:

名称 类型 描述 默认

control

ArrayLike

Batched control array with shape (num_envs, 4).

必需

返回:

类型 描述
ArrayLike

Batched rotor speed magnitudes with shape (num_envs, 4).

AerodynamicEffects

AerodynamicEffects(params: VehicleParams = VehicleParams(), cfg: AerodynamicEffectsCfg | None = None, num_envs: int = 1, num_rotors: int = 4, device=None, *, backend: BackendName | None = None, xp: ModuleType | None = None)

Compute drag, ground effect, and planar near-wall effect in batches.

Surface geometry is represented in each environment's local world frame. Rotor-force increments, body forces, and force telemetry are represented in the vehicle body frame. The model owns no simulator objects and can therefore be shared by NumPy, Torch, JAX, and CuPy callers.

Initialize coefficients, plane geometry, and telemetry buffers.

参数:

名称 类型 描述 默认

params

VehicleParams

Vehicle physical and aerodynamic coefficients.

VehicleParams()

cfg

AerodynamicEffectsCfg | None

Environment-specific switches, wind, and plane geometry.

None

num_envs

int

Number of parallel simulation environments.

1

num_rotors

int

Number of rotors per environment.

4

device

Optional backend device, mainly used by Torch.

None

backend

BackendName | None

Explicit Array API backend name.

None

xp

ModuleType | None

Pre-resolved Array API namespace. Overrides backend.

None

方法:

名称 描述
randomize

Sample per-environment aerodynamic state for selected environments.

set_external_force

Set one shared or per-environment world-frame external force.

set_wall_plane

Set one shared or per-environment wall plane.

update

Compute rotor-force increments and root-body force for one simulation step.

属性:

名称 类型 描述
enabled bool

Whether any aerodynamic effect is enabled.

enabled property

enabled: bool

Whether any aerodynamic effect is enabled.

randomize

randomize(env_ids: ArrayLike | list[int] | slice | None = None, parameter_ranges: dict[str, tuple[ArrayLike, ArrayLike]] | None = None, effect_probabilities: dict[str, float] | None = None, effect_scale_ranges: dict[str, tuple[ArrayLike, ArrayLike]] | None = None) -> None

Sample per-environment aerodynamic state for selected environments.

Parameter ranges are absolute values rather than multipliers. Effect probabilities create exact per-episode on/off masks, while scale ranges multiply the corresponding computed force increment. If every optional argument is omitted, configuration is read from params.randomization["aerodynamics"].

参数:

名称 类型 描述 默认

env_ids

ArrayLike | list[int] | slice | None

Environment indices to resample, or all environments.

None

parameter_ranges

dict[str, tuple[ArrayLike, ArrayLike]] | None

Absolute ranges for aerodynamic coefficients.

None

effect_probabilities

dict[str, float] | None

Bernoulli probability for each effect.

None

effect_scale_ranges

dict[str, tuple[ArrayLike, ArrayLike]] | None

Multiplicative force-scale range per effect.

None

引发:

类型 描述
ValueError

If a key, probability, or physical range is invalid.

set_external_force

set_external_force(external_force_w: ArrayLike) -> None

Set one shared or per-environment world-frame external force.

set_wall_plane

set_wall_plane(point_w: ArrayLike, normal_w: ArrayLike) -> None

Set one shared or per-environment wall plane.

Moving-surface scenarios can call this before :meth:update to update the analytic plane pose.

引发:

类型 描述
ValueError

If any wall normal is zero, near-zero, or non-finite.

update

update(rotor_thrusts: ArrayLike, rotor_positions_w: ArrayLike, rotor_axes_b: ArrayLike, body_velocity_b: ArrayLike, body_rotation_wb: ArrayLike) -> tuple[ArrayLike, ArrayLike]

Compute rotor-force increments and root-body force for one simulation step.

参数:

名称 类型 描述 默认

rotor_thrusts

ArrayLike

Positive rotor thrust magnitudes, shape (N, R).

必需

rotor_positions_w

ArrayLike

Rotor centers in environment-local world frame, shape (N, R, 3).

必需

rotor_axes_b

ArrayLike

Rotor positive-thrust axes in vehicle body frame, shape (N, R, 3).

必需

body_velocity_b

ArrayLike

Root-body velocity in the vehicle body frame, shape (N, 3).

必需

body_rotation_wb

ArrayLike

Body-to-world rotation matrices, shape (N, 3, 3).

必需

返回:

类型 描述
ArrayLike

Tuple of per-rotor vehicle-body-frame force increments (N, R, 3)

ArrayLike

and root-body-frame drag plus prescribed force (N, 3).

AerodynamicEffectsCfg dataclass

AerodynamicEffectsCfg(*, enable_drag: bool = False, enable_external_force: bool = False, enable_ground_effect: bool = False, enable_wall_effect: bool = False, external_force_w: tuple[float, float, float] = (0.0, 0.0, 0.0), ground_height: float = 0.0, max_ground_effect_gain: float = 2.0, wall_plane_point_w: tuple[float, float, float] = (0.0, 0.0, 0.0), wall_plane_normal_w: tuple[float, float, float] = (1.0, 0.0, 0.0), max_surface_distance: float = 5.0)

Environment-specific aerodynamic-effect configuration.

Plane coordinates use each simulator environment's local world frame. Effects default to disabled so existing tasks retain their current physics.

属性:

名称 类型 描述
enable_drag bool

Apply body-axis linear drag.

enable_external_force bool

Apply the configured world-frame external force.

enable_ground_effect bool

Augment per-rotor thrust near a horizontal ground plane.

enable_wall_effect bool

Apply per-rotor forces near the configured wall plane.

external_force_w tuple[float, float, float]

Constant environment-local world-frame external force (N).

ground_height float

Height of the analytic horizontal ground plane (m).

max_ground_effect_gain float

Maximum ground-effect thrust multiplier used near the model singularity.

wall_plane_point_w tuple[float, float, float]

One point on the analytic wall plane (m).

wall_plane_normal_w tuple[float, float, float]

Wall-plane unit-normal direction; either side of the plane is valid.

max_surface_distance float

Distance beyond which surface effects are exactly disabled (m).

enable_drag class-attribute instance-attribute

enable_drag: bool = False

Apply body-axis linear drag.

enable_external_force class-attribute instance-attribute

enable_external_force: bool = False

Apply the configured world-frame external force.

enable_ground_effect class-attribute instance-attribute

enable_ground_effect: bool = False

Augment per-rotor thrust near a horizontal ground plane.

enable_wall_effect class-attribute instance-attribute

enable_wall_effect: bool = False

Apply per-rotor forces near the configured wall plane.

external_force_w class-attribute instance-attribute

external_force_w: tuple[float, float, float] = (0.0, 0.0, 0.0)

Constant environment-local world-frame external force (N).

ground_height class-attribute instance-attribute

ground_height: float = 0.0

Height of the analytic horizontal ground plane (m).

max_ground_effect_gain class-attribute instance-attribute

max_ground_effect_gain: float = 2.0

Maximum ground-effect thrust multiplier used near the model singularity.

wall_plane_point_w class-attribute instance-attribute

wall_plane_point_w: tuple[float, float, float] = (0.0, 0.0, 0.0)

One point on the analytic wall plane (m).

wall_plane_normal_w class-attribute instance-attribute

wall_plane_normal_w: tuple[float, float, float] = (1.0, 0.0, 0.0)

Wall-plane unit-normal direction; either side of the plane is valid.

max_surface_distance class-attribute instance-attribute

max_surface_distance: float = 5.0

Distance beyond which surface effects are exactly disabled (m).

VehicleParams dataclass

VehicleParams(*, rho: float = 1.184, g: float = 9.81, sim_dt: float = 0.01, step_dt: float = 0.01, randomization: VehicleRandomization = VehicleRandomization(), 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, drag_coefficients: tuple[float, float, float] = (0.1, 0.1, 0.1), ground_effect_k: float = 0.171, wall_effect_a1: float = 0.21, wall_effect_b1: float = 0.34, wall_effect_a2: float = 0.06, wall_effect_b2: float = 0.54, 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 the ground chassis (2.1 kg).

Concrete subclasses add robot-specific locomotion and geometry:

  • TrackVehicleParams — LAV2: tracked ground locomotion + ducted airframe
  • TiltWheelVehicleParams — ATMO: tilting arms + two side motors whose belt transmissions synchronize four wheel shells

方法:

名称 描述
__post_init__

Calculate derived parameters and resolve default sentinels.

属性:

名称 类型 描述
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 VehicleRandomization

Per-component runtime-randomization configuration.

mass float

Total vehicle mass (kg); concrete robot subclasses may override it.

inertia list

Vehicle inertia matrix at its center of mass (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).

drag_coefficients tuple[float, float, float]

Linear body-axis drag coefficients (N·s/m).

ground_effect_k float

Empirical ground-effect distance coefficient for the target multirotor.

wall_effect_a1 float

Near-wall lateral-force amplitude fitted by Ding et al. (2023).

wall_effect_b1 float

Near-wall lateral-force exponential base fitted by Ding et al. (2023).

wall_effect_a2 float

Near-wall vertical-thrust amplitude fitted by Ding et al. (2023).

wall_effect_b2 float

Near-wall vertical-thrust exponential base fitted by Ding et al. (2023).

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: VehicleRandomization = field(default_factory=VehicleRandomization)

Per-component runtime-randomization configuration.

mass class-attribute instance-attribute

mass: float = 2.1

Total vehicle mass (kg); concrete robot subclasses may override it.

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]])

Vehicle inertia matrix at its center of mass (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).

drag_coefficients class-attribute instance-attribute

drag_coefficients: tuple[float, float, float] = (0.1, 0.1, 0.1)

Linear body-axis drag coefficients (N·s/m).

ground_effect_k class-attribute instance-attribute

ground_effect_k: float = 0.171

Empirical ground-effect distance coefficient for the target multirotor.

wall_effect_a1 class-attribute instance-attribute

wall_effect_a1: float = 0.21

Near-wall lateral-force amplitude fitted by Ding et al. (2023).

wall_effect_b1 class-attribute instance-attribute

wall_effect_b1: float = 0.34

Near-wall lateral-force exponential base fitted by Ding et al. (2023).

wall_effect_a2 class-attribute instance-attribute

wall_effect_a2: float = 0.06

Near-wall vertical-thrust amplitude fitted by Ding et al. (2023).

wall_effect_b2 class-attribute instance-attribute

wall_effect_b2: float = 0.54

Near-wall vertical-thrust exponential base fitted by Ding et al. (2023).

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.

引发:

类型 描述
ValueError

If spin_dir does not contain four signs.

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 backend-agnostic Array API implementation 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.

Initialize rotor dynamics and backend arrays.

参数:

名称 类型 描述 默认

params

VehicleParams

Vehicle parameters used by the motor model.

VehicleParams()

num_envs

int

Number of parallel environments represented by the batch.

1

device

Optional backend device, mainly used by Torch.

None

backend

BackendName | None

Explicit Array API backend name.

None

xp

ModuleType | None

Pre-resolved Array API namespace. Overrides backend.

None

方法:

名称 描述
randomize

Randomize motor parameters for selected environments.

update

Update motor state and return thrust/torque outputs.

reset

Reset selected environments to initial rotor speeds.

属性:

名称 类型 描述
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.

参数:

名称 类型 描述 默认

commands

ArrayLike

Desired rotor speeds with shape (num_envs, 4).

必需

返回:

类型 描述
ArrayLike

Batched thrusts followed by torques with shape (num_envs, 8).

reset

reset(env_ids=None)

Reset selected environments to initial rotor speeds.

FlightControlActionManager

FlightControlActionManager(env: GenesisEnv, delay_step: int = 0, params: VehicleParams = VehicleParams(), entity_attr: str = 'robot', rotor_link_names: tuple[str, ...] = ('rotor0', 'rotor1', 'rotor2', 'rotor3'), aerodynamics: AerodynamicEffectsCfg = AerodynamicEffectsCfg())

Bases: BaseActionManager

Base class for action managers that control actuators.

参数:

名称 类型 描述 默认

env

GenesisEnv

The environment to manage the DOF actuators for.

必需

delay_step

int

The number of steps to delay the actions for. This is an easy way to emulate the latency in the system.

0

params

VehicleParams

Vehicle physical parameters.

VehicleParams()

entity_attr

str

Attribute name on the environment for the robot entity.

'robot'

方法:

名称 描述
step

Process the incoming actions (analogous to Isaac Lab process_actions).

send_actions_to_simulation

Apply the processed actions to the simulation (Isaac Lab apply_actions).

reset

Reset environments.

get_actions

Get the current actions for the environments.

属性:

名称 类型 描述
num_actions int

The total number of actions.

action_space tuple[float, float]

If using the default action handler, the action space is [-1, 1].

actions Tensor

The actions for for the current step.

raw_actions Tensor

The actions received from the policy, before being converted.

aerodynamics AerodynamicEffects

Shared aerodynamic model and force telemetry.

num_actions property

num_actions: int

The total number of actions.

action_space property

action_space: tuple[float, float]

If using the default action handler, the action space is [-1, 1].

actions property

actions: Tensor

The actions for for the current step.

raw_actions property

raw_actions: Tensor

The actions received from the policy, before being converted.

aerodynamics property

aerodynamics: AerodynamicEffects

Shared aerodynamic model and force telemetry.

step

step(actions: Tensor) -> torch.Tensor

Process the incoming actions (analogous to Isaac Lab process_actions).

Only the raw and clamped policy actions are stored here; the mixer, rotor dynamics and body-force application run in :meth:send_actions_to_simulation (the apply phase).

send_actions_to_simulation

send_actions_to_simulation(processed_actions: Tensor) -> torch.Tensor

Apply the processed actions to the simulation (Isaac Lab apply_actions).

genesis_forge>=0.5 splits action handling into step (process) and send_actions_to_simulation (apply), which runs at a different cadence than processing. This maps the processed actions to a rotor RPM command via the mixer, steps the rotor dynamics, and writes the resulting body forces/torques to the solver.

reset

reset(envs_idx: list[int] | None)

Reset environments.

get_actions

get_actions() -> torch.Tensor

Get the current actions for the environments.

HeadingVelocityCommandRange

Bases: TypedDict

4-D velocity command range: vx, vy, vz, wz.

HeadingVelocityCommandManager

HeadingVelocityCommandManager(env: GenesisEnv, range: HeadingVelocityCommandRange, resample_time_sec: float = 5.0, standing_probability: float = 0.0, heading_command: bool = False, heading_control_stiffness: float = 1.0, rel_heading_envs: float = 1.0, heading_range: tuple[float, float] = (-math.pi, math.pi), debug_visualizer: bool = False, debug_visualizer_cfg: VelocityDebugVisualizerConfig = DEFAULT_VISUALIZER_CONFIG)

Bases: VelocityCommandManager

Velocity command manager with heading-based yaw rate control and z velocity.

Uses its own HeadingVelocityCommandRange config with 4 velocity dimensions. The parent's _command buffer stores 4-D [vx, vy, vz, wz]. The public command property returns the same 4-D tensor.

When heading_command=True, the angular velocity (wz) is overridden for heading-enabled environments by a proportional controller on the heading error::

wz = clip(stiffness * wrap_to_pi(heading_target - heading_w), ang_vel_z_range)

参数:

名称 类型 描述 默认

env

GenesisEnv

The environment to control.

必需

range

HeadingVelocityCommandRange

The ranges of linear & angular velocities (4-D: vx, vy, vz, wz).

必需

resample_time_sec

float

The time interval between changing the command.

5.0

standing_probability

float

Probability of standing still.

0.0

heading_command

bool

Enable heading-based angular velocity control.

False

heading_control_stiffness

float

P-gain for heading error to yaw rate.

1.0

rel_heading_envs

float

Fraction of environments that use heading control.

1.0

heading_range

tuple[float, float]

Range for sampling heading targets (radians).

(-pi, pi)

debug_visualizer

bool

Enable debug arrow visualization.

False

debug_visualizer_cfg

VelocityDebugVisualizerConfig

Configuration for the debug visualizer.

DEFAULT_VISUALIZER_CONFIG

属性:

名称 类型 描述
command Tensor

The desired velocity command in base frame. Shape is (num_envs, 4).

command property

command: Tensor

The desired velocity command in base frame. Shape is (num_envs, 4).

Columns: [vx, vy, vz, wz].

wrap_to_pi

wrap_to_pi(angles: Tensor) -> torch.Tensor

Wraps input angles (in radians) to the range :math:[-\pi, \pi].

This function wraps angles in radians to the range :math:[-\pi, \pi], such that :math:\pi maps to :math:\pi, and :math:-\pi maps to :math:-\pi. In general, odd positive multiples of :math:\pi are mapped to :math:\pi, and odd negative multiples of :math:\pi are mapped to :math:-\pi.

The function behaves similar to MATLAB's wrapToPi <https://www.mathworks.com/help/map/ref/wraptopi.html>_ function.

参数:

名称 类型 描述 默认

angles

Tensor

Input angles of any shape.

必需

返回:

类型 描述
Tensor

torch.Tensor: Angles in the range :math:[-\pi, \pi].

lin_vel_l2

lin_vel_l2(env: GenesisEnv, entity_attr: str = 'robot', entity_manager: EntityManager = None) -> torch.Tensor

Penalize base linear velocity using L2 squared kernel.

ang_vel_l2

ang_vel_l2(env: GenesisEnv, entity_attr: str = 'robot', entity_manager: EntityManager = None) -> torch.Tensor

Penalize base angular velocity using L2 squared kernel.

pos_error_l2

pos_error_l2(env: GenesisEnv, target_pose: Tensor, pose_command: CommandManager = None, entity_attr: str = 'robot', entity_manager: EntityManager = None) -> torch.Tensor

Penalize asset pos from its target pos using L2 squared kernel.

pos_error_tanh

pos_error_tanh(env: GenesisEnv, target_pose: Tensor, pose_command: CommandManager = None, entity_attr: str = 'robot', entity_manager: EntityManager = None) -> torch.Tensor

Penalize asset pos from its target pos using tanh kernel.

yaw_error_l2

yaw_error_l2(env: GenesisEnv, target_pose: Tensor, pose_command: CommandManager = None, entity_attr: str = 'robot', entity_manager: EntityManager = None) -> torch.Tensor

Penalize heading error from target heading using L2 squared kernel.

yaw_error_tanh

yaw_error_tanh(env: GenesisEnv, target_pose: Tensor, pose_command: CommandManager = None, entity_attr: str = 'robot', entity_manager: EntityManager = None, std: float = 0.8) -> torch.Tensor

Penalize heading error from target heading.

command_tracking_lin_vel

command_tracking_lin_vel(env: GenesisEnv, vel_cmd_manager: VelocityCommandManager, sensitivity: float = 0.25, entity_attr: str = 'robot', entity_manager: EntityManager = None) -> torch.Tensor

Reward for tracking commanded linear velocity (xyz axes).

Uses 4-D command [vx, vy, vz, wz] and tracks all three linear axes.

command_tracking_ang_vel

command_tracking_ang_vel(env: GenesisEnv, vel_cmd_manager: VelocityCommandManager, sensitivity: float = 0.25, entity_attr: str = 'robot', entity_manager: EntityManager = None) -> torch.Tensor

Reward for tracking commanded angular velocity (yaw).

Uses 4-D command [vx, vy, vz, wz] where wz is at index 3.