Control multicopter via thrust F and moments M

So it’s still WIP but here is, what I achieved so far:

  • I pulled PR #10863 for a modified PX4 Firmware and merged it with the current stable v1.8.2
    – Note: there exists a corresponding PR for the changed MAVROS message (PR #1120) but for now I skipped that.
  • I deactivated the auto-lander module in my make-file as it was interfering and forced a mode switch to AUTO.LAND. In my case the edit was done in the cmake config for Aerocore 2.
  • Now I added a uORB publisher to the mc_att_control_main.cpp file in L#766. The code for that is basically:
_v_control_mode.flag_control_motor_output_enabled = true;
if (_v_control_mode_pub != nullptr) {
	orb_publish(ORB_ID(vehicle_control_mode), _v_control_mode_pub, &_v_control_mode);
}
else {
	_v_control_mode_pub = orb_advertise(ORB_ID(vehicle_control_mode), &_v_control_mode);
}

Remeber to add orb_advert_t _v_control_mode_pub{ nullptr }; /**< control mode publication */ in the mc_att_control.hpp.

  • Now (just for testing) I’ve manually overridden the control-inputs. One could do that via:
// Override the _actuators value
_actuators.control[0] =  1.0f;
_actuators.control[1] = -1.0f;
_actuators.control[2] = -1.0f;
_actuators.control[3] =  0.0f;

But remember that the input scales from -1 to 1.

Next step is obviously to implement the mentioned controller but I figured just controlling each motor on it’s own might help already.

And as this is by far more than a “hacky” way of doing so and as it is still WIP, not intended for testing, … I did not push my changes anywhere. I’ll probably do so, once I got it working in a more flexible and usable way.

2 Likes