For example a Quadrotor X according to the documentation should be configured as follows,
Adjusting the motor’s CW and CCW rotation can be easily configured physically by change wires, however, what if you run into an issue where the motors are not positioned according to this layout?
For example, my motors are connected to my PM board which I had to mount upside down in my frame. This meant that physically the motors are flipped as shown below,
Is there a way in QGroundControl or otherwise to tell the autopilot that 1 CCW = M3; 3 CW = M1 and so on, in otherwise define a none-default configuration for a particular airframe?
There is a way if you absolutely can’t just rewire the motors or signals to comply, though it can be a headache to troubleshoot, maintain, and preflight if you really want to go that route. To tell the truth I’ve done it to just make wire management better by having motor numbers just go in a circle so nothing has to cross.
It’s not a configuration option though, so you would have to recompile the firmware. For some background see Mixing and Actuation, in particular the Multirotor Mixer section. The quad x mixer file quad_x.main.mix defines how each motor responds to commanded roll, pitch, and yaw rates.
R: 4x 10000 10000 10000 0
In this example it says to start with the “4x” formula and then scale each gain by 10000 (out of 10000), so to just apply the formula as is. The easiest way to make your modification would be to change that line to:
R: 4x -10000 10000 -10000 0
Since you need to invert the roll and the yaw, but the pitch response should be the same. You can choose to copy the file and make a new mixer then a new airframe per Adding a New Airframe for your personal code maintainence and sanity, or just edit it in place and compile just for this quad and it’ll work.
One more note: if you were wondering where “4x” comes from or wanted to make any changes that couldn’t be accomplished with scaling outputs, take a look at src/lib/mixer/MultirotorMixer/geometries/quad_x.toml
The file is pretty self-explanatory. The motors are just in order and you could change the coordinates and rotations, and optionally the names, to accomplish the same thing instead of changing the mixing definition. This is how I made the numbering go in a circle, for instance.
Thanks for your reply benasena, yeah I was actually looking at using the mixers like you said by inverting the roll and yaw. I ended up just rewiring internally, it’s mostly working fine now.
I also came across this parameter called PWM_MAIN_REVX, which I’m not sure exactly what it does, i assume it swaps the MAX and MIN value for a particular PWM channel? I don’t think it’s helpful in this case eitherway.