UMjArticulationController¶
Abstract base for custom articulation control laws.
Derive from this class to implement custom controllers (PD, impedance, operational-space, etc.). Override ComputeAndApply() with your control logic. The base class handles actuator→DOF binding automatically. Add your controller as a component on an AMjArticulation Blueprint. ApplyControls() will find it and delegate control computation to it. Example: UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) class UMyController : public UMjArticulationController { GENERATED_BODY() public: virtual void ComputeAndApply(mjModel m, mjData d, uint8 Source) override { for (int32 i = 0; i < Bindings.Num(); ++i) { float target = Bindings[i].Component->ResolveDesiredControl(Source); float pos = (float)d->qpos[Bindings[i].QposAddr]; float vel = (float)d->qvel[Bindings[i].QvelAddr]; // ... your control law ... d->ctrl[Bindings[i].ActuatorMjID] = torque; } } };
| Attribute | Value |
|---|---|
| Kind | Class |
| UE Macro | UCLASS |
| Inherits | UActorComponent |
| Blueprint Spawnable | ✅ Yes |
Properties¶
Public Properties¶
| Property | Type | Description |
|---|---|---|
bEnabled |
bool |
Is this controller active? If false, ApplyControls falls through to default path. |
bEnabled¶
Is this controller active? If false, ApplyControls falls through to default path.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Controller
Protected Properties¶
| Property | Type | Description |
|---|---|---|
Bindings |
TArray<FActuatorBinding> | Actuator→DOF bindings, populated by Bind(). |
Functions¶
Public Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
Bind() |
void | Called once after the MuJoCo model compiles. Resolves actuator→DOF |
ComputeAndApply() |
void | Called every physics step from AMjArticulation::ApplyControls(). |
IsBound() |
bool |
Has Bind() been called successfully? |
GetNumBindings() |
int32 |
Number of bound actuators. |
GetBindings() |
const TArray<FActuatorBinding>& | Access bindings (for gain configuration by name). |
Bind¶
Called once after the MuJoCo model compiles. Resolves actuator→DOF
- Signature:
Bind(mjModel*m,mjData*d,constTMapUMjActuator\*>& ActuatorIdMap)
ComputeAndApply¶
Called every physics step from AMjArticulation::ApplyControls().
- Signature:
ComputeAndApply(mjModel*m,mjData*d,uint8Source)
GetBindings¶
Access bindings (for gain configuration by name).
- Signature:
GetBindings() - Returns: const TArray<FActuatorBinding>&