mapping the thrust and torques applied to the quadcopter to the PWM commands (PX4_Autopilot)

15 次查看(过去 30 天)
Hello,I'm trying to implement a simple Hardware-in-the-Loop (HITL) simulation using PX4 and the UAV Toolbox Support Package for PX4 Autopilots (using PX4 Host Target). Specifically, I've customized a different controller for the quadcopter. However, I'm having trouble understanding how to use the actuator_write block. I've read the documentation, which states that the input should be between -1 and +1. How can we map the thrust and torques applied to the quadcopter to the commands u? Thanks.

采纳的回答

Aditya Shah
Aditya Shah 2025-1-20
编辑:Aditya Shah 2025-1-22
Hi,
The PX4 architecture uses a "mixer" to convert high-level thrust and torque commands into actuator commands, tailored to the airframe's geometry. For more details, refer to the Control Allocation (Mixing) documentation.
For the mentioned SITL example, you can refer to the `generate_force_and_torques()` method in `~\PX4-Autopilot-1.14.3\src\modules\simulation\simulator_sih\sih.cpp`, to understand the derived quadcopter mixer matrix.
Note: The mixer defined in Simulink for this example uses a notation for roll and pitch that is opposite to that of the SIH plant mixer matrix used.
For more information on quadcopter mixers, refer to mixer_multirotor.py.
If you are not familiar with mixers and want to directly write Roll, Pitch, and Yaw values using the PX4 mixer, you can publish thrust to the uORB topic `VehicleThrustSetpoint` and roll, pitch, and yaw to `VehicleTorqueSetpoint`, respectively. Refer to this example: PX4 Hardware-in-the-Loop (HITL) Simulation with Manual Control for Fixed-Wing Plant in Simulink, which demonstrates a similar workflow for a different airframe(Plane).
Note: When writing to the uORB values, ensure that both inputs are normalized to the range [-1, 1] in the vehicle body FRD frame, where the Z-axis points downward . Additionally, with this workflow, you need to configure QGroundControl (QGC) to set the correct channels according to the plant being used.
Regards,
Aditya

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Quadcopters and Drones 的更多信息

产品


版本

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by