Skip to content

PX4 X-Quadcopter Controller ​

Flare Live 3.0 · Scene Object · API type simexp.uav.multicopter_controller.

A PX4-inspired X-quadcopter position/attitude/rate controller and mixer. Attach directly to a Joint-Body Pair whose frame is the measurement/control frame (+X forward, +Z up). Assign actual FL/FR/BL/BR motor references; object traversal order is not rotor assignment.

Input length is variable. First value selects mode: 0 = 12-value world position/velocity/acceleration/yaw/yaw-rate command; 1 = quaternion wxyz/yaw-rate/throttle (7 values); 2 = local angular rates/throttle (5); 3 = local torques/throttle (5). Negative mode disables motors. Angles/rates use rad and rad/s. NaN is allowed only for the fields documented by the runtime input description. See P600.

Properties ​

Values below are defaults for new objects. See common properties for shared fields, case-sensitive API paths and conditional visibility.

General ​

API pathConstructor default / enum choicesMeaning / unitsEditable in Simulation
front_left_motorNoneScene object receiving the front-left throttle command. Choose a motor on that arm in the controller frame that accepts one normalized throttle input.No
front_right_motorNoneScene object receiving the front-right throttle command. Choose a motor on that arm in the controller frame that accepts one normalized throttle input.No
back_left_motorNoneScene object receiving the rear-left throttle command. Choose a motor on that arm in the controller frame that accepts one normalized throttle input.No
back_right_motorNoneScene object receiving the rear-right throttle command. Choose a motor on that arm in the controller frame that accepts one normalized throttle input.No

Mixer ​

API pathConstructor default / enum choicesMeaning / unitsEditable in Simulation
mixer.yaw_weight1.0Dimensionless multiplier on the alternating yaw correction added to the four motor commands. Zero removes yaw authority from the mixer.No

Rate Controller ​

API pathConstructor default / enum choicesMeaning / unitsEditable in Simulation
rate_controller.control_frequency250.0Target update rate of the body angular-rate loop, in Hz. The rate loop executes at most once per simulation step.No
rate_controller.k_gain.roll0.15Scales the roll rate error and the measured rate change before all three rate PID terms.No
rate_controller.k_gain.pitch0.15Scales the pitch rate error and the measured rate change before all three rate PID terms.No
rate_controller.k_gain.yaw0.2Scales the yaw rate error and the measured rate change before all three rate PID terms.No
rate_controller.proportional_gain.roll1.0Gain from scaled roll rate error to the immediate mixer command.No
rate_controller.proportional_gain.pitch1.0Gain from scaled pitch rate error to the immediate mixer command.No
rate_controller.proportional_gain.yaw1.0Gain from scaled yaw rate error to the immediate mixer command.No
rate_controller.integral_gain.roll1.33Accumulates scaled roll rate error over time to correct steady offset.No
rate_controller.integral_gain.pitch1.33Accumulates scaled pitch rate error over time to correct steady offset.No
rate_controller.integral_gain.yaw0.5Accumulates scaled yaw rate error over time to correct steady offset.No
rate_controller.derivative_gain.roll0.02Opposes changes in measured roll rate. Differentiates the observation so a setpoint jump does not directly enter this term.No
rate_controller.derivative_gain.pitch0.02Opposes changes in measured pitch rate. Differentiates the observation so a setpoint jump does not directly enter this term.No
rate_controller.derivative_gain.yaw0.0Opposes changes in measured yaw rate. Differentiates the observation so a setpoint jump does not directly enter this term.No
rate_controller.integral_limit.roll0.3Symmetric absolute limit on the accumulated roll integral contribution in mixer command units. Zero disables that contribution.No
rate_controller.integral_limit.pitch0.3Symmetric absolute limit on the accumulated pitch integral contribution in mixer command units. Zero disables that contribution.No
rate_controller.integral_limit.yaw0.3Symmetric absolute limit on the accumulated yaw integral contribution in mixer command units. Zero disables that contribution.No

Attitude Controller ​

API pathConstructor default / enum choicesMeaning / unitsEditable in Simulation
attitude_controller.control_frequency250.0Target update rate of the attitude-to-body-rate loop, in Hz. The attitude loop executes at most once per simulation step.No
attitude_controller.proportional_gain.roll6.5Gain from the roll component of the attitude error to the desired body rate.No
attitude_controller.proportional_gain.pitch6.5Gain from the pitch component of the attitude error to the desired body rate.No
attitude_controller.proportional_gain.yaw2.8Gain from the yaw component of the attitude error to the desired body rate.No
attitude_controller.integral_gain.roll0.0Accumulates roll attitude error into the requested body rate over time.No
attitude_controller.integral_gain.pitch0.0Accumulates pitch attitude error into the requested body rate over time.No
attitude_controller.integral_gain.yaw0.0Accumulates yaw attitude error into the requested body rate over time.No
attitude_controller.derivative_gain.roll0.0Uses measured roll angular rate to damp the attitude loop's rate request.No
attitude_controller.derivative_gain.pitch0.0Uses measured pitch angular rate to damp the attitude loop's rate request.No
attitude_controller.derivative_gain.yaw0.0Uses measured yaw angular rate to damp the attitude loop's rate request.No
attitude_controller.max_output_angular_rate.roll3.84Absolute bound on the roll rate requested by the attitude loop, in rad/s. Applied after yaw-rate feedforward.No
attitude_controller.max_output_angular_rate.pitch3.84Absolute bound on the pitch rate requested by the attitude loop, in rad/s. Applied after yaw-rate feedforward.No
attitude_controller.max_output_angular_rate.yaw3.49Absolute bound on the yaw rate requested by the attitude loop, in rad/s. Applied after yaw-rate feedforward.No
attitude_controller.yaw_weight0.4Fraction of the desired yaw correction blended into the target orientation after aligning the thrust axes. Use 0 to prioritize thrust direction alone and 1 for the full yaw correction.No

Position Controller ​

API pathConstructor default / enum choicesMeaning / unitsEditable in Simulation
position_controller.control_frequency250.0Target update rate of the position/velocity loop, in Hz. This loop generates attitude and throttle requests and executes at most once per simulation step.No
position_controller.velocity_proportional_gain(1.8, 1.8, 4.0)XYZ gains from world velocity error to acceleration correction. The X gain must be nonzero for the horizontal saturation feedback calculation.No
position_controller.velocity_integral_gain(0.4, 0.4, 2.0)XYZ gains accumulating world velocity error into an acceleration correction.No
position_controller.velocity_derivative_gain(0.2, 0.2, 0.0)XYZ gains that oppose changes in measured world velocity. This term reacts to measured acceleration.No
position_controller.max_tilt0.785Maximum tilt angle of the requested thrust direction away from upright, in radians.No
position_controller.hover_throttle0.5Normalized throttle estimate for level hover. The controller uses it to convert requested vertical acceleration into throttle. Set a positive value consistent with the vehicle.No
position_controller.min_throttle0.12Minimum normalized collective throttle used by the position loop, including vertical saturation feedback.No
position_controller.max_throttle1.0Maximum magnitude of the position loop's normalized throttle vector. The loop shares this budget between vertical and horizontal demands.No
position_controller.horizontal_throttle_margin0.3Normalized throttle budget reserved for horizontal control when vertical demand saturates. Keep it between zero and Max throttle.No
position_controller.position_proportional_gain(0.95, 0.95, 1.0)XYZ gains converting world position error in meters to a velocity correction in m/s.No
position_controller.position_integral_gain(0.0, 0.0, 0.0)XYZ gains accumulating position error into the velocity request.No
position_controller.position_derivative_gain(0.0, 0.0, 0.0)XYZ gains that damp the position-loop velocity request using the measured change in position per second.No
position_controller.max_horizontal_velocity12.0Maximum magnitude of the requested horizontal velocity vector, in m/s. Position correction takes priority over velocity feedforward when the request saturates.No
position_controller.max_up_velocity3.0Positive limit on upward requested velocity, in m/s.No
position_controller.max_down_velocity1.5Positive magnitude of the downward requested velocity limit, in m/s.No

Simulation input/output ​

The first input selects a mode; supply the corresponding whole vector. No outputs: read Body Info and rotor Joint Sensors for feedback.

ModeVector lengthFields after mode
0: Position12World position XYZ (m), world velocity XYZ (m/s), world acceleration XYZ (m/s²), yaw (rad), yaw rate (rad/s). Position-mode setpoint fields may use NaN to leave those targets unspecified.
1: Attitude7Quaternion w/x/y/z, yaw rate (rad/s), throttle (0–1).
2: Rate5Local roll/pitch/yaw rates (rad/s), throttle (0–1).
3: Torque5Local roll/pitch/yaw torques (N·m), throttle (0–1).
Negative: Disabled1For example [-1]; disables the controller's motor commands.

A position command for (0, 0, 1) m at yaw 0 is:

python
import math
command = [0, 0, 0, 1, math.nan, math.nan, math.nan,
           math.nan, math.nan, math.nan, 0, math.nan]

The P600 tutorial applies this command in a complete control loop.