Hi Lorenz,
> So to recap: Every complexity can be captured in a specialized mixer
> (its just C code), while simple use cases can be covered with default
> mixers. And all of them are configurable in a text file without the
> need to have people change Firmware code if they just want to adjust
> the travel of one of their actuators or add another channel.
We've discussed this before, but I thought it may be useful for me to
explain why I don't think the PX4 mixer model is a good fit for
ardupilot on this list.
As Robert points out, you don't need to change firmware to change the
travel of an actuator in ardupilot, or change the channel mapping. You
also don't need to edit a text file. All of those controls are MAVLink
parameters which are accessible from all our ground stations.
You do need to change firmware to add a completely new copter frame type
(eg. if you wanted to add a 7 motor frame type for some reason). That
has never really been an issue.
I think that requiring users to edit text files to change the travels of
their servos would in fact be quite a big backwards step in ardupilot. I
was really surprised when we were setting up the SkyWalker last year
with PX4 native that we needed to go and edit a text file in order to
reverse a control surface.
We could work around this by generating a mixer text file from the
current MAVLink parameters, and I am considering writing a generator
like that primarily as it would make supporting failsafe manual control
on fixed wing easier.
My biggest objection to the PX4 mixer system is somewhat different
though. Right now the handling of the mixing is in one place in our core
code for all boards. It doesn't matter if it is a PX4, a FlyMaple, a
PXF, an APM2 or SITL - ardupilot behaves the same on all boards. Moving
the mixing logic down into PX4Firmware would move a vital algorithmic
part of the autopilot logic into the PX4Firmware tree, which means the
mixer logic would need to be duplicated in at least two places, and we
lose the current guarantee of identical behaviour on all boards.
When I flew the PXF on the SkyWalker yesterday I just loaded the exact
parameters I had for the same airframe with Pixhawk onto the PXF and
threw it into the air. It flew exactly the same as it did with the
Pixhawk. This is one of the biggest strengths of ardupilot, and it is
something I don't want to risk weakening.
The second objection is around hiding PWM values. The PX4 mixer
architecture tries to hide PWM values from users. I can understand why
that seems appealing, but I think it is misguided. The whole world of
R/C currently revolves around these values. When I'm at the field I have
a servo tester that displays PWM values. I know the PWM values for
bottle drop mechanisms. The datasheet for my EPM release mechanism
specifies PWM values for holding/releasing the magnet. My transmitter
displays and processes PWM values internally.
So we'd need to provide access to these values regardless. I know that
with CANESC that PWM values don't have the same significance, but that
is a tiny fraction of our users so far. So for now I'd prefer to see a
mapping for CANESC where we make PWM=1000 be minimum and PWM=2000 be
maximum, then leave the rest of our structure alone.
I also think the solution Holger has posted here:
https://github.com/diydrones/ardupilot/pull/1322
is good for allowing people to choose to use the PX4 mixers if they want
to. That also seems to use a 1000 to 2000 mapping.
There are also some modes in APM:Plane that really make no sense with a
PX4 mixer. For example TRAINING mode. In that mode the mixing is either
pass-thru or stabilised separately on roll and pitch axes depending on
the attitude of the aircraft. The point of the mode is to teach people
to fly manually, so for pass-thru the controls are supposed to be
identical with or without an autopilot installed.
Cheers, Tridge