Motor Failure Injection and offboard controller in hexacopter (Typhoon model)


I am currently working with PX4-ROS2 and Gazebo simulation, using PX4 version v1.15.0 alpha0. My goal is to simulate motor failure, and although I’ve discovered a command and a ROS2 topic designed for injecting such failures (Command: failure motor off), they don’t seem to function as expected; GPS failure simulation, in contrast, works fine. Additionally, I noticed a motor_failure_plugin in the Gazebo folder. Should this plugin be included in the model.sdf file to enable motor failure simulation? If so, I’m encountering issues activating this plugin, as it appears not to be enabled in the Gazebo folder’s CMake file. How can I activate and compile it?

Moreover, I’m working on developing an offboard controller that receives attitude states topics and current motor inputs and publishes motor inputs. I came across the offboard control mode option direct_actuator=True, but it seems like I would need to create a comprehensive controller (covering Position, Attitude, Rate, and Control Allocation) to utilize this feature. Is there an alternative approach to achieve my objective, especially considering my limited familiarity with C++? One strategy I’m considering is to revise a ‘control allocation’ module within the PX4 controller.

Thank you for your attention.