Configurable and persistent mixers with px4io support

Here is a branch which adds real time configuration of mixer parameters and the ability to store new mixer settings to file:

It is a rework of this pull px4 Firmware pull request 4844 which did not support px4io. Sorry, I can’t post the link since I passed my limit.

Looks at the description in the pull request for more details.

The new version attempts to support px4io. The problem with px4io is getting the mixer file back over the link without using lots of memory it doesn’t have. The solution is to have a copy of the mixer on the fmu side. All modifications to the px4io side are also done to the fmu side. That means that all mixer information can be obtained easily.

I don’t trust the link to be perfect. Instead of cross checking every mixer parameter I thought to do a checksum on the floating point data. This is where it all falls apart. There is precision loss between int->float->int conversions as can be seen from the mixer configuration output below. The 7999 values were originally 8000.

Any single bit of difference with a int->float conversion will completely change the checksum.
If I convert from float->int to do the checksum there will still be occasional differences.

This thing is close to working. Just need some extra magic for it.

nsh> mixer config /dev/pwm_output0
O: 10000 10000 0 -10000 10000
S: 0 2 -7000 -7000 0 -10000 10000
S: 0 1 -7999 -7999 0 -10000 10000
M: 2
O: 10000 10000 0 -10000 10000
S: 0 2 -7000 -7000 0 -10000 10000
S: 0 1 7999 7999 0 -10000 10000
M: 1

1 Like

Problem solved by doing a simple readback to verify. The px4io protocol crc check means the readback can be verified. Data is never directly read from px4io. We just verify that the data write was done. This has now become a pull request:

Huge progress in the last week.

  1. px4io is now fully supported
  2. Support for mavlink through parameters
  3. Submixers within a mixer can be accessed

Follow the pull request link above for more details

Lots of testing still to be done, starting with HITL which I don’t have setup yet.
@Mark_Whitehorn - I know you are busy but does this interest you?

The next big step towards making a usable system is to provide GCS support. Mavproxy would be easy. QGC would be nice.

This looks like a big improvement for fixed-wing setups. I’ll try it out as soon as I get a chance.

Mark, if you can do something as simple as changing an offset and seeing a px4io servo move that would be excellent. Much of this I should do myself but I don’t have the lab space to make the hardware setup.