mdp
模块:
| 名称 | 描述 |
|---|---|
curriculums |
|
类:
| 名称 | 描述 |
|---|---|
FlightActionMapper |
Map batched normalized actions into controller targets, wrench, or RPM. |
FlightMappingConfig |
Mapping-range configuration for normalized action scaling. |
Mixer |
Map thrust and moment demands to rotor commands. |
FlightController |
PID flight controller (batched). |
VehicleParams |
LAV2 vehicle parameters. |
RotorDynamics |
Batched rotor dynamics model. |
TrackDynamics |
Batched track dynamics model. |
ControlAction |
Body torque control action term. |
ControlActionCfg |
See :class: |
TrackControlAction |
Track force control action term. |
TrackControlActionCfg |
See :class: |
HelixTrajectory |
Batched helix trajectory with optional vertical oscillation. |
LemniscateTrajectory |
Batched Bernoulli lemniscate trajectory with vertical oscillation. |
LissajousTrajectory |
Batched three-dimensional Lissajous trajectory. |
RectangleTrajectory |
Batched constant-speed rectangle trajectory in the horizontal plane. |
RandomTrajectoryCommand |
Trajectory command generator with randomized type and parameters per environment. |
RandomTrajectoryCommandCfg |
Configuration for randomized trajectory commands. |
modify_reward_weight_linearly |
Curriculum term that linearly updates a reward weight during training. |
函数:
| 名称 | 描述 |
|---|---|
died |
Termination condition based on the robot's height. |
FlightActionMapper
FlightActionMapper(control_mode: str, params: VehicleParams = VehicleParams(), mapping: FlightMappingConfig | None = None, *, num_envs: int = 1, device: str | device = 'cpu')
Map batched normalized actions into controller targets, wrench, or RPM.
Initialize a batched Torch flight action mapper for the selected mode.
方法:
| 名称 | 描述 |
|---|---|
action_to_collective_acc |
Map a normalized policy collective action to total collective acceleration. |
collective_acc_to_thrust |
Convert total collective acceleration into total thrust in Newtons. |
action_to_collective_thrust |
Convert a normalized policy collective action into total thrust. |
map_action |
Map a normalized batched action into RPM commands and intermediates. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
requires_controller |
bool
|
Whether this mode needs a controller target expansion step. |
requires_controller
property
requires_controller: bool
Whether this mode needs a controller target expansion step.
action_to_collective_acc
action_to_collective_acc(action: Tensor, mixer: Mixer) -> torch.Tensor
Map a normalized policy collective action to total collective acceleration.
collective_acc_to_thrust
collective_acc_to_thrust(collective_acc: Tensor) -> torch.Tensor
Convert total collective acceleration into total thrust in Newtons.
action_to_collective_thrust
action_to_collective_thrust(action: Tensor, mixer: Mixer) -> torch.Tensor
Convert a normalized policy collective action into total thrust.
map_action
map_action(action: Tensor, mixer: Mixer, *, state: Tensor | None = None, flight_controller: ControllerBase | None = None) -> FlightMappingResult
Map a normalized batched action into RPM commands and intermediates.
FlightMappingConfig
dataclass
FlightMappingConfig(velocity_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))
Mapping-range configuration for normalized action scaling.
方法:
| 名称 | 描述 |
|---|---|
from_params |
Build mapping ranges from vehicle parameters. |
resolve |
Resolve config overrides into concrete mapping ranges. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
velocity_range |
tuple[float, float, float] | None
|
Velocity scaling in m/s for x, y, z axes. |
attitude_range |
tuple[float, float, float] | None
|
Attitude scaling in radians. |
body_rate_range |
tuple[float, float, float] | None
|
Body-rate scaling in rad/s. |
velocity_range
class-attribute
instance-attribute
velocity_range: tuple[float, float, float] | None = None
Velocity scaling in m/s for x, y, z axes.
attitude_range
class-attribute
instance-attribute
attitude_range: tuple[float, float, float] | None = None
Attitude scaling in radians.
body_rate_range
class-attribute
instance-attribute
body_rate_range: tuple[float, float, float] | None = (2.0, 2.0, 2.0)
Body-rate scaling in rad/s.
from_params
classmethod
from_params(params: VehicleParams) -> FlightMappingConfig
Build mapping ranges from vehicle parameters.
The returned ranges are chosen to broadly cover the controller range
exposed by VehicleParams without requiring exact one-to-one
alignment with the internal PX4-style controller limits.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
VehicleParams
|
Vehicle parameters providing the reference control bounds. |
必需 |
返回:
| 名称 | 类型 | 描述 |
|---|---|---|
FlightMappingConfig |
FlightMappingConfig
|
Mapping ranges derived from |
resolve
resolve(params: VehicleParams) -> FlightMappingConfig
Resolve config overrides into concrete mapping ranges.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
VehicleParams
|
Vehicle parameters providing fallback control bounds. |
必需 |
返回:
| 名称 | 类型 | 描述 |
|---|---|---|
FlightMappingConfig |
FlightMappingConfig
|
Concrete mapping ranges for runtime use. |
Mixer
Mixer(params: VehicleParams = VehicleParams(), num_envs: int = 1, device: str | device = 'cpu')
Map thrust and moment demands to rotor commands.
Note
电机推力分配: 电机1 = 推力 - 横滚(roll) + 俯仰(pitch) + 偏航(yaw) 电机2 = 推力 + 横滚(roll) - 俯仰(pitch) + 偏航(yaw) 电机3 = 推力 + 横滚(roll) + 俯仰(pitch) - 偏航(yaw) 电机4 = 推力 - 横滚(roll) - 俯仰(pitch) - 偏航(yaw)
Initialize the torch mixer with vehicle parameters and device.
方法:
| 名称 | 描述 |
|---|---|
randomize |
Randomize mixer runtime parameters from nominal values. |
calculate_rotor_commands |
Allocate thrust and moments into rotor speeds. |
randomize
randomize(env_ids=None, randomization=None)
Randomize mixer runtime parameters from nominal values.
calculate_rotor_commands
calculate_rotor_commands(control: Tensor) -> torch.Tensor
Allocate thrust and moments into rotor speeds.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
Tensor
|
Desired total thrust and roll/pitch/yaw moments. Shape: (num_envs, 4) |
必需 |
返回:
| 类型 | 描述 |
|---|---|
Tensor
|
torch.Tensor: The amplitude of each motor's rotational speed (calculated using |
FlightController
FlightController(params: VehicleParams = VehicleParams(), control_mask: list[int] = [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], gains: dict | None = None, limits: dict | None = None, num_envs: int = 1, device: str | device = 'cpu')
Bases: ControllerBase
PID flight controller (batched).
Initialize the batched flight PID controller.
方法:
| 名称 | 描述 |
|---|---|
randomize |
Randomize configured PID gains and controller limits for selected environments. |
reset |
Reset PID loops for selected environments. |
update |
Update controller. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
params |
VehicleParams
|
Vehicle parameters for the controller. |
control_mask |
ndarray | Tensor
|
unified control mask for target/state channels, used in update(). e.g. using 9~11 for attitude yaw control. |
params
instance-attribute
params: VehicleParams = params
Vehicle parameters for the controller.
control_mask
instance-attribute
control_mask: ndarray | Tensor = control_mask
unified control mask for target/state channels, used in update(). e.g. using 9~11 for attitude yaw control.
randomize
randomize(env_ids=None, gains=None, limits=None)
Randomize configured PID gains and controller limits for selected environments.
reset
reset(env_ids)
Reset PID loops for selected environments.
update
update(target: Tensor, state: Tensor) -> torch.Tensor
Update controller.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
Tensor
|
(N, 12) desired [x, y, z, vx, vy, vz, roll, pitch, yaw, wx, wy, wz] |
必需 |
|
Tensor
|
(N, 12) current state same ordering. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
Tensor
|
torch.Tensor: Tensor of shape (N, 4): [thrust, roll_moment, pitch_moment, yaw_moment]. |
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: np.diag([0.015, 0.0348, 0.042503]).tolist())(), diameter: float = 0.476, Cdx: float = 0.5, x: float = 0.0952, y: float = 0.114423, h: float = -0.0125, alpha: float = math.radians(8.0), r_p: float = 0.0775, J_m: float = 1e-05, Ct: float = 0.666, Cq: float = 0.0716, theta0: float = math.radians(14.6), thetaTip: float = math.radians(6.8), lock: float = 0.6051, max_rpm: float = 10000.0, init_rpm: float = -1.0, rotor_rpm_rate_limit: float = 50000.0, tau_f: float = 0.01, tau_m: float = 0.05, tau_up: float = -1.0, tau_down: float = -1.0, r_w: float = 0.0285, n_w: int = 4, B: float = 0.136, L: float = 0.23, h_cg: float = 0.078, f: float = 0.01, mu0: float = 0.8, K: float = 20, track_cmd_rate_limit: float = 100, mpc_xy_vel_max: float = 12.0, mpc_z_vel_max_up: float = 3.0, mpc_z_vel_max_dn: float = 1.5, 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))
LAV2 vehicle parameters.
方法:
| 名称 | 描述 |
|---|---|
__post_init__ |
Calculate derived parameters. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
rho |
float
|
空气密度 (kg/m^3) |
g |
float
|
重力加速度 (m/s^2) |
sim_dt |
float
|
仿真步长 (s) |
step_dt |
float
|
控制步长 (s) |
randomization |
dict[str, dict[str, tuple[float, float]]]
|
运行时参数随机化配置,按组件 (e.g. rotor/mixer) 划分为多个 scale 相对范围子表 |
mass |
float
|
质量 (kg) |
inertia |
list
|
惯性矩阵 (kg*m^2) |
diameter |
float
|
直径 (m) |
Cdx |
float
|
空气阻力系数 |
x |
float
|
x方向臂长 (m) |
y |
float
|
y方向臂长 (m) |
h |
float
|
重心高度 (m) |
alpha |
float
|
y方向涵道外倾角度 (rad) |
r_p |
float
|
螺旋桨半径 (m) |
J_m |
float
|
电机转动惯量 (kg*m^2) |
Ct |
float
|
推力系数 |
Cq |
float
|
扭矩系数 |
theta0 |
float
|
桨根角 (rad) |
thetaTip |
float
|
桨尖角 (rad) |
theta1 |
float
|
桨叶扭转角 (rad) |
lock |
float
|
Lock number |
max_rpm |
float
|
最大转速 |
init_rpm |
float
|
初始转速 |
rotor_rpm_rate_limit |
float
|
旋翼转速变化率限制 (rpm/s) |
cT |
float
|
转速平方到推力增益 (N/(rpm^2)) |
cM |
float
|
转速平方到扭矩增益 (N*m/(rpm^2)) |
tau_f |
float
|
电机滤波时间常数 (s) |
tau_m |
float
|
兼容保留的电机时间常数 (s) |
tau_up |
float
|
电机升速时间常数 (s) |
tau_down |
float
|
电机降速时间常数 (s) |
r_w |
float
|
主动轮半径 (m) |
n_w |
int
|
负重轮个数 |
B |
float
|
两侧履带中心距 (m) |
L |
float
|
履带节点接地部分长度 (m) |
h_cg |
float
|
车体质心高度 (m) |
f |
float
|
滚动阻力系数(以干燥混凝土路面或沥青路面为例) |
mu0 |
float
|
滑转率为1时的摩擦系数 |
K |
float
|
依赖于土壤黏聚系数和摩擦特性的常数 |
track_cmd_rate_limit |
float
|
履带主动轮指令变化率限制 (rad/s^2) |
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_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
空气密度 (kg/m^3)
g
class-attribute
instance-attribute
g: float = 9.81
重力加速度 (m/s^2)
sim_dt
class-attribute
instance-attribute
sim_dt: float = 0.01
仿真步长 (s)
step_dt
class-attribute
instance-attribute
step_dt: float = 0.01
控制步长 (s)
randomization
class-attribute
instance-attribute
randomization: dict[str, dict[str, tuple[float, float]]] = field(default_factory=dict)
运行时参数随机化配置,按组件 (e.g. rotor/mixer) 划分为多个 scale 相对范围子表
mass
class-attribute
instance-attribute
mass: float = 2.1
质量 (kg)
inertia
class-attribute
instance-attribute
inertia: list = field(default_factory=lambda: tolist())
惯性矩阵 (kg*m^2)
diameter
class-attribute
instance-attribute
diameter: float = 0.476
直径 (m)
Cdx
class-attribute
instance-attribute
Cdx: float = 0.5
空气阻力系数
x
class-attribute
instance-attribute
x: float = 0.0952
x方向臂长 (m)
y
class-attribute
instance-attribute
y: float = 0.114423
y方向臂长 (m)
h
class-attribute
instance-attribute
h: float = -0.0125
重心高度 (m)
alpha
class-attribute
instance-attribute
alpha: float = radians(8.0)
y方向涵道外倾角度 (rad)
r_p
class-attribute
instance-attribute
r_p: float = 0.0775
螺旋桨半径 (m)
J_m
class-attribute
instance-attribute
J_m: float = 1e-05
电机转动惯量 (kg*m^2)
Ct
class-attribute
instance-attribute
Ct: float = 0.666
推力系数
Cq
class-attribute
instance-attribute
Cq: float = 0.0716
扭矩系数
theta0
class-attribute
instance-attribute
theta0: float = radians(14.6)
桨根角 (rad)
thetaTip
class-attribute
instance-attribute
thetaTip: float = radians(6.8)
桨尖角 (rad)
theta1
class-attribute
instance-attribute
theta1: float = field(init=False)
桨叶扭转角 (rad)
lock
class-attribute
instance-attribute
lock: float = 0.6051
Lock number
max_rpm
class-attribute
instance-attribute
max_rpm: float = 10000.0
最大转速
init_rpm
class-attribute
instance-attribute
init_rpm: float = -1.0
初始转速
rotor_rpm_rate_limit
class-attribute
instance-attribute
rotor_rpm_rate_limit: float = 50000.0
旋翼转速变化率限制 (rpm/s)
cT
class-attribute
instance-attribute
cT: float = field(init=False)
转速平方到推力增益 (N/(rpm^2))
cM
class-attribute
instance-attribute
cM: float = field(init=False)
转速平方到扭矩增益 (N*m/(rpm^2))
tau_f
class-attribute
instance-attribute
tau_f: float = 0.01
电机滤波时间常数 (s)
tau_m
class-attribute
instance-attribute
tau_m: float = 0.05
兼容保留的电机时间常数 (s)
tau_up
class-attribute
instance-attribute
tau_up: float = -1.0
电机升速时间常数 (s)
tau_down
class-attribute
instance-attribute
tau_down: float = -1.0
电机降速时间常数 (s)
r_w
class-attribute
instance-attribute
r_w: float = 0.0285
主动轮半径 (m)
n_w
class-attribute
instance-attribute
n_w: int = 4
负重轮个数
B
class-attribute
instance-attribute
B: float = 0.136
两侧履带中心距 (m)
L
class-attribute
instance-attribute
L: float = 0.23
履带节点接地部分长度 (m)
h_cg
class-attribute
instance-attribute
h_cg: float = 0.078
车体质心高度 (m)
f
class-attribute
instance-attribute
f: float = 0.01
滚动阻力系数(以干燥混凝土路面或沥青路面为例)
mu0
class-attribute
instance-attribute
mu0: float = 0.8
滑转率为1时的摩擦系数
K
class-attribute
instance-attribute
K: float = 20
依赖于土壤黏聚系数和摩擦特性的常数
track_cmd_rate_limit
class-attribute
instance-attribute
track_cmd_rate_limit: float = 100
履带主动轮指令变化率限制 (rad/s^2)
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_man_tilt_max
class-attribute
instance-attribute
mpc_man_tilt_max: float = radians(35.0)
Maximum manual tilt angle in radians (deg: 0 - 90).
mc_rollrate_max
class-attribute
instance-attribute
mc_rollrate_max: float = 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 = 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 = radians(200.0)
Maximum yaw-rate setpoint in rad/s (deg/s: 0 - 1800).
__post_init__
__post_init__()
Calculate derived parameters.
RotorDynamics
RotorDynamics(params: VehicleParams = VehicleParams(), num_envs: int = 1, device: str | device = 'cpu')
Bases: DynamicsBase
Batched rotor dynamics model.
Initialize batched rotor dynamics on the specified device.
方法:
| 名称 | 描述 |
|---|---|
randomize |
Randomize rotor runtime parameters from nominal values. |
update |
Calculate the output thrust and torque for each motor based on the motor commands. |
reset |
Resets the rotor model to initial conditions. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
params |
VehicleParams
|
Vehicle parameters for the dynamics model. |
params
instance-attribute
params: VehicleParams = params
Vehicle parameters for the dynamics model.
randomize
randomize(env_ids: slice | Sequence[int] | Tensor | None = None, randomization: dict[str, tuple[float, float]] | None = None) -> None
Randomize rotor runtime parameters from nominal values.
update
update(commands: Tensor) -> torch.Tensor
Calculate the output thrust and torque for each motor based on the motor commands.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
Tensor
|
Command tensor for each motor. Shape: (num_envs, 4) |
必需 |
返回:
| 类型 | 描述 |
|---|---|
Tensor
|
torch.Tensor: Thrust and torque tensor for each motor. Shape: (num_envs, 8) |
reset
reset(env_ids: slice | Sequence[int] | Tensor) -> None
Resets the rotor model to initial conditions.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
slice | Sequence[int] | Tensor
|
The environment ids to reset. |
必需 |
TrackDynamics
TrackDynamics(params: VehicleParams = VehicleParams(), num_envs: int = 1, device: str | device = 'cpu')
Bases: DynamicsBase
Batched track dynamics model.
Initialize batched track dynamics on the specified device.
方法:
| 名称 | 描述 |
|---|---|
update |
Compute track forces for batched environments. |
reset |
Resets the track model to initial conditions. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
params |
VehicleParams
|
Vehicle parameters for the dynamics model. |
params
instance-attribute
params: VehicleParams = params
Vehicle parameters for the dynamics model.
update
update(commands: Tensor, state: Tensor) -> torch.Tensor
Compute track forces for batched environments.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
Tensor
|
Shape |
必需 |
|
Tensor
|
Shape |
必需 |
返回:
| 类型 | 描述 |
|---|---|
Tensor
|
torch.Tensor: Tensor of shape |
reset
reset(env_ids: slice | Sequence[int] | Tensor) -> None
Resets the track model to initial conditions.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
slice | Sequence[int] | Tensor
|
The environment ids to reset. |
必需 |
ControlAction
ControlAction(cfg: ControlActionCfg, env: ManagerBasedRLEnv)
Bases: ActionTerm
Body torque control action term.
This action term applies a wrench to the drone body frame based on action commands
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
cfg |
ControlActionCfg
|
The configuration of the action term. |
cfg
instance-attribute
cfg: ControlActionCfg = cfg
The configuration of the action term.
ControlActionCfg
Bases: ActionTermCfg
See :class:ControlAction for more details.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
class_type |
type[ActionTerm]
|
Class of the action term. |
asset_name |
str
|
Name of the asset in the environment for which the commands are generated. |
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. |
control_mode |
str
|
Control mode, options: cmd_motor_thrusts, cmd_motor_speeds, cmd_ctbm, cmd_ctbr, cmd_ctatt, cmd_vel, cmd_pos. |
mapping |
FlightMappingConfig
|
Action-mapping range overrides resolved against |
class_type
class-attribute
instance-attribute
class_type: type[ActionTerm] = ControlAction
Class of the action term.
asset_name
class-attribute
instance-attribute
asset_name: str = 'robot'
Name of the asset in the environment for which the commands are generated.
params
class-attribute
instance-attribute
params: VehicleParams = 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.
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_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 (version is unclear ATM)
mapping
class-attribute
instance-attribute
mapping: FlightMappingConfig = 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.
TrackControlAction
TrackControlAction(cfg: TrackControlActionCfg, env: ManagerBasedRLEnv)
Bases: ActionTerm
Track force control action term.
This action term converts normalized track commands into ground reaction forces applied on each track body.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
cfg |
TrackControlActionCfg
|
The configuration of the action term. |
cfg
instance-attribute
cfg: TrackControlActionCfg = cfg
The configuration of the action term.
TrackControlActionCfg
Bases: ActionTermCfg
See :class:ControlAction for more details.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
class_type |
type[ActionTerm]
|
Class of the action term. |
asset_name |
str
|
Name of the asset in the environment for which the commands are generated. |
params |
VehicleParams
|
Vehicle parameters. |
class_type
class-attribute
instance-attribute
class_type: type[ActionTerm] = TrackControlAction
Class of the action term.
asset_name
class-attribute
instance-attribute
asset_name: str = 'robot'
Name of the asset in the environment for which the commands are generated.
params
class-attribute
instance-attribute
params: VehicleParams = VehicleParams()
Vehicle parameters.
HelixTrajectory
dataclass
HelixTrajectory(*, yaw_from_velocity: bool = True, fixed_yaw: Tensor | None = None, attitude: Tensor | None = None, body_rate: Tensor | None = None, center: Tensor, radius: Tensor, omega: Tensor, z_amplitude: Tensor, z_frequency: Tensor, z_phase: Tensor)
Bases: SpatialTrajectory
Batched helix trajectory with optional vertical oscillation.
方法:
| 名称 | 描述 |
|---|---|
sample_heading |
Sample batched yaw and yaw-rate references for time values |
build_target |
Assemble a batched 12D target tensor from motion primitives. |
__post_init__ |
Initialize shared tensors from the center batch shape when available. |
sample |
Sample the batched helix trajectory at time values |
sample_heading
sample_heading(t: Tensor, pos: Tensor, vel: Tensor, acc: Tensor) -> tuple[torch.Tensor, torch.Tensor]
Sample batched yaw and yaw-rate references for time values t.
build_target
build_target(t: Tensor, pos: Tensor, vel: Tensor, acc: Tensor) -> torch.Tensor
Assemble a batched 12D target tensor from motion primitives.
__post_init__
__post_init__()
Initialize shared tensors from the center batch shape when available.
sample
sample(t: Tensor) -> torch.Tensor
Sample the batched helix trajectory at time values t.
LemniscateTrajectory
dataclass
LemniscateTrajectory(*, yaw_from_velocity: bool = True, fixed_yaw: Tensor | None = None, attitude: Tensor | None = None, body_rate: Tensor | None = None, center: Tensor, scale: Tensor, omega: Tensor, z_amplitude: Tensor, z_frequency: Tensor, z_phase: Tensor)
Bases: SpatialTrajectory
Batched Bernoulli lemniscate trajectory with vertical oscillation.
方法:
| 名称 | 描述 |
|---|---|
sample_heading |
Sample batched yaw and yaw-rate references for time values |
build_target |
Assemble a batched 12D target tensor from motion primitives. |
__post_init__ |
Initialize shared tensors from the center batch shape when available. |
sample |
Sample the batched lemniscate trajectory at time values |
sample_heading
sample_heading(t: Tensor, pos: Tensor, vel: Tensor, acc: Tensor) -> tuple[torch.Tensor, torch.Tensor]
Sample batched yaw and yaw-rate references for time values t.
build_target
build_target(t: Tensor, pos: Tensor, vel: Tensor, acc: Tensor) -> torch.Tensor
Assemble a batched 12D target tensor from motion primitives.
__post_init__
__post_init__()
Initialize shared tensors from the center batch shape when available.
sample
sample(t: Tensor) -> torch.Tensor
Sample the batched lemniscate trajectory at time values t.
LissajousTrajectory
dataclass
LissajousTrajectory(*, yaw_from_velocity: bool = True, fixed_yaw: Tensor | None = None, attitude: Tensor | None = None, body_rate: Tensor | None = None, center: Tensor, amplitude: Tensor, frequency: Tensor, phase: Tensor, omega: Tensor)
Bases: SpatialTrajectory
Batched three-dimensional Lissajous trajectory.
方法:
| 名称 | 描述 |
|---|---|
sample_heading |
Sample batched yaw and yaw-rate references for time values |
build_target |
Assemble a batched 12D target tensor from motion primitives. |
__post_init__ |
Initialize shared tensors from the center batch shape when available. |
sample |
Sample the batched Lissajous trajectory at time values |
sample_heading
sample_heading(t: Tensor, pos: Tensor, vel: Tensor, acc: Tensor) -> tuple[torch.Tensor, torch.Tensor]
Sample batched yaw and yaw-rate references for time values t.
build_target
build_target(t: Tensor, pos: Tensor, vel: Tensor, acc: Tensor) -> torch.Tensor
Assemble a batched 12D target tensor from motion primitives.
__post_init__
__post_init__()
Initialize shared tensors from the center batch shape when available.
sample
sample(t: Tensor) -> torch.Tensor
Sample the batched Lissajous trajectory at time values t.
RectangleTrajectory
dataclass
RectangleTrajectory(*, yaw_from_velocity: bool = True, fixed_yaw: Tensor | None = None, attitude: Tensor | None = None, body_rate: Tensor | None = None, center: Tensor, size: Tensor, speed: Tensor)
Bases: SpatialTrajectory
Batched constant-speed rectangle trajectory in the horizontal plane.
方法:
| 名称 | 描述 |
|---|---|
sample_heading |
Sample batched yaw and yaw-rate references for time values |
build_target |
Assemble a batched 12D target tensor from motion primitives. |
__post_init__ |
Initialize shared tensors from the center batch shape when available. |
sample |
Sample the batched rectangle trajectory at time values |
sample_heading
sample_heading(t: Tensor, pos: Tensor, vel: Tensor, acc: Tensor) -> tuple[torch.Tensor, torch.Tensor]
Sample batched yaw and yaw-rate references for time values t.
build_target
build_target(t: Tensor, pos: Tensor, vel: Tensor, acc: Tensor) -> torch.Tensor
Assemble a batched 12D target tensor from motion primitives.
__post_init__
__post_init__()
Initialize shared tensors from the center batch shape when available.
sample
sample(t: Tensor) -> torch.Tensor
Sample the batched rectangle trajectory at time values t.
RandomTrajectoryCommand
RandomTrajectoryCommand(cfg: RandomTrajectoryCommandCfg, env: ManagerBasedEnv)
Bases: CommandTerm
Trajectory command generator with randomized type and parameters per environment.
RandomTrajectoryCommandCfg
Bases: CommandTermCfg
Configuration for randomized trajectory commands.
modify_reward_weight_linearly
modify_reward_weight_linearly(cfg: CurriculumTermCfg, env: ManagerBasedRLEnv)
Bases: ManagerTermBase
Curriculum term that linearly updates a reward weight during training.
died
died(env: ManagerBasedRLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg('robot'), min: float = 0.2, max: float = 2.0) -> torch.Tensor
Termination condition based on the robot's height.