3D Robotics

Major new update for APM:Plane code

3689569417?profile=original

Good news from Andrew Tridgell and the rest of the APM:Plane (ArduPlane) dev team: they've pushed out a major new release (2.77). Major changes include: lots of updates for PX4 and Pixhawk, dual sensor support on Pixhawk and new throttle arming code.

The following is from Tridge's release announcement. Please post any questions or comments there. 

Pixhawk updates

The biggest set of changes are for the PX4 and Pixhawk boards. The Pixhawk production boards started shipping a few weeks ago and include some nice hardware features that didn't make it into the 2.76 release. The most important of these is dual sensor support. The Pixhawk has two gyros and two accelerometers, and (if you have an external GPS/compass combo) dual compass as well. In the 2.76 release only one of each of these sensors could be used. With the 2.77 release the health of each sensor is monitored and if one sensor fails the second sensor can take over. In addition to failover support the code logs both sets of sensor values both to MAVLink and to the logs on the microSD card, which is very useful for diagnostics. We are also working on dual GPS support which we hope to get into the next release. I have test flown the dual-GPS code a few times, but I didn't consider it complete enough for the 2.77 release, so I have left it out for now.


Arming support
The most user visible change in this release is a great contribution by Michael Day adding new arming code. For those of you who have flown APM:Copter you will know that you need to arm the copter before you can fly using the rudder stick on your transmitter. That can be a great safety feature for electric aircraft, and now APM:Plane has the option of the same type of arming code.

For the plane arming code we decided to make arming optional so as not to surprise existing users too much. Have a look at the documentation for the arming parameters for how to setup arming in APM:Plane 2.77.

Parameter storage
Another major change for this release is the way parameters are stored on PX4 and Pixhawk. In previous releases we stored parameters on a file on the microSD card. That usually worked fine, but recently there have been a few too many issues with FAT filesystem corruption of microSD cards, especially when powering off while writing to the SD card. For this release we have moved all parameters to the EEPROM on the PX4 and the FRAM chip on the Pixhawk. This makes parameter storage independent of the microSD card, avoiding parameters becoming corrupt due to microSD card problems. Parameters from a microSD card will be automatically copied to EEPROM/FRAM when you upgrade to APM:Plane 2.77.

Improved relay code
The relay and servo set code has had a major overhaul, with up to 4 relays now supported for MAVLink control and much better support for the DO_SET_SERVO, DO_SET_RELAY, DO_REPEAT_SERVO and DO_REPEAT_RELAY MAVLink commands. Along with these changes is a new parameter BRD_PWM_COUNT which allows you to specify how many auxillary PWM outputs to enable, with the remaining outputs being available as digital relays. This allows you to re-assign some of the aux servo outputs on Pixhawk for use as relays, by setting the RELAY_PIN, RELAY_PIN2, RELAY_PIN3 and RELAY_PIN4 parameters. The pin numbers for these pins start at 50 for the first aux servo pin, and go to 55 on Pixhawk.

Improved logging
There have been logs of logging improvements in this release. Apart from the dual sensor logging, we can now transfer on-board log files to the ground station over MAVLink, which makes it much easier to get detailed logs without having to pull a microSD card out, or boot to the CLI. We're hoping to remove the need for the CLI completely in a future release, doing everything over MAVLink.
The new logging code also includes the git version number of APM and (if needed) the PX4Firmware and PX4NuttX repositories used to build the firmware in the logs. This makes it easier to track down any issues to the exact code used.
Another important logging change when used with the new ARMING_REQUIRE option is that logging won't start until you arm. This prevents lots of small log files from accumulating, wasting space on the APM2 and cluttering up your microSD card on PX4 and Pixhawk. 

Loiter change
A small change in the loiter code now makes it possible to change the direction of loiter while loitering, by setting the loiter radius to a negative number. This is mostly useful for testing, but it was also requested by one user.
Health reporting
The reporting of sensor health to the ground station is much improved, allowing the operator to know more quickly when a sensor has failed. This includes the health of a digitial airspeed sensor, as well as inertial sensors and the compass.

Initial Sonar Support
This release includes the beginning of sonar support for landing. This is still experimental, and thus far it can't actually be used to control landing, but you can configure a sonar and log the recorded sonar distance and voltages for analysis.

Reverse throttle fix
A bug was fixed in the handling of throttle failsafe for internal combustion aircraft with reversed throttles. If you fly IC and have throttle reveral then you need this fix!

HIL improvements
Lots of improvements were made to HIL support, including better handling of slow HIL connections, plus much faster HIL servo updates. It now flies a lot better in HIL. Another useful feature is that the SIMSTATE MAVLink message is now included in HIL MAVLink messages, which makes it possible to compare the true attitude with the attitude that APM has calculated from the sensor input. This is very useful when diagnosing HIL issues.

More telemetry ports
On Pixhawk and PX4 you can now have a 3rd telemetry port, allowing USB and two serial telemetry ports to be active at the same time, which is very useful when you have an onboard computer.

Geo-fence return altitude
Another improvement from Michael Day is the inclusion of the FENCE_RETALT parameter which allows better control over the return altitude on fence breach.

Airspeed fixes
There have been a few fixes related to airspeed handling. One is to handle the case where airspeed reading too low due to the ARSPD_RATIO being too low. The airspeed autocal code didn't fix this as it only ran when airspeed was above the minimum airspeed. We now run the airspeed autocal code if either GPS groundspeed or airspeed is above the minimum airspeed.
A second airspeed related but was to fix a scaling factor for true airspeed in the pitch controller (thanks to Paul Riseborough for the fix!).

Upcoming Changes
There are a lot more changes in the pipeline for APM:Plane! The biggest thing being worked on right now is the new Extended Kalman Filter (EKF) code from Paul Riseborough for attitude estimation and inertial navigation. It is producing great results, but we decided to hold off on releasing it as we want a bit more testing first. 

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Great work Tridge

    Will this good work (where appropriate) be folded into the copter code as well?

    Things like multi sensor, multi GPS, more telem ports etc 

    Thanks

    MK

  • 100KM
    I'm so looking forward to the auto tune for plane, since copter works so well. Plane should be an easier task .
  • Developer

    @Graham, yes, sorry, we really should have an auto-tune mode. Right now properly tuning takes far too much effort. We will get an auto-tune eventually, but for now the tuning guides is the best we have.

    What angle should we attempt to climb at? Because I suspect we could climb at 60 deg at THR_MAX of 100. Do we reduce the THR_MAX until we maintain speed at a LIM_PITCH_MAX of 20 deg or do we try maintain speed at a climb angle of 60 deg?

    Use the pitch limit you have set, which means FBWA will limit you to 20 degrees with your current settings.

    The reason this setting matters is that the TECS code uses it to estimate how quickly the plane will climb when it pitches up and raises the throttle to try to gain altitude when it is too low. The default is 5 m/s, but I suspect your plane can climb more quickly than that at the 20 degree pitch limit. That will tend to make TECS overshoot, which can lead to oscillation in altitude around the target.

    Once we write an auto-tuner the plane should do the experiment itself and measure how fast the plane can climb.

    Cheers, Tridge

  • Moderator

    60 degrees nose up might put you into a bit of a pickle in the event of an engine out?

  • 100KM

    This is going to be an incredible year for us all...thanks to you guys.

  • Moderator

    Tridge, we have followed quite of the tuning guide but there being so many steps and us being time limited were hoping most of the defaults would suffice. We'll go and do the FBWA test. 

    What angle should we attempt to climb at? Because I suspect we could climb at 60 deg at THR_MAX of 100. Do we reduce the THR_MAX until we maintain speed at a LIM_PITCH_MAX of 20 deg or do we try maintain speed at a climb angle of 60 deg?

  • Developer

    @Hein, the pixhawk isn't limited to 115kbaud on USB. It doesn't matter what baud rate you select in Mission Planner, as its not really a serial link so it isn't baud rate limited. You can get well over 1MBit even if you select 9600 baud in the drop down menu.

    The measured speed of log download on a Pixhawk on USB is between 160 and 170 kbytes/sec, which is about 1.3 MBit/s.

    The APM2 uses a different sort of USB interface that is emulating a serial port, so it is baud rate limited. That isn't the case for the Pixhawk.

    Cheers, Tridge

  • Developer

    Hi Graham,

    I'm guessing you have already been over this with Paul, but I wonder if you have tried following the TECS tuning guide? The test that I'd particularly be interested in for your aircraft is the climb test in FBWA. Go to full throttle in FBWA, and try to climb as fast as you can using elevator, then look at the achieved climb rate in m/s from VFR_HUD.climb. It looks like your plane can climb at 8m/s or more, so TECS_CLMB_MAX should be a bit more than you currently have it set to. That estimate comes from your takeoff though - it would be better to do the FBWA test as describes in the tuning guide.

    Cheers, Tridge

  • Moderator

    Oh and negative loiter radius doesn't work for some reason, we couldn't change the Loiter direction in flight.

  • Moderator

    Had a couple flights this morning with v2.77, here's the relative altitude during a loiter, with about a 12m variation during one circuit. 

    3692926935?profile=originalPerhaps some more tuning is needed?

    tlog here

This reply was deleted.