Commit Graph

3353 Commits

Author SHA1 Message Date
Andrew Tridgell 4bc53acbda SITL: support vsnprintf with %S on SITL 2013-05-08 16:17:36 +10:00
Andrew Tridgell 9cd0af1132 HAL_PX4: make PX4 snprintf support %S format
just maps it to %s for normal printf
2013-05-08 16:17:06 +10:00
Andrew Tridgell 223dfe4de5 AP_Rangefinder: added units for settle time 2013-05-08 14:21:32 +10:00
Randy Mackay 328d900647 WPNav: flexible loiter speed
Also includes bug fix to allow speeds > 10m/s during missions
2013-05-07 17:11:24 +09:00
Randy Mackay 1f8161b493 AC_WPNav: remove unnecessary speed constraint 2013-05-07 11:58:04 +09:00
priseborough aee23361dd APM_Control: Corrected typographical error in APM_Control/TuningGuide.txt 2013-05-07 11:00:57 +10:00
Andrew Tridgell 6f1cee6406 AP_AHRS: fixed position estimate with 2D fix or low satellite count
we should still use the GPS for position fixes when we have a low
number of satellites, but we should stop using it for velocity
estimates and attitude correction.
2013-05-07 10:52:14 +10:00
Andrew Tridgell 055da3c4b6 SITL: added SIM_GPS_NUMSATS parameter
this allows testing of the DCM code with less than 6 satellites
2013-05-07 10:38:36 +10:00
Randy Mackay ceda7d26b0 AHRS: add correct_centrifugal and flags structure 2013-05-06 15:32:06 +09:00
Andrew Tridgell 46c6aa8a9a APM_Control: tweak the parameter names 2013-05-05 21:51:09 +10:00
Andrew Tridgell 400777b059 APM_Control: support inverted flight in AP_PitchController
auto-reverse pitch control when inverted. This is useful not just for
inverted flight mode, but also for recovering from poor manual flight

Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2013-05-05 21:51:09 +10:00
Andrew Tridgell 604bfd0700 APM_Control: adjust recommended ranges 2013-05-05 21:51:09 +10:00
Andrew Tridgell 7af3c667a5 APM_Control: added roll controller parameter docs 2013-05-05 21:51:09 +10:00
Andrew Tridgell 52c3f8841f APM_Control: added yaw parameter docs 2013-05-05 21:51:09 +10:00
Andrew Tridgell b618d1d81f APM_Control: added inline docs to pitch controller 2013-05-05 21:51:09 +10:00
Andrew Tridgell 6c6c0079ee APM_Control: improved formatting of tuning guide
be a bit more web friendly
2013-05-05 21:51:09 +10:00
Andrew Tridgell 742df0ac05 APM_Control: rename to avoid spaces in filenames 2013-05-05 21:51:09 +10:00
Andrew Tridgell 23d9c31b0a APM_Control: fixed build and merge errors 2013-05-05 21:51:08 +10:00
Paul Riseborough 10ecffce01 APM_Control: ROLL and PITCH controllers
These changes reduce height variation in turns and improve
robustness. the specific changes are:

1) Linked roll and pitch integrator protection to the final output
value so that if final output is on upper limit, the integrator is
prevented from increasing and vice-versa. This improves wind-up
protection.

2) Modified rate feedback in roll and pitch controllers to use body
rates rather than Euler or earth rates.

3) Changed the roll to pitch compensation to use measured roll angle
and estimated airspeed to calculate the component of turn rate
(assuming a level coordinated turn) around the pitch axis. This a
mathematically correct calculation and will work over a range of bank
angles and aircraft with minimal (if any) tuning required.

4) The integrator in the roll and pitch loop is clamped when the
estimated speed is below the minimum FBW speed

5) The noise filter in the pitch and roll loop has been changed to use
a FOH discretisation. This gives improved noise rejection and less
phase loss when compared to the previous filter that used a ZOH or
equivalent discretisation.

This has been flown on the rascal in the SITL and on a X-8 with
limited flight testing. Initial results have been encouraging with
reduced height variation in turns.  Compare to standard PIDS, the
revised pitch and roll controllers allow the use of rate feedback
(effectively the same as the old D term) without beating the servos to
death.  The bank angle compensation in the pitch loop works
effectively over a much larger range of bank angles and requires
minimal tuning compared to the old calculation.

YAW CONTROLLER

Currently testing the a 3-loop acceleration autopilot topology for the
yaw loop with feed forward yaw rate for turn compensation. This 3-loop
topology is commonly used in tactical skid to to turn missiles and is
easy to tune. The following block diagram shows the general signal
flow

Note that the acceleration measurement has to pass through an
integrator before it gets to the actuator. This is a important feature
as it eliminates problems of high frequency noise and potential
coupling with structural modes associated with direct feedback of
measured acceleration to actuator.

The high pass filter has been inserted to compensate for airspeed and
bank angle measurement errors which will cause steady state errors in
the calculation of the turn yaw rate.

The yaw controller flies SITL well, but hasn't been flight tested
yet. It can be configured either as a simple yaw damper, or the
acceleration and integral term can be turned on to allow feedback
control of lateral acceleration/sideslip.

TO DO:

Need to reduce number of tuning parameters and provide consistent
naming Need to provide guidance on tuning these loops with definitions
for all the gain terms.  Need to check signs and units into and out of
lateral loops.

DESIGN DECISIONS PENDING:

1) Can we remove the noise filters? Provided the mpu6k noise filter is
running they are of limited benefit given the 25Hz Nyquist frequency

2) If we do remove them and rely on the mpu6k noise filter, what is
the apprporiate default cutoff frequency for plane use. 20Hz is
probably OK for most setups, but some noisy/high vibration setups
would require as low as 10Hz

3) The inverted flight logic looks like a crash waiting to
happen. It's problematic to test and even if implemented correctly
would still crash a plane with poor inverted flight capability. We
should either implement it properly and fully tested or delete it.
2013-05-05 21:51:08 +10:00
priseborough 205397d030 APM_Control: Modified calculation of bank compensation rate offset to prevent climb if speed > max fbw speed
The previous calculation constrained the speed used to calculate the
bank compensation rate offset between the min and max fbw speeds. This
would result in an unwanted climb if flown above the max fbw speed
(this could happen in fbw-a mode)
2013-05-05 21:51:08 +10:00
priseborough e7736ed4e0 APM_Control: APM tuning guide.txt - Updated tuning instructions with numerical values for alternate method 2013-05-05 21:51:08 +10:00
Paul Riseborough 3034a9fab2 APM_Control: Added alternate tuning method for roll and pitch loops
The alternate tuning method for roll and pitch will give a better
results, but comes with more risk as it will result in a larger rate
feedback gain
2013-05-05 21:51:08 +10:00
priseborough 2c29186b03 APM_Control: APM tuning guide.txt - Minor editorial corrections 2013-05-05 21:51:08 +10:00
priseborough d159d39037 APM_Control: APM tuning guide.txt - Added step by step tuning description. 2013-05-05 21:51:08 +10:00
priseborough 99f0fb6bd2 APM_Control : Removed 20Hz low-pass filters on rate gyro inputs.
These are not required due to MPU 6000 filtering.
2013-05-05 21:51:08 +10:00
priseborough 317b75f4cd APM_Control: Added tuning guide readme 2013-05-05 21:51:08 +10:00
Andrew Tridgell 9654546b5a AP_L1_Control: Cleaned up calculation of damping to reduce computations
also removed _cross2D, using math library instead
2013-05-05 21:51:08 +10:00
Randy Mackay 30faf87715 InertialNav: use AP_Math's longitude_scale 2013-05-05 14:32:25 +09:00
Randy Mackay 7c9d9b9800 AP_Math: use DEG_TO_RAD in longitude_scale
Also increased accuracy of RadiansToCentiDegrees although it is like the
compiler will throw away the extra digits anyway.
2013-05-05 14:31:24 +09:00
Andrew Tridgell 38fc0e61c6 AP_AHRS: optimise yaw drift correction
use new vector2 cross product, and factor out the z component of a dcm
mul_transpose() to reduce the number of floating point operations for
a yaw drift correction cycle
2013-05-05 13:51:45 +10:00
Andrew Tridgell 737f0305ef AP_Math: implement vector2 cross product
useful in DCM for faster yaw correction
2013-05-05 13:47:51 +10:00
Andrew Tridgell f4189e083b AP_Math: added mulXY() for matrix3 and vector3
returns the XY components of the product
2013-05-05 13:47:23 +10:00
Randy Mackay ee2daf25b6 AHRS: perf improvement by caching declination vector 2013-05-05 12:58:43 +10:00
Andrew Tridgell 943a1d8c8d AP_AHRS: added AHRS_GPS_MINSATS option
if the number of visible satellites is below AHRS_GPS_MINSATS then
don't use the GPS for acceleration correction for attitude
2013-05-05 12:48:01 +10:00
Randy Mackay c20eac7a70 AP_InertialNav: use standard LATLON_TO_CM, DEG_TO_RAD constants 2013-05-04 15:04:55 +09:00
Andrew Tridgell 99d21854f9 SITL: fixed drift rate limit in simulator 2013-05-04 15:16:35 +10:00
Andrew Tridgell 53ebcfeba5 SITL: fixed compass vector to be based on yaw not GPS heading
Many thanks to Randy for noticing this, and apologies for the wasted time!
2013-05-04 14:28:08 +10:00
Randy Mackay 1cfd5900a8 Copter: add support for H-quad frame
H-quads are like X quads but the motors spin in the opposite direction.
Having the motors reversed seems to help with yaw authority because of
the slight flex in bodies
2013-05-03 23:13:40 +09:00
Randy Mackay 647a93e78e Copter: remove jerk when entering RTL or AUTO
Loiter target position was not being initialised properly.
Add a few more comments
2013-05-03 16:58:00 +09:00
Randy Mackay bd75de6a22 AC_Fence: reduce to 150m radius and 100m high
100m high,
2013-05-03 14:57:37 +09:00
Andrew Tridgell 6cc9939891 AP_ADC: added dummy stop_pin and settle_time calls 2013-05-03 11:11:40 +10:00
Andrew Tridgell 0e66bac70b AP_RangeFinder: removed special case for APM1
the airspeed port doesn't have enough power for the sonar anyway
2013-05-03 10:09:54 +10:00
Andrew Tridgell 244a10aeb6 HAL_SMACCM: fixed build for new AnalogIn API 2013-05-03 10:09:14 +10:00
Andrew Tridgell 9bc48c9894 HAL_PX4: fixed build with new AnalogIn API
pin settle times not actually implemented on PX4 yet
2013-05-03 10:09:02 +10:00
Andrew Tridgell 5ac493908c SITL: fixed build with new AnalogIn API 2013-05-03 10:08:39 +10:00
Andrew Tridgell 09ca9d4283 AP_Rangefinder_analog: implement settle time and stop_pin 2013-05-03 09:45:19 +10:00
Andrew Tridgell 5d80a5619d HAL_Empty: add new API functions 2013-05-03 09:45:19 +10:00
Andrew Tridgell 912ed2c97c HAL_AVR: initialise settle time 2013-05-03 09:45:19 +10:00
Andrew Tridgell e7a6b12ac1 HAL_AVR: support set_stop_pin() and set_settle_time() for analogin
useful for dual sonar support
2013-05-03 09:45:19 +10:00
Andrew Tridgell 0b6cfc7294 AP_HAL: added set_stop_pin() and set_settle_time() interfaces to analogin
this is for multiple sonars on one vehicle, to prevent them
interfering with each other
2013-05-03 09:45:19 +10:00
Andrew Tridgell 0242d50ad4 DataFlash: added Log_Write_Message()
useful for logging general messages
2013-05-03 09:18:14 +10:00
Andrew Tridgell ccd38e58a1 HAL_PX4: fixed the scaling on the analog pins 2013-05-02 21:40:15 +10:00
Andrew Tridgell 500497f5fa AP_HAL: update AnalogIn test to show the first 16 pins 2013-05-02 21:31:55 +10:00
Andrew Tridgell c90d44c121 AP_Compass_HIL: fixed indentation 2013-05-02 21:31:17 +10:00
Andrew Tridgell 26bf636541 AP_Baro: fixed a build warning 2013-05-02 21:31:04 +10:00
Andrew Tridgell 65183887e5 SITL: use new baro setHIL method 2013-05-02 15:27:27 +10:00
Andrew Tridgell 90cf1b0386 AP_ADC: removed unused setHIL method 2013-05-02 15:27:16 +10:00
Andrew Tridgell 7cec3caf19 AP_Baro: cleaned up setHIL method
move pressure calculation into library
2013-05-02 15:26:38 +10:00
Andrew Tridgell c6c1fce2f1 AP_Baro: removed HIL constructor
this wasn't calling the parent class
2013-05-02 15:16:52 +10:00
Andrew Tridgell 811c2ccc11 libraries: fixes for AP_Baro_HIL 2013-05-02 15:09:05 +10:00
Andrew Tridgell 2d089174cd AP_Baro: rename AP_Baro_BMP085_HIL to AP_Baro_HIL
there is nothing specific to the BMP085 in it
2013-05-02 15:08:42 +10:00
Andrew Tridgell a09c53a3ea SITL: use new HIL compass API 2013-05-02 15:01:47 +10:00
Andrew Tridgell f72dd560cb AP_Compass: fixed the HIL sensors compass
this sets up good compass values for HIL sensors
2013-05-02 14:59:33 +10:00
Andrew Tridgell 86027f6e0f AP_Compass: fixed PX4 build 2013-05-02 13:00:52 +10:00
Andrew Tridgell af50b652f8 AP_Compass: removed old orientation defines
we now use the rotations in libraries/AP_Math/rotations.h
2013-05-02 12:48:14 +10:00
Andrew Tridgell 261eb6d841 AP_Declination: fixed example build 2013-05-02 12:48:14 +10:00
Andrew Tridgell 54b826a583 AP_AHRS: update for new compass API 2013-05-02 12:48:14 +10:00
Andrew Tridgell 217f34e155 AP_Compass: added COMPASS_ORIENT parameter, to support external compasses
this allows the user to configure the compass for any orientation
supported by our rotation library
2013-05-02 12:48:14 +10:00
Andrew Tridgell ba83950fc4 libraries: replace constrain() with constrain_float()
this makes the type much more obvious. Thanks to Tobias for the
suggestion.
2013-05-02 10:25:40 +10:00
Andrew Tridgell 813e767efb AP_Param: use const refs in a few more places
reduces code size by a couple of hundred bytes
2013-05-02 10:18:36 +10:00
Randy Mackay 4fcb189c97 GCS_MAVLink: typo in message definition 2013-05-01 17:07:18 +09:00
Randy Mackay 2d17688363 AC_Fence: add backup fence
Also includes fixes from code review with Tridge
2013-05-01 17:05:04 +09:00
Andrew Tridgell 0fce0eb488 AP_Compass_PX4: fixed handling of a saturated compass
a saturated compass is now marked unhealthy, rather than causing the
code to spin waiting for a valid sample. This fixes a problem with
strong magnets causing the main flight loop to stop
2013-05-01 08:54:53 +10:00
Andrew Tridgell d7ec985029 AP_Baro_PX4: fixed baro driver to run at full rate
we were skipping samples due to a timer handling bug. It now checks
for new samples at 100Hz
2013-05-01 08:54:53 +10:00
Randy Mackay ad01aeee44 Copter: increase max loiter overshoot to 8.12m 2013-04-30 18:07:48 +09:00
Randy Mackay 8122a32114 InertialNav: reduce XY TC to 2.5 (was 3)
More objective testing is required to arrive at the ideal number but 2.5
seem better than 3.0 at reducing "toiletbowling" and anecdotal evidence
does not show much downside.
2013-04-30 12:52:28 +09:00
Randy Mackay c139134192 Copter: increase max loiter speed to 7.5m/s 2013-04-30 12:49:19 +09:00
Randy Mackay 6c081c3def AC_WPNav: slow acceleration of intermediate point 2013-04-30 10:20:23 +09:00
Randy Mackay 00146ca97d AP_HAL: fix another RCInput compile error 2013-04-29 21:27:16 +09:00
Randy Mackay e7122b85ed AP_HAL: example compile error fix 2013-04-29 17:47:04 +09:00
Randy Mackay bbbd90c430 AP_HAL: rename RCInput's valid() fn to valid_channels 2013-04-29 15:05:53 +09:00
Randy Mackay a28c6df611 RCInput: allow ppmsum of less than 8 channels 2013-04-29 14:35:59 +09:00
Andrew Tridgell c067fa2660 L1_Control: make NAVL1_DAMPING docs clearer 2013-04-29 14:24:34 +10:00
Andrew Tridgell 786e4cf705 AP_GPS: added last_message_time_ms() API
used to help GPS logging
2013-04-28 14:53:02 +10:00
Andrew Tridgell f5d062d5ba AP_GPS: move byte swapping code to cpp 2013-04-28 14:51:37 +10:00
priseborough 84ed37938d Plane : AP_L1_Control : Replaced division by constants with multiplies and adjusted default L1 period to 25 seconds 2013-04-28 14:47:59 +10:00
Andrew Tridgell f5d6fb6216 AP_AHRS: added _kp gain reduction for catapult launch
this should reduce the tendency of aircraft to nose down hard on
initial launch at high g
2013-04-28 14:47:59 +10:00
Randy Mackay 9910d6d1cd AC_Fence: first implemenation of library 2013-04-27 11:14:05 +09:00
Andrew Tridgell b71f36ee34 RC_Channel: support 8 auxillary RC channels
needed for full 12 channel support on PX4
2013-04-25 20:10:53 +10:00
Andrew Tridgell ec1678db83 HAL_PX4: setup for 12 output channels
moved telemetry port to /dev/ttyS2 to free PWM outputs on FMU
2013-04-25 20:10:53 +10:00
Andrew Tridgell 709615159a HAL_PX4: support 12 output channels with PX4IO
first 8 on IO board, next 4 on FMU outputs
2013-04-25 20:10:53 +10:00
Andrew Tridgell 3b0250b414 AP_HAL: define RC_12
we have 12 channels on PX4FMU+PX4IO
2013-04-25 20:10:53 +10:00
Randy Mackay cb5f8826f8 Copter: Leonard's fix for trapezoidal frame
We need to allow yaw_factors to be floats in the add_motor method
2013-04-25 17:52:19 +09:00
Randy Mackay 1a7cffefe6 TradHeli: change coll_out to int16_t
was incorrectly defined as an AP_Int16 parameter
2013-04-24 11:32:26 +09:00
Randy Mackay 7f79398989 AP_Limits: fixed return of AP_Int8 parameters from object
we should return the base type, not the parameter, or callers could
use set on the result
2013-04-23 23:13:54 +10:00
Andrew Tridgell 3659b532be AP_Common: added BIT_IS_SET() macro
makes bit mask testing safer on PX4

Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-04-23 23:05:02 +10:00
Andrew Tridgell 709a277c7f DataFlash: chamged FMT message to include labels
this makes it easier for MP to parse and display
2013-04-23 19:46:22 +10:00
Andrew Tridgell 9ef34943af DataFlash: change log extension to *.bin 2013-04-23 15:03:10 +10:00
Andrew Tridgell fd2cd0d1c2 DCM: fixed formatting 2013-04-23 08:57:44 +10:00
jschall 610069e729 DCM: fixed airspeed bug
we incorrectly went via the wind estimate when we had a working airspeed sensor
2013-04-23 08:57:44 +10:00