Change motor layout for quad

#1

Hi,
For some reason, I am considering to change assigned motor layout.

http://dev.px4.io/airframes-motor-map.html
This is original layout of PX4.

My question is that which part of the code will affect this?
I am using pixracer, (px4fmu-v4) so I think

https://github.com/PX4/Firmware/blob/master/src/drivers/boards/px4fmu-v4/board_config.h#L209

This is all I have to change.

Is this right?

#2

I know this post is old, but it is still useful to get an answer.

Changing the layout could be:

  1. Physically, the props still spin in the same direction. but the motor numbers are changed: for example, when using the omnibus flight controller with 4-in-1 ESC (designed for Betaflight), one has to set the parameter MOT_ORDERING to Betaflight/Cleanflight. Note that if you need a different motor ordering, it is totally possible, but requires some a few changes in the firmware.

  2. Change from CCW to CW and vice-versa : the only axis affected is YAW. Therefore, you just need to change the sign of the yaw gain in the mixer file R: 4x 10000 10000 10000 0 -> R: 4x 10000 10000 -10000 0

CW   -  CCW    CCW -  CW
     |      to     |
CCW -  CW       CW  - CCW

Hope it helped!

#3

@bresch, to change from CCW to CW, the best IMO is to use the mixer quad_h.

See https://docs.px4.io/en/airframes/airframe_reference.html, quad_h is quad_x with reserved prop directions.

1 Like
#4

Hi. I think this problem is actual (e.g. if some motor pwm out was burned), so it’s better to answer late than never.
I found array with output definitions in a platform-specified code (e.g. for fmu-v4), where pwm states are written:


So if I swap some elements in this array, pwm states will be written in another order.
Example can be found here (swap ch2 and ch5 in pixracer, so left rear motor in quad x is connected to aux1, ch2 has an aux1 function): https://github.com/CopterExpress/Firmware/commit/17a3f3e79139ed76cff05b898f41a5728992bcd2

Remapping motor output
Swapping Motor Outputs in Software