Compare commits

...

475 Commits

Author SHA1 Message Date
Randy Mackay
cce6cd3047 Copter: version to 3.3.4-pixracer 2016-02-25 10:23:00 +09:00
Randy Mackay
9773466941 Copter: 3.3.4-pixracer release notes 2016-02-25 10:22:44 +09:00
Randy Mackay
a2a4ceecb8 Copter: version to 3.3.4-rc3-pixracer 2016-02-23 14:55:34 +09:00
Randy Mackay
8d307838bb Copter: release notes for ver 3.3.4-rc3-pixracer 2016-02-23 14:55:24 +09:00
Andrew Tridgell
d47d3492e1 PX4: re-order startup to start mtd before ms5611
this avoids a bus locking issue on Pixracer
2016-02-23 14:52:45 +09:00
Andrew Tridgell
eb6848b8c2 HAL_PX4: work around a bus locking issue on Pixracer
Pixracer has FRAM on the same bus as the ms5611 and the FRAM ramtron
driver does not use the same locking mechanism as other px4 SPI
drivers. We need to disable interrupts during FRAM transfers to ensure
we don't get FRAM corruption
2016-02-23 14:52:42 +09:00
Randy Mackay
64acaa1c2c Copter: version to 3.3.4-rc2-pixracer 2016-02-20 09:31:31 +09:00
Randy Mackay
c501fecc49 Copter: release notes for 3.3.4-rc2-pixracer 2016-02-20 09:30:58 +09:00
Andrew Tridgell
9ecdd1f707 PX4Firmware: submodule update (SBUS fix) 2016-02-20 09:15:52 +09:00
Randy Mackay
df9939e90d Copter: version to 3.3.4-rc1-pixracer 2016-02-19 17:34:09 +09:00
Randy Mackay
d2667a7fea Copter: release notes for 3.3.4-rc1-pixracer 2016-02-19 17:33:47 +09:00
Jonathan Challinger
07ca9cebf9 AP_InertialSensor: work around gyro and accel errors on startup 2016-02-19 17:26:48 +09:00
Andrew Tridgell
ea5a60dd01 Copter: prepare 3.3 pixracer release 2016-02-09 21:28:01 +11:00
Andrew Tridgell
2e383b6aba scripts: this branch only supports copter on px4
special update for randys 3.3 release
2016-02-09 09:11:30 +11:00
Andrew Tridgell
f19a129015 modules: add mavlink submodule 2016-02-09 09:00:11 +11:00
Andrew Tridgell
2f76fd68cc travis: update to new scripts 2016-02-09 08:54:03 +11:00
Andrew Tridgell
a5b92a001e scripts: update to autotest scripts 2016-02-09 08:53:51 +11:00
Andrew Tridgell
f2358f2441 HAL_PX4: changes for FMUv4 2016-02-08 19:52:46 +11:00
Andrew Tridgell
d87219d207 mk: prevent duplicate source files 2016-02-08 19:52:33 +11:00
Andrew Tridgell
483d79020b PX4NuttX: submodule update 2016-02-08 19:29:41 +11:00
Andrew Tridgell
164024fa84 PX4Firmware: submodule update 2016-02-08 19:29:33 +11:00
Andrew Tridgell
adc578edbe mk: update build for FMUv4 from master 2016-02-08 19:29:23 +11:00
Randy Mackay
9ef6d9bee9 Copter: version to 3.3.3-rc2 2016-01-27 19:54:35 +09:00
Randy Mackay
e8c637b254 Copter: 3.3.3-rc2 release notes 2016-01-27 19:54:09 +09:00
Randy Mackay
4941b19e33 Copter: guided calls velocity controller at 400hz
velocity controller internally updates xy-axis at 50hz, z-axis at 400hz
2016-01-27 19:46:58 +09:00
Andrew Tridgell
339d49d34a GCS_MAVLink: fixed corner case in MAVLink routing
when a GCS sends a command to a system ID that isn't our system ID,
the GCS may use a non-advertised component ID such as
MAV_COMP_ID_SYSTEM_CONTROL. Those packets should be fowarded to the
target system even though the target system has not specifically
advertised that target sysid/compid tuple.
2016-01-27 19:44:49 +09:00
Randy Mackay
5b765ef0d9 AC_AttControl: bug fix to angle_boost reporting
Thanks to OXINARF for finding this
2016-01-08 11:42:41 +09:00
Randy Mackay
20c48960e8 Copter: update 3.3.3-rc1 release notes 2016-01-07 14:29:08 +09:00
Robert Lefebvre
f77e806497 Copter: Version to 3.3.3-rc1 2016-01-07 14:20:32 +09:00
Robert Lefebvre
67ab81c0a0 Copter: 3.3.3-rc1 release notes 2016-01-07 14:20:26 +09:00
Robert Lefebvre
05ff279a18 Copter: Restrict mode changes for TradHeli. 2016-01-07 14:20:01 +09:00
Randy Mackay
01518ad1ab AC_AttControl: add ANGLE_BOOST param 2016-01-07 14:19:58 +09:00
Andrew Tridgell
2046271da4 Copter: use new RangeFinder API 2015-12-09 14:45:40 +09:00
Andrew Tridgell
99b7972794 AP_SerialManager: added enum for serial lidar 2015-12-09 14:45:38 +09:00
Andrew Tridgell
f506ffee23 AP_RangeFinder: added Lightware Lidar support 2015-12-09 14:45:36 +09:00
Robert Lefebvre
2c612e5f8e AP_MotorsHeli: Add parameter checks to Single class 2015-12-07 15:01:44 +09:00
Andrew Tridgell
818a5d103f Copter: automatically set H_RSC_MIN/MAX from RC8_MIN/MAX on upgrade 2015-12-07 14:59:03 +09:00
Robert Lefebvre
1caa2262da Copter: Helicopters to force descent when motor is shut off 2015-12-07 14:59:01 +09:00
Randy Mackay
7f16e4d603 Copter: version to 3.3.2 2015-12-01 15:08:53 +09:00
Randy Mackay
09595f554a Copter: 3.3.2 release notes 2015-12-01 15:08:39 +09:00
Randy Mackay
1883b1b828 Copter: version to 3.3.2-rc2 2015-11-19 19:52:58 +09:00
Randy Mackay
cfb87a061e Copter: 3.3.2-rc2 release notes 2015-11-19 19:52:56 +09:00
Randy Mackay
fb5986c4ec Copter: position_ok when optical flow ok
Previously the GPS based absolute position was required
This allows using optical flow in all flight modes
2015-11-19 19:52:51 +09:00
Randy Mackay
a69dbcfae7 AC_PosControl: run velocity controller z-axis at 400hz 2015-11-19 19:52:48 +09:00
Randy Mackay
54cc2d884c AC_PosControl: default z-axis controller to 400hz
No functional change as vehicle code always sets it explicitely
2015-11-19 19:52:46 +09:00
Randy Mackay
916d63412e AC_PosControl: velocity controller uses feed-forward althold 2015-11-19 19:52:42 +09:00
Leonard Hall
193bfe839e Copter: feed forward only used for AltHold, Loiter, PosHold
land modes use non-feedforward alt hold
2015-11-19 19:52:40 +09:00
Randy Mackay
2dad15c307 AC_PosControl: minor comment update 2015-11-19 19:52:37 +09:00
Randy Mackay
eb817a875f AC_PosControl: use_desvel_ff flag added
This allows turning on/off desired velocity feedforward without setting desired_vel.z to zero.  Setting desired_vel.z to zero has the side effect of disrupting the landing detection which needs to know if we are trying to descend
2015-11-19 19:52:35 +09:00
Leonard Hall
0d878e6fcd AC_PosControl: faster z-axis slowdown when over speed 2015-11-19 19:52:33 +09:00
Leonard Hall
a5c3e6ef45 AC_PosControl: allow desired vel z to be above speed limit 2015-11-19 19:52:30 +09:00
Leonard Hall
d2dd2d8a50 AC_PosControl: add alt hold without feed forward 2015-11-19 19:52:28 +09:00
Paul Riseborough
ea4590c3b8 AP_NavEKF: Prevent flickering bad health status on ground
If the health status is checked after a non-height position or velocity fusion, then the health status will return false.
The height fusion health status has been removed from the check to prevent this.
The height fusion health check cannot be used unless the pre-arm fusion of position and velocity is timed to coincide with the baro fusion.
2015-11-19 19:51:16 +09:00
Paul Riseborough
58e81b7d99 AP_NavEKF: Reduce EKF health pre-arm check false positives 2015-11-18 15:32:16 +09:00
Robert Lefebvre
9e5ebd70b7 Copter: version to 3.3.2-rc1 2015-11-05 11:32:11 +09:00
Robert Lefebvre
6c5cd12a96 Copter: 3.3.2-rc1 release notes 2015-11-05 11:32:09 +09:00
Robert Lefebvre
792e989cd6 AP_MotorsHeli_Single: Move Servo_Test static variables to be class members 2015-11-03 17:01:18 +09:00
Andrew Tridgell
6e93f111c9 Copter: added DISARM_DELAY parameter
this allows automatic disarming to be disabled, or set to a shorter or
longer time as appropriate for the user

Originally committed by Tridge, merged to AC3.3 with conflict.
2015-11-03 17:01:17 +09:00
Robert Lefebvre
c0ea1f70ef Copter: Heli to set hover roll trim scalar 2015-11-03 17:01:16 +09:00
Robert Lefebvre
da1638d72c AC_AttitudeControl_Heli: Add Hover Roll Trim Scalar 2015-11-03 17:01:15 +09:00
Robert Lefebvre
99212f71bf AP_MotorsHeli: Create Servo Test functionality 2015-11-03 17:01:14 +09:00
Robert Lefebvre
ae1fbdb68a AP_MotorsHeli: Create SV_MAN=5=Oscillate servo setup mode. 2015-11-03 17:01:13 +09:00
Robert Lefebvre
0228a99d4e AP_MotorsHeli: Yaw servo to move when using SV_MAN param for setup. 2015-11-03 17:01:12 +09:00
Robert Lefebvre
146c0319a7 AP_MotorsHeli: Change SV_MAN=2=Center to output _col_mid_pwm instead of 0 collective 2015-11-03 17:01:11 +09:00
Andrew Tridgell
246583dc06 AP_RPM: added RPM_MAX parameter
attempt to avoid noise in the pulses
2015-11-03 17:01:10 +09:00
Fredrik Hedberg
014e90ec85 AP_MotorsHeli: Add min and max collective to manual servo modes 2015-11-03 17:01:09 +09:00
Robert Lefebvre
739d87a15b AP_MotorsHeli: Change servo manual #defines into enum 2015-11-03 17:01:08 +09:00
Robert Lefebvre
d11e5d4ae4 AP_MotorsHeli_Single: Add motor enable aux output functionality 2015-11-03 17:01:07 +09:00
Robert Lefebvre
5ce386b98d RC_Channel: Add motor_run_enable aux function 2015-11-03 17:01:06 +09:00
Robert Lefebvre
bf8001cb88 AP_MotorsHeli: Change rotor control state into Enum. 2015-11-03 17:01:05 +09:00
Robert Lefebvre
6922f7a2b1 AC_AttitudeControl: Add Hover Roll Trim functionality for helicopters. 2015-11-03 17:01:04 +09:00
Fredrik Hedberg
3aeed8173b AP_Motors: Add manual servo override to center swash-plate for set-up in AP_MotorsHeli. 2015-11-03 17:01:03 +09:00
Jolyon Saunders
0df3af4e42 AP_Motors: Circular swash-plate limits for AP_MotorsHeli 2015-11-03 17:01:02 +09:00
Robert Lefebvre
bdbfd8fd5e Copter: Helicopter: to use new Stab_Col and Acro_Col functions. 2015-11-03 17:01:01 +09:00
Robert Lefebvre
3385d83177 Copter: Utilize Input Manager Class 2015-11-03 17:01:00 +09:00
Robert Lefebvre
ab8db97b4d AC_InputManager: Initial class creation 2015-11-03 17:00:59 +09:00
Robert Lefebvre
6cc40f9760 AC_HELI_PID: Add Leak-Min param and functionality. 2015-11-03 17:00:58 +09:00
Robert Lefebvre
b487d66d9e AC_AttitudeControl_Heli: Remove commented out Cyclic Cross-Coupling code. Will resurrect in future. 2015-11-03 17:00:57 +09:00
Robert Lefebvre
f2397e2f68 AC_AttitudeControl_Heli: Implement Pirouette Compensation 2015-11-03 17:00:56 +09:00
Robert Lefebvre
69ab06fb5e AC_AttitudeControl_Heli: Add initialization of _flags_heli members 2015-11-03 17:00:55 +09:00
Robert Lefebvre
6e815dd45c Copter: Helicopter, fix so servos move after arming in Acro and Stabilize. 2015-11-03 17:00:54 +09:00
Robert Lefebvre
61406a32d2 Copter: Rework arming proceedures for interlock/Estop to fix race condition. 2015-11-03 17:00:53 +09:00
Randy Mackay
45445635d0 Copter: version to 3.3.1 2015-10-26 10:48:46 +09:00
Randy Mackay
943b9d3448 Copter: 3.3.1 release notes 2015-10-26 10:48:10 +09:00
Randy Mackay
5a1bb07804 Copter: version to 3.3.1-rc1 2015-10-20 15:59:17 +09:00
Randy Mackay
d5d78d6baa Copter: 3.3.1-rc1 release notes 2015-10-20 15:59:15 +09:00
Randy Mackay
38476b9204 Copter: guided takeoff checks auto-armed status
This resolves an edge case in which the vehicle could takeoff with auto-armed false
2015-10-20 15:52:54 +09:00
Randy Mackay
25c5c167f7 Mission: sanity check command altitudes 2015-10-20 15:52:51 +09:00
Randy Mackay
d1d778652b Common: add location alt max definition 2015-10-20 15:52:48 +09:00
Robert Lefebvre
a0932d1d0b AP_MotorsHeli: Fix RSC Mode 3 2015-10-10 15:12:24 +09:00
Robert Lefebvre
7fe90e7a34 AP_MotorsHeli_RSC: Fix tail_type control 2015-10-10 15:12:22 +09:00
Robert Lefebvre
6f153bb03d Copter: Remove Armed check from heli RSC controls 2015-10-10 15:12:19 +09:00
Robert Lefebvre
b6e869400c AP_MotorsHeli_Single: DDVPT to use it's own ramp and runup times 2015-10-10 15:12:17 +09:00
Robert Lefebvre
ec8afbec53 AP_MotorsHeli: Move Output functions into parent class 2015-10-10 15:12:14 +09:00
Robert Lefebvre
e23e57cc16 AP_MotorsHeli: Rework how servo setup is done. 2015-10-10 15:12:12 +09:00
Robert Lefebvre
bac559d5af AP_MotorsHeli: Simplify servo init/reset 2015-10-10 15:12:10 +09:00
Robert Lefebvre
c00fd86b45 AP_MotorsHeli: Move set_delta_phase_angle into _Single class 2015-10-10 15:12:07 +09:00
Robert Lefebvre
04af1dd94e Copter: Add handle to control Throttle Curve RSC. 2015-10-10 15:12:05 +09:00
Robert Lefebvre
88be4425ac AP_MotorsHeli: Create RSC Throttle Curve mode for controlling gas engines. 2015-10-10 15:12:03 +09:00
Robert Lefebvre
b1c7ec9aac AP_MotorsHeli: run RSC Control function in Output Min function
Move Output_Min() function into Heli_Single class as it will eventually be overloaded by other helicopter class types.
2015-10-10 15:12:00 +09:00
Robert Lefebvre
6cfdce1280 Copter: Helicopters to use motor interlock logic.
Also, remove motor interlock pre-arm check to streamline logic.
2015-10-10 15:11:57 +09:00
Robert Lefebvre
cf3c62a743 Copter: Change name of rotor speed function to match that in library 2015-10-10 15:11:54 +09:00
Robert Lefebvre
19536c1c11 AP_MotorsHeli: RSC controller to use speed ramp as simple float scalar 2015-10-10 15:11:51 +09:00
Robert Lefebvre
904fa7f8b9 AP_MotorsHeli: Set range of new RSC Servo object. 2015-10-10 15:11:49 +09:00
Robert Lefebvre
a0fd75c76a Copter: Create new heli RSC RC Channel object. 2015-10-10 15:11:47 +09:00
Robert Lefebvre
e3df0ec7fb AP_MotorsHeli: RSC Mode 0 no longer a valid mode 2015-10-10 15:11:44 +09:00
Robert Lefebvre
f4ddedbffc AP_MotorsHeli: Add more parameter checks 2015-10-10 15:11:42 +09:00
Robert Lefebvre
fa24107a2a AP_MotorsHeli_RSC: Split out rotor speed estimate into it's own function 2015-10-10 15:11:40 +09:00
Robert Lefebvre
9e8f5a42f4 AP_MotorsHeli: Colyaw function to check if rotor speed control is above idle 2015-10-10 15:11:37 +09:00
Robert Lefebvre
d788f0307d AP_MotorsHeli: rework RSC output() function to implement idle speed function
Also, split out speed_ramp function
2015-10-10 15:11:35 +09:00
Robert Lefebvre
b879b312e9 AP_MotorsHeli_Single: Fix recalc_scalars function 2015-10-10 15:11:32 +09:00
Robert Lefebvre
24244ba576 AP_MotorsHeli: Create RSC_IDLE param 2015-10-10 15:11:30 +09:00
Robert Lefebvre
718397c772 AP_MotorsHeli: Change RSC output() function into a state machine. 2015-10-10 15:11:27 +09:00
Robert Lefebvre
bf0fd3b3f2 AP_MotorsHeli: Fully detail tradheli output functions and move manual servo handling 2015-10-10 15:11:25 +09:00
Robert Lefebvre
ec400e06d8 AP_MotorsHeli: Rename tradheli servo objects for clarity 2015-10-10 15:11:22 +09:00
Robert Lefebvre
6a7996d367 AP_MotorsHeli: Update includes so that it builds 2015-10-10 15:11:19 +09:00
Fredrik Hedberg
d1fbf739c0 AP_Motors: Fix param indices in AP_MotorsHeli. 2015-10-10 15:11:16 +09:00
Fredrik Hedberg
260d018db9 AP_Motors: Rename output_yaw to move_yaw in AP_MotorsHeli_Single. 2015-10-10 15:11:13 +09:00
Fredrik Hedberg
7ac02922e9 AP_Motors: Fix formatting in AP_MotorsHeli_RSC. 2015-10-10 15:11:10 +09:00
Fredrik Hedberg
fae1dcc42b AP_Motors: Fix param range comment in AP_MotorsHeli. 2015-10-10 15:11:08 +09:00
Fredrik Hedberg
708e2b402e Copter: Use AP_MotorsHeli_Single for HELI_FRAME. 2015-10-10 15:11:05 +09:00
Fredrik Hedberg
cde94078b7 AP_Motors: Move traditional helicopter controls into AP_MotorsHeli_Single.
Original commit by fhedberg, had to fix merge conflicts and now it appears I did the commit?
2015-10-10 15:11:03 +09:00
Fredrik Hedberg
af1eee44ee AP_Motors: Break out yaw output in AP_MotorsHeli. 2015-10-10 15:11:00 +09:00
Fredrik Hedberg
ded265dbe1 AP_Motors: Break out servo init and reset in AP_MotorsHeli. 2015-10-10 15:10:57 +09:00
Fredrik Hedberg
54452e2a74 AP_Motors: Move rotor speed control into AP_MotorsHeli_RSC. 2015-10-10 15:10:53 +09:00
Fredrik Hedberg
e360b21b2a AP_Motors: Use C++11 initializers in AP_MotorsHeli. 2015-10-10 15:10:50 +09:00
Randy Mackay
340970fc95 Copter: version to 3.3 2015-09-29 08:46:53 +09:00
Randy Mackay
4d62d1215f Copter: 3.3 release notes 2015-09-29 08:46:42 +09:00
Randy Mackay
d1782e0b80 Copter: version to 3.3-rc12 2015-09-22 15:12:11 +09:00
Randy Mackay
dc37417279 Copter: 3.3-rc12 release notes 2015-09-22 15:12:10 +09:00
Randy Mackay
76da561970 Copter: replace vehicle compass consistency check 2015-09-16 15:16:10 +09:00
Paul Riseborough
5aa6dc5a01 AP_NavEKF: Ensure bad mag data cannot cause the heading to reset too often 2015-09-16 15:16:09 +09:00
Paul Riseborough
efce10b6cd AP_NavEKF: Reset mag and heading states to try and pass pre-flight checks 2015-09-16 15:16:08 +09:00
Randy Mackay
72ab60a19e AP_Compass: fix consistent check for less than three compasses
Also use vector functions where available
2015-09-16 15:15:18 +09:00
Jonathan Challinger
2f4f76d17a AP_Compass: add consistent() function 2015-09-16 15:14:53 +09:00
Randy Mackay
a0906188b3 Math: add Vector2 is_zero method 2015-09-16 15:14:47 +09:00
Andrew Tridgell
08e1a66772 APM_OBC: added severities to send_statustext_all 2015-09-10 15:09:54 +09:00
Randy Mackay
ef2d980520 Copter: version to 3.3-rc11 2015-09-10 14:51:52 +09:00
Randy Mackay
7ce58b1b4e Copter: 3.3-rc11 release notes 2015-09-10 14:51:50 +09:00
Andrew Tridgell
33248b00d4 AP_NavEKF: only call calcGpsGoodToAlign if we need to
avoid calling it once we have an origin. This avoids some calculations
and string operations
2015-09-10 14:51:47 +09:00
Andrew Tridgell
7ca88a26da Copter: use prearm_failure_reason() 2015-09-10 14:51:43 +09:00
Andrew Tridgell
c4d561a4eb AP_NavEKF: added prearm_failure_reason() 2015-09-10 14:51:25 +09:00
Andrew Tridgell
c93006dc15 AP_AHRS: added prearm_failure_reason() 2015-09-10 14:51:22 +09:00
Andrew Tridgell
c268cea08f GCS_MAVLink: added severity to send_statustext_all() 2015-09-10 14:51:19 +09:00
Andrew Tridgell
55e6008e38 GCS_MAVLink: make send_statustext_all() take a format string
this allows for formatted messages to all groundstations in libraries
2015-09-10 14:51:13 +09:00
Randy Mackay
f21fd6d61e Copter: Release notes for AC3.3-rc10 2015-08-28 12:04:43 +09:00
Randy Mackay
bec4e43630 Copter: version to 3.3-rc10 2015-08-28 12:04:41 +09:00
Randy Mackay
a1ac2bff56 Copter: fix optflow position_ok check
We should accept predicted relative horizontal position only when disarmed
2015-08-28 12:04:38 +09:00
Paul Riseborough
78ac1340c8 AP_NavEKF: Prevent false triggering of optical flow takeoff detection
Now that we have a pre-arm check in place to detect bad lidar, the motion check is unnecessary and can false trigger for copters with flexible undercarriages or on uneven ground.
2015-08-28 12:04:36 +09:00
Randy Mackay
3ee88112cf Copter: sanity check do-set-home and do-set-ROI location 2015-08-28 12:04:34 +09:00
Randy Mackay
13e360df08 Mission: sanity check location 2015-08-28 12:04:32 +09:00
Randy Mackay
e1a7760d38 Copter: pre-arm check of EKF compass variance 2015-08-28 12:04:29 +09:00
Randy Mackay
873d31915a Copter: always check GPS before arming in Loiter 2015-08-28 12:04:27 +09:00
Randy Mackay
f5fa19371f Copter: add ACCEL_Z_FILT_HZ parameter description
Also fixed parameter links to ATC, BATT and MOT libraries
2015-08-28 12:04:25 +09:00
Randy Mackay
f3590120a5 BattMonitor: fix parameter descriptions 2015-08-28 12:04:24 +09:00
fillycheezstake
b618621303 Mount: fix for STORM32 serial ver 78e and higher
This fixes the structs to be compatible with the changes OlliW made to
the gimbal firmware.
http://www.olliw.eu/storm32bgc-wiki/Serial_Communication
2015-08-28 12:04:22 +09:00
Leonard Hall
9dfe30f514 Copter: increase default thrust expo to 0.65 2015-08-28 12:04:21 +09:00
Randy Mackay
13752b5821 Copter: fix Autotune param descriptions 2015-08-28 12:04:19 +09:00
Randy Mackay
247e11ab81 Copter: AUTOTUNE_MIN_D param to allow controlling minimum D 2015-08-28 12:04:17 +09:00
Randy Mackay
9cd5e4dd6b AC_WPNav: remove unused get_wp_radius 2015-08-28 12:04:16 +09:00
Randy Mackay
58774222c3 Copter: failsafe RTL vs LAND decision always based on 2m
Previously this decision was based on the WPNAV_RADIUS parameter which is unexpected (and undocumented) behaviour.  Better just to hard-code it to 2m and remove the dependency on this parameter.
2015-08-28 12:04:14 +09:00
squilter
d00f9b61b4 GCS_MAVLink: make arguments mandatory for send_autopilot_version 2015-08-28 12:04:12 +09:00
squilter
5775455b68 Plane: define and send FIRMWARE_VERSION 2015-08-28 12:04:11 +09:00
Andrew Tridgell
57842b9268 Plane: prepare plane 3.4.0beta1 release 2015-08-28 12:04:09 +09:00
squilter
23a7db8ee8 Tracker: define and send FIRMWARE_VERSION 2015-08-28 12:04:08 +09:00
squilter
081694f557 Rover: define and send FIRMWARE_VERSION 2015-08-28 12:04:06 +09:00
squilter
dd3df029ef Copter: define and send FIRMWARE_VERSION 2015-08-28 10:30:18 +09:00
squilter
8553301cdd GCS_MAVLink: send_autopilot_version accepts version 2015-08-28 10:27:00 +09:00
Randy Mackay
7299011510 GCS_MAVLink: version update after common.xml change 2015-08-28 10:26:57 +09:00
squilter
de712714ef GCS_MAVLink: regenerate common 2015-08-28 10:26:55 +09:00
Randy Mackay
730e4908a9 GCS_MAVLink: rename FIRMWARE_VERSION_TYPE and fully qualify items 2015-08-28 10:26:52 +09:00
squilter
f3f11a4e96 GCS_MAVLink: Add FIRMWARE_RELEASE_TYPE to common.xml 2015-08-28 10:26:49 +09:00
Andrew Tridgell
e09d3a82fc PX4Firmware: submodule update 2015-08-28 10:26:25 +09:00
Tom Pittenger
04000faa5f AP_InertialSensor: correct USE param storage index
USE, USE2, USE3 have 20, 21, 21 but should be 20, 21, 22
2015-08-28 10:26:21 +09:00
Randy Mackay
70c7e93dd2 Copter: version to AC3.3-rc9 2015-08-19 20:45:15 +09:00
Randy Mackay
304fd8e4b3 Copter: AC3.3-rc9 release notes 2015-08-19 20:45:14 +09:00
Randy Mackay
bf584af9b0 NavEKF: use maxf when retrieving vibration levels
This reduces the performance hit that was caused by multiple calls to get_vibration_levels
2015-08-19 20:45:13 +09:00
Randy Mackay
f61c62b44a Math: maxf and minf functions 2015-08-19 20:45:12 +09:00
Randy Mackay
0ea47ea7b8 NavEKF: IMUSwitchState enum 2015-08-19 20:45:11 +09:00
Randy Mackay
32c7fe996a NavEKF: IMU ratio set to primary accel when neither IMU is used
This forces the EKF IMU ratio to indicate which IMU is used except that it will be "0" in the unlikely case that the third IMU is used
2015-08-19 20:45:10 +09:00
Paul Riseborough
77cac09bf6 AP_NavEKF: Add hysteresis to IMU switching logic 2015-08-19 20:45:09 +09:00
Paul Riseborough
e4a4dc26c8 AP_NavEKF: Modify method used to check for vibration errors
This method checks for consistency between accelerometer readings and switches to the unit with the lowest vibration of the difference exceeds 0.3g
The threshold of 1.7 m/s/s corresponds to a maximum tilt error of 10 deg assuming one IMU is good, one is bad and the EKF is using the bad IMU.
2015-08-19 20:45:07 +09:00
Randy Mackay
e2c8d6eb9d AHRS_NavEKF: integrate INS use_accel 2015-08-19 20:45:06 +09:00
Randy Mackay
437074a8fb AHRS_DCM: integrate INS use_accel 2015-08-19 20:45:05 +09:00
Randy Mackay
456bde4986 NavEKF: incorporate use_gyro and use_accel 2015-08-19 20:45:04 +09:00
Randy Mackay
1d752fc763 INS: add USE parameters 2015-08-19 20:45:03 +09:00
Randy Mackay
586d7399ee InertialSensor: add vibration monitoring of 2nd IMU 2015-08-19 20:45:02 +09:00
Tom Pittenger
0d13931df4 Tracker: moved gcs code to be more common 2015-08-19 20:45:01 +09:00
Tom Pittenger
e7bd6a46ca Rover: queue MISSION_ITEM_REACHED
clean up unreachable code
2015-08-19 20:45:00 +09:00
Tom Pittenger
945639ac0f Copter: implement try send mission_item_reached
clean up unreachable code
2015-08-19 20:44:59 +09:00
Tom Pittenger
42061ee290 Plane: implement try send mission_item_reached
clean up unreachable code
2015-08-19 20:44:58 +09:00
Tom Pittenger
7b611f8e26 GCS_MAVLink: add support for try send mission_item_reached
also moved most of send_item_reached into common library
2015-08-19 20:44:57 +09:00
Tom Pittenger
9c75900746 Rover: bring rover mission callback inline with copter and plane 2015-08-19 20:44:56 +09:00
Brad Bosch
4af7e454df HAL_VRBrain: Rework of support for FLOW_CONTROL_AUTO from PX4 HAL 2015-08-19 20:44:54 +09:00
Brad Bosch
d4c370ce6e HAL_PX4: Rework support for FLOW_CONTROL_AUTO.
Now instead of requiring the buffer to fill completely before we can
detect it is not draining, we use a time based mechanism to detect
when none of the first few bytes are transmitted after sitting in our
buffer a half second or more after flow control is enabled.  This
huristic is reliable only for the first several chracters because we
believe that the radio must still have plenty of room in it's own
buffers at that time even if it is not able to transmit them to the
other radio yet.  Note that the original algorithm made the same
assumption.

The new algorithm is especially helpful for cases where only keepalive
messages are transmitted before other packets can be requested by the
GCS.  In this situation, the original code required almost 2 minutes
to disable flow control and allow communication with the GCS.
2015-08-19 20:44:53 +09:00
Brad Bosch
7bae269931 GCS_MAVLink: Pause to allow serial port to drain.
This avoids a race between the UART and the auto flow control code.
2015-08-19 20:44:52 +09:00
Tom Pittenger
61ae42db40 Plane: post "Distance from LAND point" on every land
- waits until disarm after a land
2015-08-19 20:44:51 +09:00
Lucas De Marchi
eedc631eca AP_Param: add missing header StorageManager.h 2015-08-19 20:44:50 +09:00
Stewart Loving-Gibbard
52a019c33a Plane: Fixing unambiguous spelling errors in Parameters.cpp file.
These are user-visible in Mission Planner and the like.
2015-08-19 20:44:49 +09:00
Lucas De Marchi
eef41b88ed Tools: allow script to fixup a single file
Instead of always trying to fix the entire tree, accept paths in the
command line so it only fixes that paths. This allows to easily rebase a
branch after the header changes, without touching the rest of the tree.
2015-08-19 20:44:48 +09:00
Lucas De Marchi
ef1ed5fcfe AP_HAL_AVR: standardize inclusion of libaries headers
It was not only standardized, but actually fixed since ".." would not
move to the libraries/ directory (and hence the include location was
actually wrong).
2015-08-19 20:44:47 +09:00
Lucas De Marchi
72391fddbe GCS_MAVLink: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:46 +09:00
Lucas De Marchi
b6d69d9767 DataFlash: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:45 +09:00
Lucas De Marchi
2a213e7c42 AP_HAL_Notify: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:43 +09:00
Lucas De Marchi
d67e775d76 AP_HAL_Mount: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:42 +09:00
Lucas De Marchi
bc730149c7 AP_HAL_InertialSensor: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:41 +09:00
Lucas De Marchi
319220c6ba AP_HAL_InertialNav: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:40 +09:00
Lucas De Marchi
197cedca00 AP_HAL_VRBRAIN: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:39 +09:00
Lucas De Marchi
fc7a6632a9 AP_HAL_SITL: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:38 +09:00
Lucas De Marchi
f8cf5a63dc AP_HAL_PX4: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:37 +09:00
Lucas De Marchi
77c236a6b7 AP_HAL_Linux: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:36 +09:00
Lucas De Marchi
d2adc99d3a AP_HAL: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:35 +09:00
Lucas De Marchi
4479b0aff1 AP_GPS: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:34 +09:00
Lucas De Marchi
f5ec94df02 AP_Compass: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:33 +09:00
Lucas De Marchi
8062a5c2f5 AP_AHRS: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-19 20:44:31 +09:00
Andrew Tridgell
12ae3c5031 SITL: added ignition control for gas heli 2015-08-19 20:44:30 +09:00
Stewart Loving-Gibbard
b5d7c900d7 Rover: fix spelling errors in Parameters.cpp 2015-08-19 20:44:29 +09:00
Stewart Loving-Gibbard
efa021543c Copter: fix spelling errors in Parameters.cpp 2015-08-19 20:44:28 +09:00
squilter
262393c614 Copter: update flighttermination capability 2015-08-19 20:44:27 +09:00
squilter
e90d228138 GCS_MAVLink: version update after generate 2015-08-19 20:44:26 +09:00
squilter
cf5005b95f GCS_MAVLink: generate after flight_termination change 2015-08-19 20:44:25 +09:00
squilter
487896c2c4 GCS_MAVLink: rename flighttermination capability enum 2015-08-19 20:44:24 +09:00
dgrat
5e9f9e2a82 Tracker: add handle_guided_request to allow cmake to work
merge
2015-08-19 20:44:23 +09:00
Andrew Tridgell
10c78ba844 PX4Firmware: submodule update 2015-08-19 20:44:22 +09:00
Andrew Tridgell
3990332745 HAL_PX4: prevent error on GPIO line on change of pinMode
thanks to Michael for noticing this
2015-08-19 20:44:20 +09:00
Andrew Tridgell
f7b5c770ac PX4Firmware: submodule update 2015-08-19 20:44:19 +09:00
Andrew Tridgell
a341403bff AP_InertialSensor: setup for MPU9250 support on PX4 2015-08-19 20:44:18 +09:00
Andrew Tridgell
935360e1fb PX4: enable probe of MPU9250 if available 2015-08-19 20:44:17 +09:00
Andrew Tridgell
71835b03ca PX4Firmware: submodule update 2015-08-19 20:44:16 +09:00
Andrew Tridgell
2ba3bdde27 Plane: disable TRIM_RC_AT_START by default 2015-08-19 20:44:15 +09:00
Paul Riseborough
e16ab6bf86 Copter: shorten disarm counter to 10 seconds 2015-08-19 20:44:14 +09:00
Jonathan Challinger
49126e83e2 Copter: adapt auto disarm for sprung throttle stick copters 2015-08-19 20:44:13 +09:00
Andrew Tridgell
51ff905ba8 Plane: make TRAINING mode obey stall prevention roll limits
Fixes issue#2014
2015-08-19 20:44:12 +09:00
Andrew Tridgell
5101e263fa Plane: don't do battery failsafe when disarmed 2015-08-19 20:44:11 +09:00
Randy Mackay
abdd37ea2c Copter: fix PILOT_TKOFF_DZ param description 2015-08-19 20:44:10 +09:00
Randy Mackay
ab1d9886da Copter: fix ANGLE_MAX param description
Thanks to Hamish for finding this
2015-08-19 20:44:09 +09:00
Andrew Tridgell
7711195fae autotest: added basic helicopter parameters 2015-08-19 20:44:08 +09:00
Andrew Tridgell
e50aab180b SITL: tidy up frame handling a bit 2015-08-19 20:44:07 +09:00
Fredrik Hedberg
3ea31099d7 SITL: Add HELI_DUAL_FRAME and HELI_COMPOUND_FRAME. 2015-08-19 20:44:06 +09:00
Michael du Breuil
f10f4a82ba AP_GPS: Fix a bound error when calculating GNSS minimum channels.
This is really just calculating the hamming weight of the GNSS_MODE bitmask, but I don't know if the APM compiler could handle the GCC intrinsic that could calculate it faster, and this is done so rarely there isn't a significant penalty to using the for loop.
2015-08-19 20:44:05 +09:00
Andrew Tridgell
dd04326693 autotest: cope with symlinks in vehicle path 2015-08-19 20:44:04 +09:00
Andrew Tridgell
b14e0b65b6 autotest: removed the need for run_cmd.sh 2015-08-19 20:44:02 +09:00
Randy Mackay
f6965fffdc NavEKF: check baro health before consuming 2015-08-19 20:44:01 +09:00
squilter
9f4f0b4f20 Tools: add ccache setup to arch setup script 2015-08-19 20:44:00 +09:00
squilter
9eef1dab34 Tools: add script to set up Arch Linux 2015-08-19 20:43:59 +09:00
squilter
ea5dc3d1b4 Copter: implement do_flighttermination 2015-08-19 20:43:58 +09:00
TShapinsky
39df7e87f7 Copter: add velocity control timeout in guided mode 2015-08-19 20:43:57 +09:00
Grant Morphett
4e568ab547 Rover: Including the sonar/rangefinder status in SYS_STATUS message 2015-08-19 20:43:56 +09:00
Andrew Tridgell
0218e4ac86 AP_RPM: fixed build error 2015-08-19 20:43:55 +09:00
Andrew Tridgell
9e052a89a4 PX4Firmware: submodule update 2015-08-19 20:43:54 +09:00
Andrew Tridgell
f202b7d283 Plane: prevent build error with MSG_RPM 2015-08-19 20:43:53 +09:00
Andrew Tridgell
d3ea6e8de1 AntennaTracker: prevent build error with MSG_RPM 2015-08-19 20:43:52 +09:00
Andrew Tridgell
afbacb1aea Rover: prevent build error with MSG_RPM 2015-08-19 20:43:51 +09:00
Andrew Tridgell
90d760f50e AP_RPM: define a minimum acceptable period for PWM input
this will reject very short periods as invalid. This helps somewhat
with noise on the line
2015-08-19 20:43:50 +09:00
Andrew Tridgell
cb423eb2f4 Copter: added RPM dataflash logging 2015-08-19 20:43:49 +09:00
Andrew Tridgell
10b8192463 DataFlash: added RPM logging 2015-08-19 20:43:47 +09:00
Andrew Tridgell
2cf93e828d Copter: added RPM sensor support
send result via MAVLink
2015-08-19 20:43:46 +09:00
Andrew Tridgell
8efaa74b38 GCS_MAVLink: regenerate headers 2015-08-19 20:43:45 +09:00
Andrew Tridgell
bfd409b465 GCS_MAVLink: added RPM MAVLink message 2015-08-19 20:43:44 +09:00
Andrew Tridgell
e3109a397e AP_RPM: first version of RPM sensor driver 2015-08-19 20:43:43 +09:00
Andrew Tridgell
5da21d2bb2 Plane: prevent mode switch changes changing WP tracking
this fixes a bug where a mode switch change during an AUTO mission
which does not change the flight mode would cause cross tracking to be
reset, so the plane will not correctly follow the desired track

Many thanks to Michael Du Breuil for the log that showed this bug
2015-08-19 20:43:42 +09:00
Randy Mackay
587a38b42a Copter: check frame for SET_POSITION_TARGET_GLOBAL_INT in guided 2015-08-19 20:43:41 +09:00
Randy Mackay
72d468353e Copter: guided SET_POSITION_TARGET accepts frame 2015-08-19 20:43:40 +09:00
Randy Mackay
76e66be9cb Copter: convert fn from body-frame to NE 2015-08-19 20:43:39 +09:00
Randy Mackay
181373cf69 Copter: landing with guided velocity controller 2015-08-19 20:43:38 +09:00
squilter
81f7cd06a6 Copter: update copter's capabilities 2015-08-19 20:43:37 +09:00
squilter
e0baaa516a GCS_MAVLink: update common.h enum 2015-08-19 20:43:36 +09:00
squilter
f4e2463edc Common: add 21196 for emergency disarm 2015-08-19 20:43:34 +09:00
squilter
4cf49b1f4e Common: add two new capabilities 2015-08-19 20:43:33 +09:00
Andrew Tridgell
6f6afe663c RC_Channel: fixed example build 2015-08-19 20:43:32 +09:00
Andrew Tridgell
bc83623ec7 AP_HAL: fixed example builds 2015-08-19 20:43:31 +09:00
Andrew Tridgell
a7bd3d1c54 AP_InertialSensor: removed AVR1280 specific ifdef 2015-08-19 20:43:30 +09:00
Andrew Tridgell
fbcacbd1d4 AP_Compass: removed AVR1280 specific ifdef 2015-08-19 20:43:29 +09:00
Gustavo Jose de Sousa
668dd4921f mk: remove include paths from make.inc
Now that the includes directives are stardardized, we don't need to add include
paths from make.inc anymore.
2015-08-19 20:43:28 +09:00
Gustavo Jose de Sousa
cf0ac5c1db Tools: add script for standardize includes of libraries headers 2015-08-19 20:43:27 +09:00
Gustavo Jose de Sousa
f92833950b StorageManager: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:26 +09:00
Gustavo Jose de Sousa
12d9f2b765 SITL: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:25 +09:00
Gustavo Jose de Sousa
703b27bde7 RC_Channel: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:24 +09:00
Gustavo Jose de Sousa
5a80f4d05d PID: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:22 +09:00
Gustavo Jose de Sousa
8cf54e1e3c GCS_MAVLink: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:21 +09:00
Gustavo Jose de Sousa
dda0eac2dd GCS_Console: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:20 +09:00
Gustavo Jose de Sousa
fa7e34aaa3 Filter: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:19 +09:00
Gustavo Jose de Sousa
d2c1df40e0 DataFlash: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:18 +09:00
Gustavo Jose de Sousa
cb81036d69 AP_Vehicle: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:17 +09:00
Gustavo Jose de Sousa
62d5e7ca92 AP_Terrain: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:16 +09:00
Gustavo Jose de Sousa
ebd1a15622 AP_TECS: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:15 +09:00
Gustavo Jose de Sousa
39ae5cdd95 AP_SpdHgtControl: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:14 +09:00
Gustavo Jose de Sousa
7b849b7c4c AP_ServoRelayEvents: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:12 +09:00
Gustavo Jose de Sousa
014fa22114 AP_SerialManager: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:11 +09:00
Gustavo Jose de Sousa
6af2605a88 AP_Scheduler: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:10 +09:00
Gustavo Jose de Sousa
7ec02f491c AP_Relay: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:09 +09:00
Gustavo Jose de Sousa
203fb48827 AP_RangeFinder: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:08 +09:00
Gustavo Jose de Sousa
d737326282 AP_Rally: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:07 +09:00
Gustavo Jose de Sousa
4cddfc211b AP_RCMapper: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:06 +09:00
Gustavo Jose de Sousa
44d51d54c5 AP_Progmem: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:04 +09:00
Gustavo Jose de Sousa
154f33ba61 AP_PerfMon: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:03 +09:00
Gustavo Jose de Sousa
c1809265fd AP_Param: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:02 +09:00
Gustavo Jose de Sousa
db43a54963 AP_Parachute: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:01 +09:00
Gustavo Jose de Sousa
86369b89e5 AP_OpticalFlow: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:43:00 +09:00
Gustavo Jose de Sousa
3ca7429594 AP_Notify: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:59 +09:00
Gustavo Jose de Sousa
869a00bfef AP_Navigation: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:57 +09:00
Gustavo Jose de Sousa
ccdac76003 AP_NavEKF: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:56 +09:00
Gustavo Jose de Sousa
876a48dbce AP_Mount: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:55 +09:00
Gustavo Jose de Sousa
2aba5319ed AP_Motors: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:54 +09:00
Gustavo Jose de Sousa
03a7c5b047 AP_Mission: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:53 +09:00
Gustavo Jose de Sousa
68f533a083 AP_Menu: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:52 +09:00
Gustavo Jose de Sousa
535273161e AP_Math: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:51 +09:00
Gustavo Jose de Sousa
f7fedee8cc AP_Limits: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:50 +09:00
Gustavo Jose de Sousa
0ef2d1054f AP_LandingGear: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:49 +09:00
Gustavo Jose de Sousa
f15a828f67 AP_L1_Control: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:47 +09:00
Gustavo Jose de Sousa
785dc36f20 AP_InertialSensor: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:46 +09:00
Gustavo Jose de Sousa
94cafc8a51 AP_InertialNav: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:45 +09:00
Gustavo Jose de Sousa
377add1667 AP_HAL_VRBRAIN: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:44 +09:00
Gustavo Jose de Sousa
c3a03a91bf AP_HAL_SITL: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:43 +09:00
Gustavo Jose de Sousa
10ec205e9f AP_HAL_PX4: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:41 +09:00
Gustavo Jose de Sousa
7ac51f60d0 AP_HAL_Linux: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:40 +09:00
Gustavo Jose de Sousa
c33fdc7b71 AP_HAL_FLYMAPLE: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:38 +09:00
Gustavo Jose de Sousa
0bf865f7f0 AP_HAL_Empty: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:37 +09:00
Gustavo Jose de Sousa
a80ae0cde3 AP_HAL_AVR: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:35 +09:00
Gustavo Jose de Sousa
98a772c323 AP_HAL: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:34 +09:00
Gustavo Jose de Sousa
71eb9ed24e AP_GPS: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:33 +09:00
Gustavo Jose de Sousa
967308577d AP_Frsky_Telem: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:32 +09:00
Gustavo Jose de Sousa
75c93aacf2 AP_EPM: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:31 +09:00
Gustavo Jose de Sousa
2b09318aa3 AP_Declination: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:30 +09:00
Gustavo Jose de Sousa
b7155e0fc9 AP_Curve: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:29 +09:00
Gustavo Jose de Sousa
cde866fd5f AP_Compass: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:28 +09:00
Gustavo Jose de Sousa
42aa122b7d AP_Common: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:26 +09:00
Gustavo Jose de Sousa
c222d469be AP_Camera: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:25 +09:00
Gustavo Jose de Sousa
08a6ade5df AP_BoardConfig: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:24 +09:00
Gustavo Jose de Sousa
13753a192e AP_BattMonitor: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:23 +09:00
Gustavo Jose de Sousa
3ae91b432b AP_Baro: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:22 +09:00
Gustavo Jose de Sousa
d25f7b8ed3 AP_Arming: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:21 +09:00
Gustavo Jose de Sousa
8fb7098903 AP_Airspeed: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:20 +09:00
Gustavo Jose de Sousa
7b2facf717 AP_AHRS: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:19 +09:00
Gustavo Jose de Sousa
6bddbc26de AP_ADC_AnalogSource: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:17 +09:00
Gustavo Jose de Sousa
66ecda2544 AP_ADC: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:16 +09:00
Gustavo Jose de Sousa
83c64daf19 APM_PI: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:15 +09:00
Gustavo Jose de Sousa
60c0f160b3 APM_OBC: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:14 +09:00
Gustavo Jose de Sousa
a9acfcb615 APM_Control: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:13 +09:00
Gustavo Jose de Sousa
664fbc9be8 AC_WPNav: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:12 +09:00
Gustavo Jose de Sousa
13ba4c90f5 AC_Sprayer: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:11 +09:00
Gustavo Jose de Sousa
bdf33e91e4 AC_PID: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:10 +09:00
Gustavo Jose de Sousa
b69efc510d AC_Fence: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:09 +09:00
Gustavo Jose de Sousa
45cd929074 AC_AttitudeControl: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:08 +09:00
Gustavo Jose de Sousa
5aa7cd0e37 Tools: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:06 +09:00
Gustavo Jose de Sousa
c1b9ebc0e4 ArduPlane: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:05 +09:00
Gustavo Jose de Sousa
f91ef9382d ArduCopter: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:04 +09:00
Gustavo Jose de Sousa
9a65b3e9ca AntennaTracker: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:03 +09:00
Gustavo Jose de Sousa
01397cb00c APMrover2: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-19 20:42:02 +09:00
Andrew Tridgell
5ce802b946 HAL_PX4: fixed USB connected on AUAV-X2
this is the 2nd attempt at a fix for the usb_connected status on
AUAV-X2
2015-08-19 20:42:01 +09:00
Randy Mackay
4ae8e36000 INS: accel offset parameter range desc to 3.5m/s/s 2015-08-19 20:42:00 +09:00
Daniel Frenzel
166a4f5b5a AP_Scheduler example
Fixed build problem with "make linux"

Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2015-08-19 20:41:59 +09:00
Andrew Tridgell
347c436394 GCS_MAVLink: fixed bug setting parameters to default values
in copter if you try to set RATE_RLL_D to 0 when you haven't
prevviously changed it then it would set it, but would revert on the
next reboot. This is because of the special case handling of a set to
the "default" value. That default value is unaware of the PID
constructors

this fixes that behaviour by forcing a save if the parameter changes
value
2015-08-19 20:41:58 +09:00
Andrew Tridgell
cb8356a290 AP_Param: replaced set_param_by_name with set_float
read for bugfix in GCS_MAVLink
2015-08-19 20:41:57 +09:00
Andrew Tridgell
ffefe425df PX4NuttX: submodule update 2015-08-19 20:41:56 +09:00
Jonathan Challinger
abaebac11c Copter: bug fix to RTL_ALT_MIN feature
commited by Randy
2015-08-19 20:41:55 +09:00
Michael du Breuil
789a588b30 AP_HAL_SITL: Add hdop to ublox sitl sim (as well as vdop to be reported) 2015-08-19 20:40:19 +09:00
Lucas De Marchi
d0014c4fe3 AP_InertialSensor: refactor constructors to avoid leak
We were previously leaking the AP_MPU6000_BusDriver if the
~AP_InertialSensor_MPU6000::detect*() failed. In order to avoid the
leak move the repeated code in a single private _detect() member that
receives everything as argument. Then this method takes ownership of the
objects.

By a adding a destructor to AP_InertialSensor_MPU6000 it becomes easier to
free the objects it takes ownership of.
2015-08-19 20:40:17 +09:00
Lucas De Marchi
5fbbdca9f9 AP_InertialSensor: MPU6000: be agnostic to I2C bus/address
This decision is better made by the caller rather than polluting the
driver with board-specific details.
2015-08-19 20:40:16 +09:00
Lucas De Marchi
a9a0e228ac AP_InertialSensor: pass backend instead of pointer to function
Different detect() function might need different arguments and passing a
pointer to function here is cumbersome. For example, it forces to have a
method like "detect_i2c2" rather than allowing hal.i2c2 to be passed as
parameter.
2015-08-19 20:40:15 +09:00
Gustavo Jose de Sousa
f31fe780eb AP_InertialSensor: L3G4200D: add probe code
This driver works properly but had the initialization logic missing. Add
the support to probe it.
2015-08-19 20:40:14 +09:00
Lucas De Marchi
dd523c0301 AP_InertialSensor: remove out of place ifdef
AP_InertialSensor isn't a good place to comment about board issues.
2015-08-19 20:40:13 +09:00
Lucas De Marchi
886b302019 AP_InertialSensor: remove unused enum bus_speed
The methods actually use the enum from AP_HAL::SPIDeviceDriver, so don't
declare a new one. The I2C implementation is empty; if we actually start
to use it we'd better move the bus abstraction to HAL.
2015-08-19 20:40:12 +09:00
Lucas De Marchi
1c3728a585 AP_InertialSensor: fix copying wrong number of bytes
We should copy only the bytes we read, not the maximum number.
2015-08-19 20:40:11 +09:00
Lucas De Marchi
5b2ff84c06 AP_InertialSensor: fix whitespace usage 2015-08-19 20:40:10 +09:00
Lucas De Marchi
abd0514319 AP_InertialSensor: remove unused drivers
Nobody is using these drivers, they need to be rewritten using the
backend logic and give the false impression they are supported.
2015-08-19 20:04:18 +09:00
Gustavo Jose de Sousa
6d89a8cf71 StorageManager: remove unnecessary calculations on addr for next area
When writting or reading a block, if the block doesn't fit the area where it begins, the next base address is always zero. Thus the calculations to define the next value of addr are unnecessary.

Here's a quick validity proof using the previous calculations:
    First: Considering the case where the block doesn't fit it's first area:
        That means that (count + addr > length), what makes:
            count = length - addr; (1)
        So the following operations:
            addr += count;
            addr -= length;
        Are the same as doing:
            addr = addr + count - length; (2)
        Using (1) and (2) we have:
            addr = addr + length - addr - length = 0

    Second: When the block fits the area where it's at:
        That means that variable count is not changed,
        thus (n -= count) evaluates to 0, which makes the loop exit.

Another change was (b += count;) being moved after the condition to break the loop, since we just need to move the block pointer when it doesn't fit the first area.
2015-08-19 20:04:17 +09:00
Andrew Tridgell
54b7a2db60 PX4Firmware: submodule update 2015-08-19 20:04:16 +09:00
Randy Mackay
53ed6c8f05 Motors_Multicopter: add MOT_THR_MIX_MAX parameter
Allows controlling the prioritisation of throttle vs attitude control
during active flight
2015-08-19 20:04:15 +09:00
Randy Mackay
b0101eab91 OpticalFlow_Linux: reworked driver
remove PANICs from init
return semaphore if init fails
add successful initialisation check before attempting to read from sensor
structure made private where possible
formatting fixes
check I2C reads succeed
add request_measurement to request sensor to produce measurement
quit after 20 of previous 40 reads fail
throttle reads to 10hz max
2015-08-19 20:04:14 +09:00
Víctor Mayoral Vilches
46c30f94ef AP_OpticalFlow: Add support for Linux
Add a Linux userspace driver for the PX4FLOW sensor.
2015-08-19 20:04:13 +09:00
Randy Mackay
539c6fe525 BattMon_SMBus: remove unnecessary I2C semaphore give 2015-08-19 20:04:12 +09:00
Randy Mackay
ac8c708327 Compass_HMC5843: remove unnecessary i2c semaphore give 2015-08-19 20:04:11 +09:00
Grant Morphett
f181d7edbe Rover: Lets put Rover into BETA - v2.2.51
I also made myself the maintainer - ssshhh - don't tell Tridge.
2015-08-19 20:04:10 +09:00
Grant Morphett
0edffdb7d3 Rover: fixed bug when reverse throttle would increase speed in AUTO
Fixed this bug
https://github.com/diydrones/ardupilot/issues/840
If a Rover was in AUTO and the user moved the throttle stick into
reverse past 50% the rover would increase.  Basically the throttle
nudge behaviour was the same regardless of whether you moved the
throttle forward or backward.
2015-08-19 20:04:09 +09:00
squilter
7c575b251a Plane: init vehicle capabilities 2015-08-19 20:04:08 +09:00
Randy Mackay
328332d6c0 DataFlash: consolidate GPS, GPS2 messages
Remove unused dgps_numch, dgps_age from GPS2
Add U field (for use) to both GPS and GPS2
2015-08-19 20:04:07 +09:00
Grant Morphett
9284f30d95 Rover: scheduler remaining time loop calc made common
Just making the improved scheduler loop remaining time calculation in line with
Plane and Copter.
2015-08-19 20:04:06 +09:00
Andrew Tridgell
9fbd739ebe AP_AHRS: protect against zero deltat in DCM
fixes issue #2657
2015-08-19 20:04:05 +09:00
Randy Mackay
34a5c46bfd AC_WPNav: remove unused definitions 2015-08-19 20:04:04 +09:00
Randy Mackay
7fb7b4d74e AC_WPNav: replace hardcoded 0.02 with pos_control dt 2015-08-19 20:04:03 +09:00
Leonard Hall
2ec34b14fc AC_WPNav: fix spline height loss 2015-08-19 20:04:02 +09:00
Michael du Breuil
2e699095a6 AP_GPS: Default the value of hdop to 99.99 if no value has been read yet. 2015-08-19 20:04:00 +09:00
Randy Mackay
aeef23c183 Rally: rename RALLY_HOME_INC param to INCL_HOME
Also default include-home to 1 only for copter
Also minor formatting and comment changes
2015-08-19 20:03:59 +09:00
KiwiHC16
7e99a052b8 Rally: add RALLY_HOME_INC param to use Home as a Rally point 2015-08-19 20:03:58 +09:00
Julien BERAUD
407bb5933b AP_Compass_AK8963: suspend timer while reading
Protection in case a timer falls while reading data, because it could end up
with corrupted data
2015-08-19 20:03:57 +09:00
Julien BERAUD
de7cf019ef AP_Compass_AK8963: fix sem handling
In case of error or zeroed data, the i2c semaphore wasn't given.
It happened at first startup on Bebop and caused a failure:
"PANIC: failed to take _bus->sem 100 times in a row..."
2015-08-19 20:03:56 +09:00
Leonard Hall
5b133934db AP_Motors: calc_roll_pwm based on throttle pwm range 2015-08-19 20:03:55 +09:00
Przemek Lekston
a855ca66b5 Plane: fix "logging disabled" build. 2015-08-19 20:03:54 +09:00
squilter
def4779c47 Board_AVR: locate recently-moved boards.txt file in arduino-core 2015-08-19 20:03:53 +09:00
Grant Morphett
a39819f17f Plane: Fix landing to stop divide by zero if params are 0
If someone mistakenly puts all 0's in their LAND command then
total_distance will be calculated as 0 and cause a divide by 0 error
below thus crashing ArduPilot.  Lets avoid that.
2015-08-19 20:03:52 +09:00
Przemek Lekston
cdf59e4632 Copter: fix logging disabled build 2015-08-19 20:03:51 +09:00
Jakub Oller
454ce77a3c Tracker: version to 0.7.2 and update release notes 2015-08-19 20:03:50 +09:00
Randy Mackay
ab8037064b Tracker: fix initialisation of nav_status
Thanks to Jakub Oller for finding the cause.  This is a slight
modification upon his fix.
2015-08-19 20:03:49 +09:00
Randy Mackay
cdd64fc43d AHRS_NavEKF: fix blended accel to use primary accel 2015-08-19 20:03:48 +09:00
squilter
5f00ea77e8 Tracker: init vehicle capabilities 2015-08-19 20:03:47 +09:00
squilter
c77182b748 Rover: init vehicle capabilities 2015-08-19 20:03:46 +09:00
Randy Mackay
5f706252fe Copter: init vehicle capabilities 2015-08-19 20:03:45 +09:00
Randy Mackay
5412ce9819 Terrain: set HAL capabilities bit 2015-08-19 20:03:44 +09:00
Randy Mackay
f08c34fe73 GCS_MAVLink: retrieve capabilities from HAL 2015-08-19 20:03:43 +09:00
Randy Mackay
66b0b5c7d6 HAL: define capability bitmask 2015-08-19 20:03:42 +09:00
squilter
44aec8fdca Copter: add capability bitmask 2015-08-19 20:03:41 +09:00
squilter
ad00e97447 GCS_MAVLink: add optional param to support capability bitmask 2015-08-19 20:03:40 +09:00
Andrew Tridgell
0a66bcbae5 AP_InertialSensor: don't use INT_STATUS drdy to lower SPI bus speed
as pointed out by Lucas in PR#2604 this is probably a bad idea
2015-08-19 20:03:39 +09:00
Grant Morphett
07c57ba973 Rover: fixed a bug going into guided and rover still moving
When the rover goes into guided mode it sets the current location as
the guided point to goto.  If the rover is stationary when this
happens no problem.  If however the rover is still rolling (say going
from AUTO to GUIDED) then the rover would go past its guided position
and get confused and begin to circle it.  This change resolves that issue.
2015-08-19 20:03:38 +09:00
Grant Morphett
eb63293498 SITL: fix coverity warning - removed unused variable heli_servos 2015-08-19 20:03:37 +09:00
Grant Morphett
0de992c5f9 DataFlash: fix coverity warnings - add param init in constructor 2015-08-19 20:03:36 +09:00
Grant Morphett
4c1de1abf3 AP_InertialSensor: fix coverity warnings - param init in construct 2015-08-19 20:03:35 +09:00
Grant Morphett
ff97bdd605 AP_Baro: coverity fixes - add param init in constructor 2015-08-19 20:03:34 +09:00
Andrew Tridgell
2a30b1862b Plane: disable camera logging when camera support disabled 2015-08-19 20:03:33 +09:00
Andrew Tridgell
f6e98ff8ef Plane: remove unused file 2015-08-19 20:03:32 +09:00
Andrew Tridgell
f04954b58c Plane: trim out some log msgs on APM2
save a bit more flash
2015-08-19 20:03:31 +09:00
Andrew Tridgell
be747afd0b Plane: re-enable geofencing on APM2
it only just fits ...
2015-08-19 20:03:30 +09:00
Andrew Tridgell
85179edf58 Plane: added HIL_SUPPORT define
disable HIL support on APM2 to save flash space
2015-08-19 20:03:29 +09:00
Andrew Tridgell
9f4ab28352 AP_GPS: re-enable SBAS config on APM2 for uBlox 2015-08-19 20:03:28 +09:00
Andrew Tridgell
27a098be9f AP_AHRS: use delta_velocity and delta_angle in DCM
this prevents an aliasing effect by using the correct delta velocity
time value for each accelerometer sample used
2015-08-19 20:03:27 +09:00
Andrew Tridgell
a9efbf7e4a AP_GPS: save some memory and code space on APM2 for ublox
don't include structures we don't need for low end CPUs
2015-08-19 20:03:26 +09:00
Randy Mackay
4d9325c582 GPS: suppress compile warning 2015-08-19 20:03:25 +09:00
Randy Mackay
04f7a07bad GPS: fix compile warning for NMEA logging 2015-08-19 20:03:24 +09:00
Randy Mackay
d2f7c21eb3 Baro: update climb rate only if healthy 2015-08-19 20:03:23 +09:00
Randy Mackay
cb9cb7fdc4 Copter: arming check that baro is healthy 2015-08-19 20:03:22 +09:00
Randy Mackay
8c0294f1b7 Copter: arming check that accels and gyro are healty 2015-08-19 20:03:21 +09:00
Andrew Tridgell
50e07ccad6 HAL_Linux: added bcast flag for udp broadcast 2015-08-19 20:03:20 +09:00
Andrew Tridgell
dfdedb3f33 AP_HAL: allow for broadcast packets on UDP IPv4 2015-08-19 20:03:19 +09:00
Andrew Tridgell
28bdeaf5d9 GCS_MAVLink: use a larger log send queue for Linux
often on UDP or TCP with more bandwidth
2015-08-19 20:03:18 +09:00
Andrew Tridgell
19dee8419b AP_HAL: added pollout() function to socket API 2015-08-19 20:03:17 +09:00
Andrew Tridgell
a5f01c7ada HAL_Linux: sped up UDP transfers by about 25x
allow more than 1 packetised transfer per tick
2015-08-19 20:03:16 +09:00
Andrew Tridgell
ab7f9807a2 AP_GPS: added optional NMEA debug log
compile time option for debugging
2015-08-19 20:03:15 +09:00
Grant Morphett
f1a46c27b3 Rover: Implemented loitering at a waypoint if Param1 is non-zero
Rover now honours the Param1 setting of a time in seconds for a
NAV_WAYPOINT and the Rover will loiter at that waypoint for that
period of time.
Note that as soon as the Rover reaches that waypoint the loiter timer
will start. If you enter a different mode during this time (HOLD for
instance) the timer resets. If you then switch back to AUTO
mode and the Rover returns to that waypoint it will wait for the
loiter time configured in param1.
2015-08-19 20:03:14 +09:00
Andrew Tridgell
81a3d439a3 HAL_Linux: allow startup before network bringup
this makes it possible to bootup ardupilot before the desired network
interface is available. This is very useful for when using 3G dongles
in aircraft
2015-08-19 20:03:13 +09:00
Andrew Tridgell
288c20a58e HAL_Linux: implemented TCP server as a single driver
the wait flag just changes startup behaviour. The TCP server should
always be a server with listen and accept. We don't need two drivers
2015-08-19 20:03:11 +09:00
Andrew Tridgell
ef47a27ac8 AP_HAL: added listen and accept APIs to socket API 2015-08-19 20:03:10 +09:00
Andrew Tridgell
fa40e7245e AP_HAL: added pollin() interface for Socket API 2015-08-19 20:03:09 +09:00
Andrew Tridgell
bd1b35804a HAL_Linux: replace recvfrom with recv 2015-08-19 20:03:08 +09:00
Andrew Tridgell
a48f0db405 AP_HAL: fixed socket destructor 2015-08-19 20:03:07 +09:00
Andrew Tridgell
bbc8bdcef3 HAL_Linux: removed 0 timeout from sendto call 2015-08-19 20:03:06 +09:00
Staroselskii Georgii
879f4f7555 AP_HAL_Linux: fixed _parseDevicePath() in LinuxUARTDRiver
The current implementation doesn't throw an error on a malformed path string.

i.e. udp:192.168.1.1.14550 instead of udp:192.168.1.1:14550 may result in a memory leak or whatsoever.

The commit fixes the issue and outputs a nice error message if anything's wrong.
2015-08-19 20:03:05 +09:00
Staroselskii Georgii
f66f583843 AP_HAL_Linux: renamed TCPClientDevice 2015-08-19 20:03:04 +09:00
Staroselskii Georgii
39048229cd AP_HAL_Linux: renamed TCPServerDevice
A more appropriate name for the class.
2015-08-19 20:03:03 +09:00
Staroselskii Georgii
50765229ca AP_HAL_Linux: made UARTDriver use TCPServerDevice 2015-08-19 20:03:02 +09:00
Staroselskii Georgii
0ec64a5d13 AP_HAL_Linux: added TCPServerDevice 2015-08-19 20:03:01 +09:00
Staroselskii Georgii
34c1fe6e66 AP_HAL_Linux: made UARTDriver use TCPClientDevice 2015-08-19 20:03:00 +09:00
Staroselskii Georgii
244cdb3507 AP_HAL_Linux: added TCPClientDevice 2015-08-19 20:02:59 +09:00
Staroselskii Georgii
595903f17c AP_HAL_Linux: got rid of TCP connection 2015-08-19 20:02:58 +09:00
Staroselskii Georgii
179fc4a781 AP_HAL_Linux: made UARTDriver use ConsoleDevice 2015-08-19 20:02:57 +09:00
Staroselskii Georgii
7ba960f265 AP_HAL_Linux: added ConsoleDevice 2015-08-19 20:02:56 +09:00
Staroselskii Georgii
4a79713081 AP_HAL_Linux: made UARTDriver use UDPDevice 2015-08-19 20:02:55 +09:00
Staroselskii Georgii
9e6c4fe176 AP_HAL_Linux: added UDPDevice 2015-08-19 20:02:54 +09:00
Staroselskii Georgii
b59264007c AP_HAL_Linux: encapsulated LinuxUARTDriver::_deallocate_buffers 2015-08-19 20:02:53 +09:00
Staroselskii Georgii
26382e63df AP_HAL_Linux: made UARTDriver use UARTDevice 2015-08-19 20:02:52 +09:00
Staroselskii Georgii
0c582eeae6 AP_HAL_Linux: added UARTDevice 2015-08-19 20:02:51 +09:00
Staroselskii Georgii
7160c88d39 AP_HAL_Linux: added SerialDevice interface
Adds the interface that will be used for encapsulating various mediums
that can be used in the Linux port.
2015-08-19 20:02:50 +09:00
Staroselskii Georgii
9b25217757 AP_HAL_Linux: added _serial_start_connection 2015-08-19 20:02:49 +09:00
Staroselskii Georgii
ed431e9857 AP_HAL_Linux: encapsulated LinuxUARTDriver::allocate_buffers 2015-08-19 20:02:48 +09:00
Staroselskii Georgii
4d28b4a962 AP_HAL_Linux: use defines instead of hardcoding fd numbers in UARTDriver 2015-08-19 20:02:47 +09:00
Staroselskii Georgii
6d1133378b AP_HAL: added destructor for Socket 2015-08-19 20:02:46 +09:00
Staroselskii Georgii
3134634af6 AP_HAL: improved constness of Socket API 2015-08-19 20:02:45 +09:00
Andrew Tridgell
8a975015b5 Plane: fixed above_location_current() for non-terrain alt
thanks to Lekston for finding the bug (PR#2610)
2015-08-19 20:02:44 +09:00
Michael du Breuil
3a7cc03f67 AP_GPS: Fix copy/paste error in ublox (uncovered by coverity) 2015-08-19 20:02:44 +09:00
Kevin Hester
7e231b5d37 Eclipse: template project files
users should rename these files to .cproject and .project (i.e. remove
the leading eclipse portion)

Original work done by Kevin, heavily modified by Randy
2015-08-19 20:02:43 +09:00
Randy Mackay
ef6b173326 Copter: slow start motors after landing in Stabilize, Acro 2015-08-19 20:02:42 +09:00
Randy Mackay
77b97f8643 AC_AttControl: relax earth frame rate targets along with bf 2015-08-19 20:02:41 +09:00
Randy Mackay
f46e2c2c36 Tracker: update readme 2015-08-19 20:02:40 +09:00
Спивак Константин
5d2440883e Tracker: create readme.txt 2015-08-19 20:02:39 +09:00
rentt
1c8180a41f Scheduler: fix compiler warning in example sketch
printf except a unsigned long value, but the hal.scheduler->millis() return a uint32_t
2015-08-19 20:02:38 +09:00
Tom Pittenger
bced0a3734 SITL: param SITL_ARSP_FAIL should be a float instead of byte
this param was meant to represent an airspeed which is a float
2015-08-19 20:02:37 +09:00
Andrew Tridgell
3e04976ce8 Maintainers: added Michael as uBlox maintainer 2015-08-19 20:02:36 +09:00
Andrew Tridgell
954cfde741 Copter: fixed comment on get_pilot_desired_yaw_rate 2015-08-19 20:02:35 +09:00
Andrew Tridgell
1b1bc9f3b1 RC_Channel: prevent floating exception on bad MIN/MAX/TRIM values 2015-08-19 20:02:34 +09:00
Tom Pittenger
ffe1561f31 AP_InitialSensor_MPU6000: compiler warning - init order 2015-08-19 20:02:33 +09:00
Tom Pittenger
e7a7f43260 AC_WPNav: compiler warnings: float to double 2015-08-19 20:02:32 +09:00
Randy Mackay
c5b85d8c71 Copter: update AC3.3-rc8 release notes 2015-08-19 20:02:31 +09:00
Robert Lefebvre
0615d7a058 AC_Heli_PID: Deprecate Accel Feedforward. 2015-07-30 14:22:55 +09:00
Robert Lefebvre
bfc10c1969 AC_AttitudeControl_Heli: Remove Accel Feedforward. 2015-07-30 14:22:53 +09:00
Randy Mackay
818ef28206 Copter: version to AC3.3-rc8 2015-07-25 14:16:20 +09:00
794 changed files with 11318 additions and 7439 deletions

3
.gitmodules vendored
View File

@ -7,3 +7,6 @@
[submodule "modules/uavcan"]
path = modules/uavcan
url = git://github.com/diydrones/uavcan.git
[submodule "modules/mavlink"]
path = modules/mavlink
url = git://github.com/diydrones/mavlink

View File

@ -1,11 +1,26 @@
language: cpp
sudo: required
before_install:
- APMDIR=$(pwd) && pushd .. && $APMDIR/Tools/scripts/install-travis-env.sh -y && . ~/.profile && popd
cache:
directories:
- $HOME/opt
script:
- Tools/scripts/build_all_travis.sh
addons:
coverity_scan:
project:
name: "diydrones/ardupilot"
description: "Build submitted via Travis CI"
notification_email: andrew-scan@tridgell.net
build_command_prepend: "make clean"
build_command: "make"
branch_pattern: coverity_scan
before_install:
- APMDIR=$(pwd) && pushd .. && $APMDIR/Tools/scripts/configure-ci.sh && . ~/.profile && popd
script:
- python Tools/autotest/param_metadata/param_parse.py
- Tools/scripts/build_ci.sh
notifications:
webhooks:
@ -21,15 +36,5 @@ env:
# via the "travis encrypt" command using the project repo's public key
- secure: "FjIwqZQV2FhNPWYITX5LZXTE38yYqBaQdbm3QmbEg/30wnPTm1ZOLIU7o/aSvX615ImR8kHoryvFPDQDWc6wWfqTEs3Ytq2kIvcIJS2Y5l/0PFfpWJoH5gRd6hDThnoi+1oVMLvj1+bhn4yFlCCQ2vT/jxoGfiQqqgvHtv4fLzI="
matrix:
- TRAVIS_BUILD_TARGET="px4-v2"
- TRAVIS_BUILD_TARGET="sitl linux apm2 navio"
addons:
coverity_scan:
project:
name: "diydrones/ardupilot"
description: "Build submitted via Travis CI"
notification_email: andrew-scan@tridgell.net
build_command_prepend: "make clean"
build_command: "make"
branch_pattern: coverity_scan
- CI_BUILD_TARGET="px4-v2 sitl linux"
- CI_BUILD_TARGET="navio raspilot minlure bebop"

View File

@ -20,9 +20,9 @@
ArduPlane by Jean-Louis Naudin (JLN), and then rewritten after the
AP_HAL merge by Andrew Tridgell
Maintainer: Andrew Tridgell
Maintainer: Grant Morphett
Authors: Doug Weibel, Jose Julio, Jordi Munoz, Jason Short, Andrew Tridgell, Randy Mackay, Pat Hickey, John Arne Birkeland, Olivier Adler, Jean-Louis Naudin
Authors: Doug Weibel, Jose Julio, Jordi Munoz, Jason Short, Andrew Tridgell, Randy Mackay, Pat Hickey, John Arne Birkeland, Olivier Adler, Jean-Louis Naudin, Grant Morphett
Thanks to: Chris Anderson, Michael Oborne, Paul Mather, Bill Premerlani, James Cohen, JB from rotorFX, Automatik, Fefenin, Peter Meister, Remzibi, Yury Smirnov, Sandro Benigno, Max Levine, Roberto Navoni, Lorenz Meier
@ -124,7 +124,17 @@ void Rover::loop()
// tell the scheduler one tick has passed
scheduler.tick();
scheduler.run(19500U);
// run all the tasks that are due to run. Note that we only
// have to call this once per loop, as the tasks are scheduled
// in multiples of the main loop tick. So if they don't run on
// the first call to the scheduler they won't run on a later
// call until scheduler.tick() is called again
uint32_t remaining = (timer + 20000) - micros();
if (remaining > 19500) {
remaining = 19500;
}
scheduler.run(remaining);
}
// update AHRS system
@ -376,17 +386,15 @@ void Rover::update_current_mode(void)
case GUIDED:
set_reverse(false);
if (!rtl_complete) {
if (verify_RTL()) {
// we have reached destination so stop where we are
channel_throttle->servo_out = g.throttle_min.get();
channel_steer->servo_out = 0;
lateral_acceleration = 0;
} else {
calc_lateral_acceleration();
calc_nav_steer();
calc_throttle(g.speed_cruise);
}
if (rtl_complete || verify_RTL()) {
// we have reached destination so stop where we are
channel_throttle->servo_out = g.throttle_min.get();
channel_steer->servo_out = 0;
lateral_acceleration = 0;
} else {
calc_lateral_acceleration();
calc_nav_steer();
calc_throttle(g.speed_cruise);
}
break;
@ -475,13 +483,11 @@ void Rover::update_navigation()
// no loitering around the wp with the rover, goes direct to the wp position
calc_lateral_acceleration();
calc_nav_steer();
if (!rtl_complete) {
if (verify_RTL()) {
// we have reached destination so stop where we are
channel_throttle->servo_out = g.throttle_min.get();
channel_steer->servo_out = 0;
lateral_acceleration = 0;
}
if (rtl_complete || verify_RTL()) {
// we have reached destination so stop where we are
channel_throttle->servo_out = g.throttle_min.get();
channel_steer->servo_out = 0;
lateral_acceleration = 0;
}
break;
}

View File

@ -5,10 +5,6 @@
// default sensors are present and healthy: gyro, accelerometer, rate_control, attitude_stabilization, yaw_position, altitude control, x/y position control, motor_control
#define MAVLINK_SENSOR_PRESENT_DEFAULT (MAV_SYS_STATUS_SENSOR_3D_GYRO | MAV_SYS_STATUS_SENSOR_3D_ACCEL | MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL | MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION | MAV_SYS_STATUS_SENSOR_YAW_POSITION | MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL | MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS | MAV_SYS_STATUS_AHRS)
// check if a message will fit in the payload space available
#define HAVE_PAYLOAD_SPACE(chan, id) (comm_get_txspace(chan) >= MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_MSG_ID_ ## id ## _LEN)
#define CHECK_PAYLOAD_SIZE(id) if (txspace < MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_MSG_ID_## id ##_LEN) return false
void Rover::send_heartbeat(mavlink_channel_t chan)
{
uint8_t base_mode = MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
@ -169,6 +165,16 @@ void Rover::send_extended_status1(mavlink_channel_t chan)
battery_current = battery.current_amps() * 100;
}
if (sonar.num_sensors() > 0) {
control_sensors_present |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
if (g.sonar_trigger_cm > 0) {
control_sensors_enabled |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
}
if (sonar.has_data()) {
control_sensors_health |= MAV_SYS_STATUS_SENSOR_LASER_POSITION;
}
}
if (AP_Notify::flags.initialising) {
// while initialising the gyros and accels are not enabled
control_sensors_enabled &= ~(MAV_SYS_STATUS_SENSOR_3D_GYRO | MAV_SYS_STATUS_SENSOR_3D_ACCEL);
@ -406,8 +412,6 @@ bool Rover::telemetry_delayed(mavlink_channel_t chan)
// try to send a message, return false if it won't fit in the serial tx buffer
bool GCS_MAVLINK::try_send_message(enum ap_message id)
{
uint16_t txspace = comm_get_txspace(chan);
if (rover.telemetry_delayed(chan)) {
return false;
}
@ -580,10 +584,16 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
rover.send_pid_tuning(chan);
break;
case MSG_MISSION_ITEM_REACHED:
CHECK_PAYLOAD_SIZE(MISSION_ITEM_REACHED);
mavlink_msg_mission_item_reached_send(chan, mission_item_reached_index);
break;
case MSG_RETRY_DEFERRED:
case MSG_TERRAIN:
case MSG_OPTICAL_FLOW:
case MSG_GIMBAL_REPORT:
case MSG_RPM:
break; // just here to prevent a warning
}
@ -1016,7 +1026,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: {
if (is_equal(packet.param1,1.0f)) {
rover.gcs[chan-MAVLINK_COMM_0].send_autopilot_version();
rover.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION);
result = MAV_RESULT_ACCEPTED;
}
break;
@ -1258,7 +1268,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
#endif
case MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST:
rover.gcs[chan-MAVLINK_COMM_0].send_autopilot_version();
rover.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION);
break;
} // end switch
@ -1310,6 +1320,19 @@ void Rover::gcs_send_message(enum ap_message id)
}
}
/*
* send a mission item reached message and load the index before the send attempt in case it may get delayed
*/
void Rover::gcs_send_mission_item_reached_message(uint16_t mission_index)
{
for (uint8_t i=0; i<num_gcs; i++) {
if (gcs[i].initialised) {
gcs[i].mission_item_reached_index = mission_index;
gcs[i].send_message(MSG_MISSION_ITEM_REACHED);
}
}
}
/*
* send data streams in the given rate range on both links
*/

View File

@ -32,7 +32,7 @@ const AP_Param::Info Rover::var_info[] PROGMEM = {
// @Param: INITIAL_MODE
// @DisplayName: Initial driving mode
// @Description: This selects the mode to start in on boot. This is useful for when you want to start in AUTO mode on boot without a receiver. Usuallly used in combination with when AUTO_TRIGGER_PIN or AUTO_KICKSTART.
// @Description: This selects the mode to start in on boot. This is useful for when you want to start in AUTO mode on boot without a receiver. Usually used in combination with when AUTO_TRIGGER_PIN or AUTO_KICKSTART.
// @Values: 0:MANUAL,2:LEARNING,3:STEERING,4:HOLD,10:AUTO,11:RTL,15:GUIDED
// @User: Advanced
GSCALAR(initial_mode, "INITIAL_MODE", MANUAL),
@ -310,7 +310,7 @@ const AP_Param::Info Rover::var_info[] PROGMEM = {
// @Param: FS_THR_VALUE
// @DisplayName: Throttle Failsafe Value
// @Description: The PWM level on channel 3 below which throttle sailsafe triggers.
// @Description: The PWM level on channel 3 below which throttle failsafe triggers.
// @Range: 925 1100
// @Increment: 1
// @User: Standard

View File

@ -3,7 +3,7 @@
#ifndef PARAMETERS_H
#define PARAMETERS_H
#include <AP_Common.h>
#include <AP_Common/AP_Common.h>
// Global parameter class.
//

View File

@ -32,7 +32,7 @@ Rover::Rover(void) :
steerController(ahrs),
mission(ahrs,
FUNCTOR_BIND_MEMBER(&Rover::start_command, bool, const AP_Mission::Mission_Command&),
FUNCTOR_BIND_MEMBER(&Rover::verify_command, bool, const AP_Mission::Mission_Command&),
FUNCTOR_BIND_MEMBER(&Rover::verify_command_callback, bool, const AP_Mission::Mission_Command&),
FUNCTOR_BIND_MEMBER(&Rover::exit_mission, void)),
num_gcs(MAVLINK_COMM_NUM_BUFFERS),
ServoRelayEvents(relay),

View File

@ -20,69 +20,70 @@
#ifndef _ROVER_H_
#define _ROVER_H_
#define THISFIRMWARE "ArduRover v2.50"
#define THISFIRMWARE "ArduRover v2.51-beta"
#define FIRMWARE_VERSION 2,51,0,FIRMWARE_VERSION_TYPE_BETA
#include <math.h>
#include <stdarg.h>
// Libraries
#include <AP_Common.h>
#include <AP_Progmem.h>
#include <AP_HAL.h>
#include <AP_Menu.h>
#include <AP_Param.h>
#include <StorageManager.h>
#include <AP_GPS.h> // ArduPilot GPS library
#include <AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource.h>
#include <AP_Baro.h>
#include <AP_Compass.h> // ArduPilot Mega Magnetometer Library
#include <AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
#include <AP_InertialSensor.h> // Inertial Sensor (uncalibated IMU) Library
#include <AP_AHRS.h> // ArduPilot Mega DCM Library
#include <AP_NavEKF.h>
#include <AP_Mission.h> // Mission command library
#include <AP_Rally.h>
#include <AP_Terrain.h>
#include <PID.h> // PID library
#include <RC_Channel.h> // RC Channel Library
#include <AP_RangeFinder.h> // Range finder library
#include <Filter.h> // Filter library
#include <Butter.h> // Filter library - butterworth filter
#include <AP_Buffer.h> // FIFO buffer library
#include <ModeFilter.h> // Mode Filter from Filter library
#include <AverageFilter.h> // Mode Filter from Filter library
#include <AP_Relay.h> // APM relay
#include <AP_ServoRelayEvents.h>
#include <AP_Mount.h> // Camera/Antenna mount
#include <AP_Camera.h> // Camera triggering
#include <GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager.h> // Serial manager library
#include <AP_Airspeed.h> // needed for AHRS build
#include <AP_Vehicle.h> // needed for AHRS build
#include <DataFlash.h>
#include <AP_RCMapper.h> // RC input mapping library
#include <SITL.h>
#include <AP_Scheduler.h> // main loop scheduler
#include <AP_Common/AP_Common.h>
#include <AP_Progmem/AP_Progmem.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_Menu/AP_Menu.h>
#include <AP_Param/AP_Param.h>
#include <StorageManager/StorageManager.h>
#include <AP_GPS/AP_GPS.h> // ArduPilot GPS library
#include <AP_ADC/AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource/AP_ADC_AnalogSource.h>
#include <AP_Baro/AP_Baro.h>
#include <AP_Compass/AP_Compass.h> // ArduPilot Mega Magnetometer Library
#include <AP_Math/AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
#include <AP_InertialSensor/AP_InertialSensor.h> // Inertial Sensor (uncalibated IMU) Library
#include <AP_AHRS/AP_AHRS.h> // ArduPilot Mega DCM Library
#include <AP_NavEKF/AP_NavEKF.h>
#include <AP_Mission/AP_Mission.h> // Mission command library
#include <AP_Rally/AP_Rally.h>
#include <AP_Terrain/AP_Terrain.h>
#include <PID/PID.h> // PID library
#include <RC_Channel/RC_Channel.h> // RC Channel Library
#include <AP_RangeFinder/AP_RangeFinder.h> // Range finder library
#include <Filter/Filter.h> // Filter library
#include <Filter/Butter.h> // Filter library - butterworth filter
#include <AP_Buffer/AP_Buffer.h> // FIFO buffer library
#include <Filter/ModeFilter.h> // Mode Filter from Filter library
#include <Filter/AverageFilter.h> // Mode Filter from Filter library
#include <AP_Relay/AP_Relay.h> // APM relay
#include <AP_ServoRelayEvents/AP_ServoRelayEvents.h>
#include <AP_Mount/AP_Mount.h> // Camera/Antenna mount
#include <AP_Camera/AP_Camera.h> // Camera triggering
#include <GCS_MAVLink/GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager/AP_SerialManager.h> // Serial manager library
#include <AP_Airspeed/AP_Airspeed.h> // needed for AHRS build
#include <AP_Vehicle/AP_Vehicle.h> // needed for AHRS build
#include <DataFlash/DataFlash.h>
#include <AP_RCMapper/AP_RCMapper.h> // RC input mapping library
#include <SITL/SITL.h>
#include <AP_Scheduler/AP_Scheduler.h> // main loop scheduler
#include <stdarg.h>
#include <AP_Navigation.h>
#include <APM_Control.h>
#include <AP_L1_Control.h>
#include <AP_BoardConfig.h>
#include <AP_Frsky_Telem.h>
#include <AP_Navigation/AP_Navigation.h>
#include <APM_Control/APM_Control.h>
#include <AP_L1_Control/AP_L1_Control.h>
#include <AP_BoardConfig/AP_BoardConfig.h>
#include <AP_Frsky_Telem/AP_Frsky_Telem.h>
#include <AP_HAL_AVR.h>
#include <AP_HAL_SITL.h>
#include <AP_HAL_PX4.h>
#include <AP_HAL_VRBRAIN.h>
#include <AP_HAL_FLYMAPLE.h>
#include <AP_HAL_Linux.h>
#include <AP_HAL_Empty.h>
#include <AP_HAL_AVR/AP_HAL_AVR.h>
#include <AP_HAL_SITL/AP_HAL_SITL.h>
#include <AP_HAL_PX4/AP_HAL_PX4.h>
#include <AP_HAL_VRBRAIN/AP_HAL_VRBRAIN.h>
#include <AP_HAL_FLYMAPLE/AP_HAL_FLYMAPLE.h>
#include <AP_HAL_Linux/AP_HAL_Linux.h>
#include <AP_HAL_Empty/AP_HAL_Empty.h>
#include "compat.h"
#include <AP_Notify.h> // Notify library
#include <AP_BattMonitor.h> // Battery monitor library
#include <AP_OpticalFlow.h> // Optical Flow library
#include <AP_Notify/AP_Notify.h> // Notify library
#include <AP_BattMonitor/AP_BattMonitor.h> // Battery monitor library
#include <AP_OpticalFlow/AP_OpticalFlow.h> // Optical Flow library
// Configuration
#include "config.h"
@ -90,9 +91,9 @@
// Local modules
#include "defines.h"
#include "Parameters.h"
#include "GCS.h"
#include <GCS_MAVLink/GCS.h>
#include <AP_Declination.h> // ArduPilot Mega Declination Helper Library
#include <AP_Declination/AP_Declination.h> // ArduPilot Mega Declination Helper Library
class Rover {
public:
@ -358,6 +359,12 @@ private:
static const AP_Param::Info var_info[];
static const LogStructure log_structure[];
// Loiter control
uint16_t loiter_time_max; // How long we should loiter at the nav_waypoint (time in seconds)
uint32_t loiter_time; // How long have we been loitering - The start time in millis
float distance_past_wp; // record the distance we have gone past the wp
private:
// private member functions
void ahrs_update();
@ -390,6 +397,7 @@ private:
void send_statustext(mavlink_channel_t chan);
bool telemetry_delayed(mavlink_channel_t chan);
void gcs_send_message(enum ap_message id);
void gcs_send_mission_item_reached_message(uint16_t mission_index);
void gcs_data_stream_send(void);
void gcs_update(void);
void gcs_send_text_P(gcs_severity severity, const prog_char_t *str);
@ -484,6 +492,7 @@ private:
void print_mode(AP_HAL::BetterStream *port, uint8_t mode);
bool start_command(const AP_Mission::Mission_Command& cmd);
bool verify_command(const AP_Mission::Mission_Command& cmd);
bool verify_command_callback(const AP_Mission::Mission_Command& cmd);
void do_nav_wp(const AP_Mission::Mission_Command& cmd);
bool verify_nav_wp(const AP_Mission::Mission_Command& cmd);
void do_wait_delay(const AP_Mission::Mission_Command& cmd);
@ -492,6 +501,7 @@ private:
void do_set_home(const AP_Mission::Mission_Command& cmd);
void do_digicam_configure(const AP_Mission::Mission_Command& cmd);
void do_digicam_control(const AP_Mission::Mission_Command& cmd);
void init_capabilities(void);
public:
bool print_log_menu(void);

View File

@ -85,8 +85,10 @@ bool Rover::use_pivot_steering(void)
calculate the throtte for auto-throttle modes
*/
void Rover::calc_throttle(float target_speed)
{
if (!auto_check_trigger()) {
{
// If not autostarting OR we are loitering at a waypoint
// then set the throttle to minimum
if (!auto_check_trigger() || ((loiter_time > 0) && (control_mode == AUTO))) {
channel_throttle->servo_out = g.throttle_min.get();
return;
}
@ -196,6 +198,12 @@ void Rover::calc_lateral_acceleration()
*/
void Rover::calc_nav_steer()
{
// check to see if the rover is loitering
if ((loiter_time > 0) && (control_mode == AUTO)) {
channel_steer->servo_out = 0;
return;
}
// add in obstacle avoidance
lateral_acceleration += (obstacle.turn_angle/45.0f) * g.turn_max_g;

View File

@ -0,0 +1,9 @@
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "Rover.h"
void Rover::init_capabilities(void)
{
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT);
}

View File

@ -122,6 +122,22 @@ void Rover::exit_mission()
}
}
// verify_command_callback - callback function called from ap-mission at 10hz or higher when a command is being run
// we double check that the flight mode is AUTO to avoid the possibility of ap-mission triggering actions while we're not in AUTO mode
bool Rover::verify_command_callback(const AP_Mission::Mission_Command& cmd)
{
if (control_mode == AUTO) {
bool cmd_complete = verify_command(cmd);
// send message to GCS
if (cmd_complete) {
gcs_send_mission_item_reached_message(cmd.index);
}
return cmd_complete;
}
return false;
}
/********************************************************************************/
// Verify command Handlers
// Returns true if command complete
@ -129,12 +145,6 @@ void Rover::exit_mission()
bool Rover::verify_command(const AP_Mission::Mission_Command& cmd)
{
// exit immediately if not in AUTO mode
// we return true or we will continue to be called by ap-mission
if (control_mode != AUTO) {
return true;
}
switch(cmd.id) {
case MAV_CMD_NAV_WAYPOINT:
@ -145,11 +155,9 @@ bool Rover::verify_command(const AP_Mission::Mission_Command& cmd)
case MAV_CMD_CONDITION_DELAY:
return verify_wait_delay();
break;
case MAV_CMD_CONDITION_DISTANCE:
return verify_within_distance();
break;
default:
if (cmd.id > MAV_CMD_CONDITION_LAST) {
@ -158,7 +166,6 @@ bool Rover::verify_command(const AP_Mission::Mission_Command& cmd)
}
gcs_send_text_P(SEVERITY_HIGH,PSTR("verify_conditon: Unsupported command"));
return true;
break;
}
return false;
}
@ -176,6 +183,14 @@ void Rover::do_RTL(void)
void Rover::do_nav_wp(const AP_Mission::Mission_Command& cmd)
{
// this will be used to remember the time in millis after we reach or pass the WP.
loiter_time = 0;
// this is the delay, stored in seconds
loiter_time_max = abs(cmd.p1);
// this is the distance we travel past the waypoint - not there yet so 0 initially
distance_past_wp = 0;
set_next_WP(cmd.content.location);
}
@ -185,17 +200,45 @@ void Rover::do_nav_wp(const AP_Mission::Mission_Command& cmd)
bool Rover::verify_nav_wp(const AP_Mission::Mission_Command& cmd)
{
if ((wp_distance > 0) && (wp_distance <= g.waypoint_radius)) {
gcs_send_text_fmt(PSTR("Reached Waypoint #%i dist %um"),
(unsigned)cmd.index,
(unsigned)get_distance(current_loc, next_WP));
// Check if we need to loiter at this waypoint
if (loiter_time_max > 0) {
if (loiter_time == 0) { // check if we are just starting loiter
gcs_send_text_fmt(PSTR("Reached Waypoint #%i - Loiter for %i seconds"),
(unsigned)cmd.index,
(unsigned)loiter_time_max);
// record the current time i.e. start timer
loiter_time = millis();
}
// Check if we have loiter long enough
if (((millis() - loiter_time) / 1000) < loiter_time_max) {
return false;
}
} else {
gcs_send_text_fmt(PSTR("Reached Waypoint #%i dist %um"),
(unsigned)cmd.index,
(unsigned)get_distance(current_loc, next_WP));
}
return true;
}
// have we gone past the waypoint?
// We should always go through the waypoint i.e. the above code
// first before we go past it.
if (location_passed_point(current_loc, prev_WP, next_WP)) {
gcs_send_text_fmt(PSTR("Passed Waypoint #%i dist %um"),
(unsigned)cmd.index,
(unsigned)get_distance(current_loc, next_WP));
// check if we have gone futher past the wp then last time and output new message if we have
if ((uint32_t)distance_past_wp != (uint32_t)get_distance(current_loc, next_WP)) {
distance_past_wp = get_distance(current_loc, next_WP);
gcs_send_text_fmt(PSTR("Passed Waypoint #%i dist %um"),
(unsigned)cmd.index,
(unsigned)distance_past_wp);
}
// Check if we need to loiter at this waypoint
if (loiter_time_max > 0) {
if (((millis() - loiter_time) / 1000) < loiter_time_max) {
return false;
}
}
distance_past_wp = 0;
return true;
}

View File

@ -55,8 +55,13 @@ void Rover::read_radio()
channel_throttle->servo_out = channel_throttle->control_in;
if (abs(channel_throttle->servo_out) > 50) {
throttle_nudge = (g.throttle_max - g.throttle_cruise) * ((fabsf(channel_throttle->norm_input())-0.5f) / 0.5f);
// Check if the throttle value is above 50% and we need to nudge
// Make sure its above 50% in the direction we are travelling
if ((abs(channel_throttle->servo_out) > 50) &&
(((channel_throttle->servo_out < 0) && in_reverse) ||
((channel_throttle->servo_out > 0) && !in_reverse))) {
throttle_nudge = (g.throttle_max - g.throttle_cruise) *
((fabsf(channel_throttle->norm_input())-0.5f) / 0.5f);
} else {
throttle_nudge = 0;
}

View File

@ -210,6 +210,8 @@ void Rover::init_ardupilot()
}
#endif
init_capabilities();
startup_ground();
Log_Write_Startup(TYPE_GROUNDSTART_MSG);
@ -277,6 +279,11 @@ void Rover::set_mode(enum mode mode)
// don't switch modes if we are already in the correct mode.
return;
}
// If we are changing out of AUTO mode reset the loiter timer
if (control_mode == AUTO)
loiter_time = 0;
control_mode = mode;
throttle_last = 0;
throttle = 500;

View File

@ -8,9 +8,6 @@
// use this to prevent recursion during sensor init
static bool in_mavlink_delay;
// check if a message will fit in the payload space available
#define CHECK_PAYLOAD_SIZE(id) if (txspace < MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_MSG_ID_ ## id ## _LEN) return false
/*
* !!NOTE!!
*
@ -165,11 +162,19 @@ void Tracker::send_simstate(mavlink_channel_t chan)
#endif
}
void GCS_MAVLINK::handle_guided_request(AP_Mission::Mission_Command&)
{
// do nothing
}
void GCS_MAVLINK::handle_change_alt_request(AP_Mission::Mission_Command&)
{
// do nothing
}
// try to send a message, return false if it won't fit in the serial tx buffer
bool GCS_MAVLINK::try_send_message(enum ap_message id)
{
uint16_t txspace = comm_get_txspace(chan);
switch (id) {
case MSG_HEARTBEAT:
CHECK_PAYLOAD_SIZE(HEARTBEAT);
@ -276,6 +281,8 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
case MSG_EKF_STATUS_REPORT:
case MSG_PID_TUNING:
case MSG_VIBRATION:
case MSG_RPM:
case MSG_MISSION_ITEM_REACHED:
break; // just here to prevent a warning
}
return true;
@ -684,7 +691,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: {
if (is_equal(packet.param1,1.0f)) {
tracker.gcs[chan-MAVLINK_COMM_0].send_autopilot_version();
tracker.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION);
result = MAV_RESULT_ACCEPTED;
}
break;
@ -849,7 +856,7 @@ mission_failed:
#endif
case MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST:
tracker.gcs[chan-MAVLINK_COMM_0].send_autopilot_version();
tracker.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION);
break;
} // end switch
@ -968,4 +975,3 @@ void Tracker::gcs_retry_deferred(void)
{
gcs_send_message(MSG_RETRY_DEFERRED);
}

View File

@ -3,7 +3,7 @@
#ifndef PARAMETERS_H
#define PARAMETERS_H
#include <AP_Common.h>
#include <AP_Common/AP_Common.h>
// Global parameter class.
//

View File

@ -1,5 +1,9 @@
Antenna Tracker Release Notes:
------------------------------------------------------------------
AntennaTracker 0.7.2 1-Aug-2015
Changes from 0.7.1
1) Fixed Pitch
------------------------------------------------------------------
AntennaTracker 0.7.1 29-May-2015
Changes from 0.7
1) Added support for continuous rotation (CR) servos

View File

@ -1,6 +1,8 @@
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#define THISFIRMWARE "AntennaTracker V0.7.1"
#define THISFIRMWARE "AntennaTracker V0.7.2"
#define FIRMWARE_VERSION 0,7,2,FIRMWARE_VERSION_TYPE_DEV
/*
Lead developers: Matthew Ridley and Andrew Tridgell
@ -28,57 +30,57 @@
#include <stdarg.h>
#include <stdio.h>
#include <AP_Common.h>
#include <AP_Progmem.h>
#include <AP_HAL.h>
#include <AP_Param.h>
#include <StorageManager.h>
#include <AP_GPS.h> // ArduPilot GPS library
#include <AP_Baro.h> // ArduPilot barometer library
#include <AP_Compass.h> // ArduPilot Mega Magnetometer Library
#include <AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
#include <AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource.h>
#include <AP_InertialSensor.h> // Inertial Sensor Library
#include <AP_AHRS.h> // ArduPilot Mega DCM Library
#include <Filter.h> // Filter library
#include <AP_Buffer.h> // APM FIFO Buffer
#include <memcheck.h>
#include <AP_Common/AP_Common.h>
#include <AP_Progmem/AP_Progmem.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_Param/AP_Param.h>
#include <StorageManager/StorageManager.h>
#include <AP_GPS/AP_GPS.h> // ArduPilot GPS library
#include <AP_Baro/AP_Baro.h> // ArduPilot barometer library
#include <AP_Compass/AP_Compass.h> // ArduPilot Mega Magnetometer Library
#include <AP_Math/AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
#include <AP_ADC/AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource/AP_ADC_AnalogSource.h>
#include <AP_InertialSensor/AP_InertialSensor.h> // Inertial Sensor Library
#include <AP_AHRS/AP_AHRS.h> // ArduPilot Mega DCM Library
#include <Filter/Filter.h> // Filter library
#include <AP_Buffer/AP_Buffer.h> // APM FIFO Buffer
#include <AP_HAL_AVR/memcheck.h>
#include <GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager.h> // Serial manager library
#include <AP_Declination.h> // ArduPilot Mega Declination Helper Library
#include <DataFlash.h>
#include <SITL.h>
#include <PID.h>
#include <AP_Scheduler.h> // main loop scheduler
#include <AP_NavEKF.h>
#include <GCS_MAVLink/GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager/AP_SerialManager.h> // Serial manager library
#include <AP_Declination/AP_Declination.h> // ArduPilot Mega Declination Helper Library
#include <DataFlash/DataFlash.h>
#include <SITL/SITL.h>
#include <PID/PID.h>
#include <AP_Scheduler/AP_Scheduler.h> // main loop scheduler
#include <AP_NavEKF/AP_NavEKF.h>
#include <AP_Vehicle.h>
#include <AP_Mission.h>
#include <AP_Terrain.h>
#include <AP_Rally.h>
#include <AP_Notify.h> // Notify library
#include <AP_BattMonitor.h> // Battery monitor library
#include <AP_Airspeed.h>
#include <RC_Channel.h>
#include <AP_BoardConfig.h>
#include <AP_OpticalFlow.h>
#include <AP_RangeFinder.h>
#include <AP_Vehicle/AP_Vehicle.h>
#include <AP_Mission/AP_Mission.h>
#include <AP_Terrain/AP_Terrain.h>
#include <AP_Rally/AP_Rally.h>
#include <AP_Notify/AP_Notify.h> // Notify library
#include <AP_BattMonitor/AP_BattMonitor.h> // Battery monitor library
#include <AP_Airspeed/AP_Airspeed.h>
#include <RC_Channel/RC_Channel.h>
#include <AP_BoardConfig/AP_BoardConfig.h>
#include <AP_OpticalFlow/AP_OpticalFlow.h>
#include <AP_RangeFinder/AP_RangeFinder.h>
// Configuration
#include "config.h"
#include "defines.h"
#include "Parameters.h"
#include "GCS.h"
#include <GCS_MAVLink/GCS.h>
#include <AP_HAL_AVR.h>
#include <AP_HAL_SITL.h>
#include <AP_HAL_PX4.h>
#include <AP_HAL_FLYMAPLE.h>
#include <AP_HAL_Linux.h>
#include <AP_HAL_Empty.h>
#include <AP_HAL_AVR/AP_HAL_AVR.h>
#include <AP_HAL_SITL/AP_HAL_SITL.h>
#include <AP_HAL_PX4/AP_HAL_PX4.h>
#include <AP_HAL_FLYMAPLE/AP_HAL_FLYMAPLE.h>
#include <AP_HAL_Linux/AP_HAL_Linux.h>
#include <AP_HAL_Empty/AP_HAL_Empty.h>
class Tracker {
public:
@ -165,7 +167,7 @@ private:
bool need_altitude_calibration : 1;// true if tracker altitude has not been determined (true after startup)
bool scan_reverse_pitch : 1;// controls direction of pitch movement in SCAN mode
bool scan_reverse_yaw : 1;// controls direction of yaw movement in SCAN mode
} nav_status = {0.0f, 0.0f, 0.0f, 0.0f, false, false, true, false, false};
} nav_status = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, false, false, true, false, false};
// Servo state
struct {
@ -244,6 +246,7 @@ private:
void tracking_manual_control(const mavlink_manual_control_t &msg);
void update_armed_disarmed();
void gcs_send_text_fmt(const prog_char_t *fmt, ...);
void init_capabilities(void);
public:
void mavlink_snoop(const mavlink_message_t* msg);

View File

@ -0,0 +1,8 @@
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "Tracker.h"
void Tracker::init_capabilities(void)
{
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT);
}

View File

@ -0,0 +1,4 @@
AntennaTracker README
User Manual: http://antennatracker.ardupilot.com/
Developer Manual: http://dev.ardupilot.com/

View File

@ -102,6 +102,8 @@ void Tracker::init_tracker()
get_home_eeprom(current_loc);
}
init_capabilities();
gcs_send_text_P(SEVERITY_LOW,PSTR("\nReady to track."));
hal.scheduler->delay(1000); // Why????

View File

@ -128,6 +128,7 @@ const AP_Scheduler::Task Copter::scheduler_tasks[] PROGMEM = {
{ SCHED_TASK(full_rate_logging_loop),1, 100 },
{ SCHED_TASK(perf_update), 4000, 75 },
{ SCHED_TASK(read_receiver_rssi), 40, 75 },
{ SCHED_TASK(rpm_update), 40, 200 },
#if FRSKY_TELEM_ENABLED == ENABLED
{ SCHED_TASK(frsky_telemetry_send), 80, 75 },
#endif
@ -463,10 +464,16 @@ void Copter::one_hz_loop()
// make it possible to change ahrs orientation at runtime during initial config
ahrs.set_orientation();
#if FRAME_CONFIG == HELI_FRAME
// helicopters are always using motor interlock
set_using_interlock(true);
#else
// check the user hasn't updated the frame orientation
motors.set_frame_orientation(g.frame_orientation);
#if FRAME_CONFIG != HELI_FRAME
// check if we are using motor interlock control on an aux switch
set_using_interlock(check_if_auxsw_mode_used(AUXSW_MOTOR_INTERLOCK));
// set all throttle channel settings
motors.set_throttle_range(g.throttle_min, channel_throttle->radio_min, channel_throttle->radio_max);
// set hover throttle

View File

@ -36,9 +36,9 @@ void Copter::get_pilot_desired_lean_angles(float roll_in, float pitch_in, float
pitch_out = pitch_in;
}
// get_pilot_desired_heading - transform pilot's yaw input into a desired heading
// returns desired angle in centi-degrees
// To-Do: return heading as a float?
// get_pilot_desired_heading - transform pilot's yaw input into a
// desired yaw rate
// returns desired yaw rate in centi-degrees per second
float Copter::get_pilot_desired_yaw_rate(int16_t stick_angle)
{
// convert pilot input to the desired yaw rate
@ -308,3 +308,12 @@ void Copter::update_poscon_alt_max()
// pass limit to pos controller
pos_control.set_alt_max(alt_limit_cm);
}
// rotate vector from vehicle's perspective to North-East frame
void Copter::rotate_body_frame_to_NE(float &x, float &y)
{
float ne_x = x*ahrs.cos_yaw() - y*ahrs.sin_yaw();
float ne_y = x*ahrs.sin_yaw() + y*ahrs.cos_yaw();
x = ne_x;
y = ne_y;
}

View File

@ -31,7 +31,10 @@ Copter::Copter(void) :
FUNCTOR_BIND_MEMBER(&Copter::exit_mission, void)),
control_mode(STABILIZE),
#if FRAME_CONFIG == HELI_FRAME // helicopter constructor requires more arguments
motors(g.rc_7, g.rc_8, g.heli_servo_1, g.heli_servo_2, g.heli_servo_3, g.heli_servo_4, MAIN_LOOP_RATE),
motors(g.rc_7, g.heli_servo_rsc, g.heli_servo_1, g.heli_servo_2, g.heli_servo_3, g.heli_servo_4, MAIN_LOOP_RATE),
// ToDo: Input Manager is only used by Heli for 3.3, but will be used by all frames for 3.4
input_manager(MAIN_LOOP_RATE),
#elif FRAME_CONFIG == TRI_FRAME // tri constructor requires additional rc_7 argument to allow tail servo reversing
motors(MAIN_LOOP_RATE),
#elif FRAME_CONFIG == SINGLE_FRAME // single constructor requires extra servos for flaps
@ -50,6 +53,7 @@ Copter::Copter(void) :
guided_mode(Guided_TakeOff),
rtl_state(RTL_InitialClimb),
rtl_state_complete(false),
rtl_alt(0.0f),
circle_pilot_yaw_override(false),
simple_cos_yaw(1.0f),
simple_sin_yaw(0.0f),
@ -122,7 +126,7 @@ Copter::Copter(void) :
#endif
in_mavlink_delay(false),
gcs_out_of_time(false),
param_loader(var_info)
param_loader(var_info)
{
memset(&current_loc, 0, sizeof(current_loc));

View File

@ -1,6 +1,8 @@
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#define THISFIRMWARE "APM:Copter V3.4-dev"
#define THISFIRMWARE "APM:Copter V3.3.4-pixracer"
#define FIRMWARE_VERSION 3,3,4,FIRMWARE_VERSION_TYPE_OFFICIAL
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -28,80 +30,83 @@
#include <stdarg.h>
// Common dependencies
#include <AP_Common.h>
#include <AP_Progmem.h>
#include <AP_Menu.h>
#include <AP_Param.h>
#include <StorageManager.h>
#include <AP_Common/AP_Common.h>
#include <AP_Progmem/AP_Progmem.h>
#include <AP_Menu/AP_Menu.h>
#include <AP_Param/AP_Param.h>
#include <StorageManager/StorageManager.h>
// AP_HAL
#include <AP_HAL.h>
#include <AP_HAL_AVR.h>
#include <AP_HAL_SITL.h>
#include <AP_HAL_PX4.h>
#include <AP_HAL_VRBRAIN.h>
#include <AP_HAL_FLYMAPLE.h>
#include <AP_HAL_Linux.h>
#include <AP_HAL_Empty.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_HAL_AVR/AP_HAL_AVR.h>
#include <AP_HAL_SITL/AP_HAL_SITL.h>
#include <AP_HAL_PX4/AP_HAL_PX4.h>
#include <AP_HAL_VRBRAIN/AP_HAL_VRBRAIN.h>
#include <AP_HAL_FLYMAPLE/AP_HAL_FLYMAPLE.h>
#include <AP_HAL_Linux/AP_HAL_Linux.h>
#include <AP_HAL_Empty/AP_HAL_Empty.h>
// Application dependencies
#include <GCS.h>
#include <GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager.h> // Serial manager library
#include <AP_GPS.h> // ArduPilot GPS library
#include <DataFlash.h> // ArduPilot Mega Flash Memory Library
#include <AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource.h>
#include <AP_Baro.h>
#include <AP_Compass.h> // ArduPilot Mega Magnetometer Library
#include <AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
#include <AP_Curve.h> // Curve used to linearlise throttle pwm to thrust
#include <AP_InertialSensor.h> // ArduPilot Mega Inertial Sensor (accel & gyro) Library
#include <AP_AHRS.h>
#include <AP_NavEKF.h>
#include <AP_Mission.h> // Mission command library
#include <AP_Rally.h> // Rally point library
#include <AC_PID.h> // PID library
#include <AC_PI_2D.h> // PID library (2-axis)
#include <AC_HELI_PID.h> // Heli specific Rate PID library
#include <AC_P.h> // P library
#include <AC_AttitudeControl_Multi.h> // Attitude control library
#include <AC_AttitudeControl_Heli.h> // Attitude control library for traditional helicopter
#include <AC_PosControl.h> // Position control library
#include <RC_Channel.h> // RC Channel Library
#include <AP_Motors.h> // AP Motors library
#include <AP_RangeFinder.h> // Range finder library
#include <AP_OpticalFlow.h> // Optical Flow library
#include <Filter.h> // Filter library
#include <AP_Buffer.h> // APM FIFO Buffer
#include <AP_Relay.h> // APM relay
#include <AP_ServoRelayEvents.h>
#include <AP_Camera.h> // Photo or video camera
#include <AP_Mount.h> // Camera/Antenna mount
#include <AP_Airspeed.h> // needed for AHRS build
#include <AP_Vehicle.h> // needed for AHRS build
#include <AP_InertialNav.h> // ArduPilot Mega inertial navigation library
#include <AC_WPNav.h> // ArduCopter waypoint navigation library
#include <AC_Circle.h> // circle navigation library
#include <AP_Declination.h> // ArduPilot Mega Declination Helper Library
#include <AC_Fence.h> // Arducopter Fence library
#include <SITL.h> // software in the loop support
#include <AP_Scheduler.h> // main loop scheduler
#include <AP_RCMapper.h> // RC input mapping library
#include <AP_Notify.h> // Notify library
#include <AP_BattMonitor.h> // Battery monitor library
#include <AP_BoardConfig.h> // board configuration library
#include <AP_Frsky_Telem.h>
#include <GCS_MAVLink/GCS.h>
#include <GCS_MAVLink/GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager/AP_SerialManager.h> // Serial manager library
#include <AP_GPS/AP_GPS.h> // ArduPilot GPS library
#include <DataFlash/DataFlash.h> // ArduPilot Mega Flash Memory Library
#include <AP_ADC/AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource/AP_ADC_AnalogSource.h>
#include <AP_Baro/AP_Baro.h>
#include <AP_Compass/AP_Compass.h> // ArduPilot Mega Magnetometer Library
#include <AP_Math/AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
#include <AP_Curve/AP_Curve.h> // Curve used to linearlise throttle pwm to thrust
#include <AP_InertialSensor/AP_InertialSensor.h> // ArduPilot Mega Inertial Sensor (accel & gyro) Library
#include <AP_AHRS/AP_AHRS.h>
#include <AP_NavEKF/AP_NavEKF.h>
#include <AP_Mission/AP_Mission.h> // Mission command library
#include <AP_Rally/AP_Rally.h> // Rally point library
#include <AC_PID/AC_PID.h> // PID library
#include <AC_PID/AC_PI_2D.h> // PID library (2-axis)
#include <AC_PID/AC_HELI_PID.h> // Heli specific Rate PID library
#include <AC_PID/AC_P.h> // P library
#include <AC_AttitudeControl/AC_AttitudeControl_Multi.h> // Attitude control library
#include <AC_AttitudeControl/AC_AttitudeControl_Heli.h> // Attitude control library for traditional helicopter
#include <AC_AttitudeControl/AC_PosControl.h> // Position control library
#include <RC_Channel/RC_Channel.h> // RC Channel Library
#include <AP_Motors/AP_Motors.h> // AP Motors library
#include <AP_RangeFinder/AP_RangeFinder.h> // Range finder library
#include <AP_OpticalFlow/AP_OpticalFlow.h> // Optical Flow library
#include <Filter/Filter.h> // Filter library
#include <AP_Buffer/AP_Buffer.h> // APM FIFO Buffer
#include <AP_Relay/AP_Relay.h> // APM relay
#include <AP_ServoRelayEvents/AP_ServoRelayEvents.h>
#include <AP_Camera/AP_Camera.h> // Photo or video camera
#include <AP_Mount/AP_Mount.h> // Camera/Antenna mount
#include <AP_Airspeed/AP_Airspeed.h> // needed for AHRS build
#include <AP_Vehicle/AP_Vehicle.h> // needed for AHRS build
#include <AP_InertialNav/AP_InertialNav.h> // ArduPilot Mega inertial navigation library
#include <AC_WPNav/AC_WPNav.h> // ArduCopter waypoint navigation library
#include <AC_WPNav/AC_Circle.h> // circle navigation library
#include <AP_Declination/AP_Declination.h> // ArduPilot Mega Declination Helper Library
#include <AC_Fence/AC_Fence.h> // Arducopter Fence library
#include <SITL/SITL.h> // software in the loop support
#include <AP_Scheduler/AP_Scheduler.h> // main loop scheduler
#include <AP_RCMapper/AP_RCMapper.h> // RC input mapping library
#include <AP_Notify/AP_Notify.h> // Notify library
#include <AP_BattMonitor/AP_BattMonitor.h> // Battery monitor library
#include <AP_BoardConfig/AP_BoardConfig.h> // board configuration library
#include <AP_Frsky_Telem/AP_Frsky_Telem.h>
#if SPRAYER == ENABLED
#include <AC_Sprayer.h> // crop sprayer library
#include <AC_Sprayer/AC_Sprayer.h> // crop sprayer library
#endif
#if EPM_ENABLED == ENABLED
#include <AP_EPM.h> // EPM cargo gripper stuff
#include <AP_EPM/AP_EPM.h> // EPM cargo gripper stuff
#endif
#if PARACHUTE == ENABLED
#include <AP_Parachute.h> // Parachute release library
#include <AP_Parachute/AP_Parachute.h> // Parachute release library
#endif
#include <AP_LandingGear.h> // Landing Gear library
#include <AP_Terrain.h>
#include <AP_LandingGear/AP_LandingGear.h> // Landing Gear library
#include <AP_Terrain/AP_Terrain.h>
#include <AP_RPM/AP_RPM.h>
#include <AC_InputManager/AC_InputManager.h> // Pilot input handling library
#include <AC_InputManager/AC_InputManager_Heli.h> // Heli specific pilot input handling library
// AP_HAL to Arduino compatibility layer
// Configuration
@ -168,10 +173,12 @@ private:
AP_InertialSensor ins;
#if CONFIG_SONAR == ENABLED
RangeFinder sonar;
RangeFinder sonar{serial_manager};
bool sonar_enabled; // enable user switch for sonar
#endif
AP_RPM rpm_sensor;
// Inertial Navigation EKF
NavEKF EKF{&ahrs, barometer, sonar};
AP_AHRS_NavEKF ahrs{ins, barometer, gps, sonar, EKF};
@ -291,7 +298,7 @@ private:
#elif FRAME_CONFIG == OCTA_QUAD_FRAME
#define MOTOR_CLASS AP_MotorsOctaQuad
#elif FRAME_CONFIG == HELI_FRAME
#define MOTOR_CLASS AP_MotorsHeli
#define MOTOR_CLASS AP_MotorsHeli_Single
#elif FRAME_CONFIG == SINGLE_FRAME
#define MOTOR_CLASS AP_MotorsSingle
#elif FRAME_CONFIG == COAX_FRAME
@ -325,6 +332,7 @@ private:
// RTL
RTLState rtl_state; // records state of rtl (initial climb, returning home, etc)
bool rtl_state_complete; // set to true if the current state is completed
float rtl_alt; // altitude the vehicle is returning at
// Circle
bool circle_pilot_yaw_override; // true if pilot is overriding yaw
@ -485,6 +493,13 @@ private:
AP_Terrain terrain;
#endif
// Pilot Input Management Library
// Only used for Helicopter for AC3.3, to be expanded to include Multirotor
// child class for AC3.4
#if FRAME_CONFIG == HELI_FRAME
AC_InputManager_Heli input_manager;
#endif
// use this to prevent recursion during sensor init
bool in_mavlink_delay;
@ -562,6 +577,7 @@ private:
float get_surface_tracking_climb_rate(int16_t target_rate, float current_alt_target, float dt);
void set_accel_throttle_I_from_pilot_throttle(int16_t pilot_throttle);
void update_poscon_alt_max();
void rotate_body_frame_to_NE(float &x, float &y);
void gcs_send_heartbeat(void);
void gcs_send_deferred(void);
void send_heartbeat(mavlink_channel_t chan);
@ -577,14 +593,16 @@ private:
void send_vfr_hud(mavlink_channel_t chan);
void send_current_waypoint(mavlink_channel_t chan);
void send_rangefinder(mavlink_channel_t chan);
void send_rpm(mavlink_channel_t chan);
void rpm_update();
void send_pid_tuning(mavlink_channel_t chan);
void send_statustext(mavlink_channel_t chan);
bool telemetry_delayed(mavlink_channel_t chan);
void gcs_send_message(enum ap_message id);
void gcs_send_mission_item_reached_message(uint16_t mission_index);
void gcs_data_stream_send(void);
void gcs_check_input(void);
void gcs_send_text_P(gcs_severity severity, const prog_char_t *str);
void gcs_send_mission_item_reached(uint16_t seq);
void do_erase_logs(void);
void Log_Write_AutoTune(uint8_t axis, uint8_t tune_step, float meas_target, float meas_min, float meas_max, float new_gain_rp, float new_gain_rd, float new_gain_sp, float new_ddt);
void Log_Write_AutoTuneDetails(float angle_cd, float rate_cds);
@ -788,7 +806,6 @@ private:
bool mode_allows_arming(uint8_t mode, bool arming_from_gcs);
void notify_flight_mode(uint8_t mode);
void heli_init();
int16_t get_pilot_desired_collective(int16_t control_in);
void check_dynamic_flight(void);
void update_heli_control_dynamics(void);
void heli_update_landing_swash();
@ -946,6 +963,7 @@ private:
void print_flight_mode(AP_HAL::BetterStream *port, uint8_t mode);
void log_init(void);
void run_cli(AP_HAL::UARTDriver *port);
void init_capabilities(void);
public:
void mavlink_delay_cb();

View File

@ -5,10 +5,6 @@
// default sensors are present and healthy: gyro, accelerometer, barometer, rate_control, attitude_stabilization, yaw_position, altitude control, x/y position control, motor_control
#define MAVLINK_SENSOR_PRESENT_DEFAULT (MAV_SYS_STATUS_SENSOR_3D_GYRO | MAV_SYS_STATUS_SENSOR_3D_ACCEL | MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE | MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL | MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION | MAV_SYS_STATUS_SENSOR_YAW_POSITION | MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL | MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL | MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS | MAV_SYS_STATUS_AHRS)
// check if a message will fit in the payload space available
#define HAVE_PAYLOAD_SPACE(chan, id) (comm_get_txspace(chan) >= MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_MSG_ID_ ## id ## _LEN)
#define CHECK_PAYLOAD_SIZE(id) if (txspace < MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_MSG_ID_ ## id ## _LEN) return false
void Copter::gcs_send_heartbeat(void)
{
gcs_send_message(MSG_HEARTBEAT);
@ -414,6 +410,19 @@ void NOINLINE Copter::send_rangefinder(mavlink_channel_t chan)
}
#endif
/*
send RPM packet
*/
void NOINLINE Copter::send_rpm(mavlink_channel_t chan)
{
if (rpm_sensor.healthy(0) || rpm_sensor.healthy(1)) {
mavlink_msg_rpm_send(
chan,
rpm_sensor.get_rpm(0),
rpm_sensor.get_rpm(1));
}
}
/*
send PID tuning message
@ -505,8 +514,6 @@ bool Copter::telemetry_delayed(mavlink_channel_t chan)
// try to send a message, return false if it won't fit in the serial tx buffer
bool GCS_MAVLINK::try_send_message(enum ap_message id)
{
uint16_t txspace = comm_get_txspace(chan);
if (copter.telemetry_delayed(chan)) {
return false;
}
@ -629,6 +636,11 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
#endif
break;
case MSG_RPM:
CHECK_PAYLOAD_SIZE(RPM);
copter.send_rpm(chan);
break;
case MSG_TERRAIN:
#if AP_TERRAIN_AVAILABLE
CHECK_PAYLOAD_SIZE(TERRAIN_REQUEST);
@ -720,6 +732,11 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
send_vibration(copter.ins);
break;
case MSG_MISSION_ITEM_REACHED:
CHECK_PAYLOAD_SIZE(MISSION_ITEM_REACHED);
mavlink_msg_mission_item_reached_send(chan, mission_item_reached_index);
break;
case MSG_RETRY_DEFERRED:
break; // just here to prevent a warning
}
@ -945,6 +962,7 @@ GCS_MAVLINK::data_stream_send(void)
send_message(MSG_GIMBAL_REPORT);
send_message(MSG_EKF_STATUS_REPORT);
send_message(MSG_VIBRATION);
send_message(MSG_RPM);
}
}
@ -1193,6 +1211,10 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
result = MAV_RESULT_ACCEPTED;
}
} else {
// sanity check location
if (fabsf(packet.param5) > 90.0f || fabsf(packet.param6) > 180.0f) {
break;
}
Location new_home_loc;
new_home_loc.lat = (int32_t)(packet.param5 * 1.0e7f);
new_home_loc.lng = (int32_t)(packet.param6 * 1.0e7f);
@ -1205,6 +1227,13 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
}
break;
case MAV_CMD_DO_FLIGHTTERMINATION:
if (packet.param1 > 0.5f) {
copter.init_disarm_motors();
result = MAV_RESULT_ACCEPTED;
}
break;
case MAV_CMD_DO_SET_ROI:
// param1 : regional of interest mode (not supported)
// param2 : mission index/ target id (not supported)
@ -1212,6 +1241,10 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
// param5 : x / lat
// param6 : y / lon
// param7 : z / alt
// sanity check location
if (fabsf(packet.param5) > 90.0f || fabsf(packet.param6) > 180.0f) {
break;
}
Location roi_loc;
roi_loc.lat = (int32_t)(packet.param5 * 1.0e7f);
roi_loc.lng = (int32_t)(packet.param6 * 1.0e7f);
@ -1297,6 +1330,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
result = MAV_RESULT_ACCEPTED;
}
} else if (is_zero(packet.param1) && (copter.mode_has_manual_throttle(copter.control_mode) || copter.ap.land_complete || is_equal(packet.param2,21196.0f))) {
// force disarming by setting param2 = 21196 is deprecated
copter.init_disarm_motors();
result = MAV_RESULT_ACCEPTED;
} else {
@ -1416,7 +1450,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: {
if (is_equal(packet.param1,1.0f)) {
copter.gcs[chan-MAVLINK_COMM_0].send_autopilot_version();
copter.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION);
result = MAV_RESULT_ACCEPTED;
}
break;
@ -1450,6 +1484,14 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
break;
}
// check for supported coordinate frames
if (packet.coordinate_frame != MAV_FRAME_LOCAL_NED &&
packet.coordinate_frame != MAV_FRAME_LOCAL_OFFSET_NED &&
packet.coordinate_frame != MAV_FRAME_BODY_NED &&
packet.coordinate_frame != MAV_FRAME_BODY_OFFSET_NED) {
break;
}
bool pos_ignore = packet.type_mask & MAVLINK_SET_POS_TYPE_MASK_POS_IGNORE;
bool vel_ignore = packet.type_mask & MAVLINK_SET_POS_TYPE_MASK_VEL_IGNORE;
bool acc_ignore = packet.type_mask & MAVLINK_SET_POS_TYPE_MASK_ACC_IGNORE;
@ -1461,16 +1503,45 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
* bool yaw_rate_ignore = packet.type_mask & MAVLINK_SET_POS_TYPE_MASK_YAW_RATE_IGNORE;
*/
// prepare position
Vector3f pos_vector;
if (!pos_ignore) {
// convert to cm
pos_vector = Vector3f(packet.x * 100.0f, packet.y * 100.0f, -packet.z * 100.0f);
// rotate to body-frame if necessary
if (packet.coordinate_frame == MAV_FRAME_BODY_NED ||
packet.coordinate_frame == MAV_FRAME_BODY_OFFSET_NED) {
copter.rotate_body_frame_to_NE(pos_vector.x, pos_vector.y);
}
// add body offset if necessary
if (packet.coordinate_frame == MAV_FRAME_LOCAL_OFFSET_NED ||
packet.coordinate_frame == MAV_FRAME_BODY_NED ||
packet.coordinate_frame == MAV_FRAME_BODY_OFFSET_NED) {
pos_vector += copter.inertial_nav.get_position();
} else {
// convert from alt-above-home to alt-above-ekf-origin
pos_vector.z = copter.pv_alt_above_origin(pos_vector.z);
}
}
// prepare velocity
Vector3f vel_vector;
if (!vel_ignore) {
// convert to cm
vel_vector = Vector3f(packet.vx * 100.0f, packet.vy * 100.0f, -packet.vz * 100.0f);
// rotate to body-frame if necessary
if (packet.coordinate_frame == MAV_FRAME_BODY_NED || packet.coordinate_frame == MAV_FRAME_BODY_OFFSET_NED) {
copter.rotate_body_frame_to_NE(vel_vector.x, vel_vector.y);
}
}
// send request
if (!pos_ignore && !vel_ignore && acc_ignore) {
Vector3f pos_ned = Vector3f(packet.x * 100.0f, packet.y * 100.0f, -packet.z * 100.0f);
pos_ned.z = copter.pv_alt_above_origin(pos_ned.z);
copter.guided_set_destination_posvel(pos_ned, Vector3f(packet.vx * 100.0f, packet.vy * 100.0f, -packet.vz * 100.0f));
copter.guided_set_destination_posvel(pos_vector, vel_vector);
} else if (pos_ignore && !vel_ignore && acc_ignore) {
copter.guided_set_velocity(Vector3f(packet.vx * 100.0f, packet.vy * 100.0f, -packet.vz * 100.0f));
copter.guided_set_velocity(vel_vector);
} else if (!pos_ignore && vel_ignore && acc_ignore) {
Vector3f pos_ned = Vector3f(packet.x * 100.0f, packet.y * 100.0f, -packet.z * 100.0f);
pos_ned.z = copter.pv_alt_above_origin(pos_ned.z);
copter.guided_set_destination(pos_ned);
copter.guided_set_destination(pos_vector);
} else {
result = MAV_RESULT_FAILED;
}
@ -1489,6 +1560,13 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
break;
}
// check for supported coordinate frames
if (packet.coordinate_frame != MAV_FRAME_GLOBAL_INT &&
packet.coordinate_frame != MAV_FRAME_GLOBAL_RELATIVE_ALT_INT &&
packet.coordinate_frame != MAV_FRAME_GLOBAL_TERRAIN_ALT_INT) {
break;
}
bool pos_ignore = packet.type_mask & MAVLINK_SET_POS_TYPE_MASK_POS_IGNORE;
bool vel_ignore = packet.type_mask & MAVLINK_SET_POS_TYPE_MASK_VEL_IGNORE;
bool acc_ignore = packet.type_mask & MAVLINK_SET_POS_TYPE_MASK_ACC_IGNORE;
@ -1508,17 +1586,14 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
loc.lng = packet.lon_int;
loc.alt = packet.alt*100;
switch (packet.coordinate_frame) {
case MAV_FRAME_GLOBAL_RELATIVE_ALT:
case MAV_FRAME_GLOBAL_RELATIVE_ALT_INT:
loc.flags.relative_alt = true;
loc.flags.terrain_alt = false;
break;
case MAV_FRAME_GLOBAL_TERRAIN_ALT:
case MAV_FRAME_GLOBAL_TERRAIN_ALT_INT:
loc.flags.relative_alt = true;
loc.flags.terrain_alt = true;
break;
case MAV_FRAME_GLOBAL:
case MAV_FRAME_GLOBAL_INT:
default:
loc.flags.relative_alt = false;
@ -1714,7 +1789,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
#endif // AC_RALLY == ENABLED
case MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST:
copter.gcs[chan-MAVLINK_COMM_0].send_autopilot_version();
copter.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION);
break;
case MAVLINK_MSG_ID_LED_CONTROL:
@ -1773,6 +1848,19 @@ void Copter::gcs_send_message(enum ap_message id)
}
}
/*
* send a mission item reached message and load the index before the send attempt in case it may get delayed
*/
void Copter::gcs_send_mission_item_reached_message(uint16_t mission_index)
{
for (uint8_t i=0; i<num_gcs; i++) {
if (gcs[i].initialised) {
gcs[i].mission_item_reached_index = mission_index;
gcs[i].send_message(MSG_MISSION_ITEM_REACHED);
}
}
}
/*
* send data streams in the given rate range on both links
*/
@ -1831,15 +1919,3 @@ void Copter::gcs_send_text_fmt(const prog_char_t *fmt, ...)
}
}
}
/*
* send mission_item_reached message to all GCSs
*/
void Copter::gcs_send_mission_item_reached(uint16_t seq)
{
for (uint8_t i=0; i<num_gcs; i++) {
if (gcs[i].initialised) {
gcs[i].send_mission_item_reached(seq);
}
}
}

View File

@ -664,7 +664,7 @@ struct PACKED log_Heli {
LOG_PACKET_HEADER;
uint64_t time_us;
int16_t desired_rotor_speed;
int16_t estimated_rotor_speed;
int16_t main_rotor_speed;
};
#if FRAME_CONFIG == HELI_FRAME
@ -675,7 +675,7 @@ void Copter::Log_Write_Heli()
LOG_PACKET_HEADER_INIT(LOG_HELI_MSG),
time_us : hal.scheduler->micros64(),
desired_rotor_speed : motors.get_desired_rotor_speed(),
estimated_rotor_speed : motors.get_estimated_rotor_speed(),
main_rotor_speed : motors.get_main_rotor_speed(),
};
DataFlash.WriteBlock(&pkt_heli, sizeof(pkt_heli));
}
@ -781,4 +781,51 @@ void Copter::log_init(void)
}
}
#endif // LOGGING_DISABLED
#else // LOGGING_ENABLED
#if CLI_ENABLED == ENABLED
bool Copter::print_log_menu(void) { return true; }
int8_t Copter::dump_log(uint8_t argc, const Menu::arg *argv) { return 0; }
int8_t Copter::erase_logs(uint8_t argc, const Menu::arg *argv) { return 0; }
int8_t Copter::select_logs(uint8_t argc, const Menu::arg *argv) { return 0; }
int8_t Copter::process_logs(uint8_t argc, const Menu::arg *argv) { return 0; }
void Copter::Log_Read(uint16_t log_num, uint16_t start_page, uint16_t end_page) {}
#endif // CLI_ENABLED == ENABLED
void Copter::do_erase_logs(void) {}
void Copter::Log_Write_AutoTune(uint8_t axis, uint8_t tune_step, float meas_target, \
float meas_min, float meas_max, float new_gain_rp, \
float new_gain_rd, float new_gain_sp, float new_ddt) {}
void Copter::Log_Write_AutoTuneDetails(float angle_cd, float rate_cds) {}
void Copter::Log_Write_Current() {}
void Copter::Log_Write_Nav_Tuning() {}
void Copter::Log_Write_Control_Tuning() {}
void Copter::Log_Write_Performance() {}
void Copter::Log_Write_Attitude(void) {}
void Copter::Log_Write_Rate() {}
void Copter::Log_Write_MotBatt() {}
void Copter::Log_Write_Startup() {}
void Copter::Log_Write_Event(uint8_t id) {}
void Copter::Log_Write_Data(uint8_t id, int32_t value) {}
void Copter::Log_Write_Data(uint8_t id, uint32_t value) {}
void Copter::Log_Write_Data(uint8_t id, int16_t value) {}
void Copter::Log_Write_Data(uint8_t id, uint16_t value) {}
void Copter::Log_Write_Data(uint8_t id, float value) {}
void Copter::Log_Write_Error(uint8_t sub_system, uint8_t error_code) {}
void Copter::Log_Write_Baro(void) {}
void Copter::Log_Write_Parameter_Tuning(uint8_t param, float tuning_val, int16_t control_in, int16_t tune_low, int16_t tune_high) {}
void Copter::Log_Write_Home_And_Origin() {}
void Copter::Log_Sensor_Health() {}
#if FRAME_CONFIG == HELI_FRAME
void Copter::Log_Write_Heli() {}
#endif
#if OPTFLOW == ENABLED
void Copter::Log_Write_Optflow() {}
#endif
void Copter::start_logging() {}
void Copter::log_init(void) {}
#endif // LOGGING_ENABLED

View File

@ -87,7 +87,7 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
// @DisplayName: Takeoff trigger deadzone
// @Description: Offset from mid stick at which takeoff is triggered
// @User: Standard
// @Range 0.0 500.0
// @Range: 0.0 500.0
// @Increment: 10
GSCALAR(takeoff_trigger_dz, "PILOT_TKOFF_DZ", THR_DZ_DEFAULT),
@ -229,7 +229,7 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
// @Param: RTL_LOIT_TIME
// @DisplayName: RTL loiter time
// @Description: Time (in milliseconds) to loiter above home before begining final descent
// @Description: Time (in milliseconds) to loiter above home before beginning final descent
// @Units: ms
// @Range: 0 60000
// @Increment: 1000
@ -447,11 +447,19 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
// @User: Standard
GSCALAR(arming_check, "ARMING_CHECK", ARMING_CHECK_ALL),
// @Param: DISARM_DELAY
// @DisplayName: Disarm delay
// @Description: Delay before automatic disarm in seconds. A value of zero disables auto disarm.
// @Units: Seconds
// @Range: 0 127
// @User: Advanced
GSCALAR(disarm_delay, "DISARM_DELAY", AUTO_DISARMING_DELAY),
// @Param: ANGLE_MAX
// @DisplayName: Angle Max
// @Description: Maximum lean angle in all flight modes
// @Units: Centi-degrees
// @Range 1000 8000
// @Range: 1000 8000
// @User: Advanced
ASCALAR(angle_max, "ANGLE_MAX", DEFAULT_ANGLE_MAX),
@ -516,24 +524,9 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
// @Group: HS4_
// @Path: ../libraries/RC_Channel/RC_Channel.cpp
GGROUP(heli_servo_4, "HS4_", RC_Channel),
// @Param: H_STAB_COL_MIN
// @DisplayName: Heli Stabilize Throttle Collective Minimum
// @Description: Helicopter's minimum collective position while pilot directly controls collective in stabilize mode
// @Range: 0 500
// @Units: Percent*10
// @Increment: 1
// @User: Standard
GSCALAR(heli_stab_col_min, "H_STAB_COL_MIN", HELI_STAB_COLLECTIVE_MIN_DEFAULT),
// @Param: H_STAB_COL_MAX
// @DisplayName: Stabilize Throttle Maximum
// @Description: Helicopter's maximum collective position while pilot directly controls collective in stabilize mode
// @Range: 500 1000
// @Units: Percent*10
// @Increment: 1
// @User: Standard
GSCALAR(heli_stab_col_max, "H_STAB_COL_MAX", HELI_STAB_COLLECTIVE_MAX_DEFAULT),
// @Group: H_RSC_
// @Path: ../libraries/RC_Channel/RC_Channel.cpp
GGROUP(heli_servo_rsc, "H_RSC_", RC_Channel),
#endif
// RC channel
@ -802,6 +795,13 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
// @Description: Throttle acceleration controller D gain. Compensates for short-term change in desired vertical acceleration vs actual acceleration
// @Range: 0.000 0.400
// @User: Standard
// @Param: ACCEL_Z_FILT_HZ
// @DisplayName: Throttle acceleration filter
// @Description: Filter applied to acceleration to reduce noise. Lower values reduce noise but add delay.
// @Range: 1.000 100.000
// @Units: Hz
// @User: Standard
GGROUP(pid_accel_z, "ACCEL_Z_", AC_PID),
// P controllers
@ -869,6 +869,12 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
// @Path: ../libraries/AP_LandingGear/AP_LandingGear.cpp
GOBJECT(landinggear, "LGR_", AP_LandingGear),
#if FRAME_CONFIG == HELI_FRAME
// @Group: IM_
// @Path: ../libraries/AC_InputManager_Heli.cpp
GOBJECT(input_manager, "IM_", AC_InputManager_Heli),
#endif
// @Group: COMPASS_
// @Path: ../libraries/AP_Compass/Compass.cpp
GOBJECT(compass, "COMPASS_", Compass),
@ -886,8 +892,6 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
GOBJECT(circle_nav, "CIRCLE_", AC_Circle),
#if FRAME_CONFIG == HELI_FRAME
// @Group: ATC_
// @Path: ../libraries/AC_AttitudeControl/AC_AttitudeControl_Heli.cpp
GOBJECT(attitude_control, "ATC_", AC_AttitudeControl_Heli),
#else
// @Group: ATC_
@ -929,7 +933,7 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
GOBJECT(camera_mount, "MNT", AP_Mount),
#endif
// @Group: BATT_
// @Group: BATT
// @Path: ../libraries/AP_BattMonitor/AP_BattMonitor.cpp
GOBJECT(battery, "BATT", AP_BattMonitor),
@ -974,8 +978,8 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
#if FRAME_CONFIG == HELI_FRAME
// @Group: H_
// @Path: ../libraries/AP_Motors/AP_MotorsHeli.cpp
GOBJECT(motors, "H_", AP_MotorsHeli),
// @Path: ../libraries/AP_Motors/AP_MotorsHeli_Single.cpp
GOBJECT(motors, "H_", AP_MotorsHeli_Single),
#elif FRAME_CONFIG == SINGLE_FRAME
// @Group: SS1_
@ -1012,7 +1016,7 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
#else
// @Group: MOT_
// @Path: ../libraries/AP_Motors/AP_Motors_Class.cpp
// @Path: ../libraries/AP_Motors/AP_MotorsMulticopter.cpp
GOBJECT(motors, "MOT_", AP_MotorsMulticopter),
#endif
@ -1046,7 +1050,11 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
GOBJECT(optflow, "FLOW", OpticalFlow),
#endif
// @Param: AUTOTUNE_AXIS_BITMASK
// @Group: RPM
// @Path: ../libraries/AP_RPM/AP_RPM.cpp
GOBJECT(rpm_sensor, "RPM", AP_RPM),
// @Param: AUTOTUNE_AXES
// @DisplayName: Autotune axis bitmask
// @Description: 1-byte bitmap of axes to autotune
// @Values: 7:All,1:Roll Only,2:Pitch Only,4:Yaw Only,3:Roll and Pitch,5:Roll and Yaw,6:Pitch and Yaw
@ -1054,13 +1062,20 @@ const AP_Param::Info Copter::var_info[] PROGMEM = {
// @User: Standard
GSCALAR(autotune_axis_bitmask, "AUTOTUNE_AXES", 7), // AUTOTUNE_AXIS_BITMASK_DEFAULT
// @Param: AUTOTUNE_AGGRESSIVENESS
// @DisplayName: autotune_aggressiveness
// @Description: autotune_aggressiveness. Defines the bounce back used to detect size of the D term.
// @Param: AUTOTUNE_AGGR
// @DisplayName: Autotune aggressiveness
// @Description: Autotune aggressiveness. Defines the bounce back used to detect size of the D term.
// @Range: 0.05 0.10
// @User: Standard
GSCALAR(autotune_aggressiveness, "AUTOTUNE_AGGR", 0.1f),
// @Param: AUTOTUNE_MIN_D
// @DisplayName: AutoTune minimum D
// @Description: Defines the minimum D gain
// @Range: 0.001 0.006
// @User: Standard
GSCALAR(autotune_min_d, "AUTOTUNE_MIN_D", 0.004f),
AP_VAREND
};

View File

@ -3,7 +3,7 @@
#ifndef PARAMETERS_H
#define PARAMETERS_H
#include <AP_Common.h>
#include <AP_Common/AP_Common.h>
// Global parameter class.
//
@ -82,6 +82,9 @@ public:
// Landing gear object
k_param_landinggear, // 18
// Input Management object
k_param_input_manager, // 19 FULL!
// Misc
//
k_param_log_bitmask_old = 20, // Deprecated
@ -159,13 +162,15 @@ public:
k_param_heli_pitch_ff, // remove
k_param_heli_roll_ff, // remove
k_param_heli_yaw_ff, // remove
k_param_heli_stab_col_min,
k_param_heli_stab_col_max, // 88
k_param_heli_stab_col_min, // remove
k_param_heli_stab_col_max, // remove
k_param_heli_servo_rsc, // 89 = full!
//
// 90: Motors
//
k_param_motors = 90,
k_param_disarm_delay,
//
// 100: Inertial Nav
@ -336,7 +341,9 @@ public:
k_param_autotune_aggressiveness,
k_param_pi_vel_xy,
k_param_fs_ekf_action,
k_param_rtl_climb_min, // 249
k_param_rtl_climb_min,
k_param_rpm_sensor,
k_param_autotune_min_d, // 251
// 254,255: reserved
};
@ -421,6 +428,7 @@ public:
AP_Int8 ch11_option;
AP_Int8 ch12_option;
AP_Int8 arming_check;
AP_Int8 disarm_delay;
AP_Int8 land_repositioning;
AP_Int8 fs_ekf_action;
@ -430,8 +438,7 @@ public:
#if FRAME_CONFIG == HELI_FRAME
// Heli
RC_Channel heli_servo_1, heli_servo_2, heli_servo_3, heli_servo_4; // servos for swash plate and tail
AP_Int16 heli_stab_col_min; // min collective while pilot directly controls collective in stabilize mode
AP_Int16 heli_stab_col_max; // min collective while pilot directly controls collective in stabilize mode
RC_Channel heli_servo_rsc; // servo for rotor speed control output
#endif
#if FRAME_CONFIG == SINGLE_FRAME
// Single
@ -497,6 +504,7 @@ public:
// Autotune
AP_Int8 autotune_axis_bitmask;
AP_Float autotune_aggressiveness;
AP_Float autotune_min_d;
// Note: keep initializers here in the same order as they are declared
// above.
@ -507,6 +515,7 @@ public:
heli_servo_2 (CH_2),
heli_servo_3 (CH_3),
heli_servo_4 (CH_4),
heli_servo_rsc (CH_8),
#endif
#if FRAME_CONFIG == SINGLE_FRAME
single_servo_1 (CH_1),

View File

@ -1,5 +1,100 @@
APM:Copter Release Notes:
------------------------------------------------------------------
Copter 3.3.4-pixracer 25-Feb-2016 / 3.3.4-rc3-pixracer 23-Feb-2016
Changes from 3.3.4-rc2-pixracer
1) fix parameter save issue caused by bus locking
------------------------------------------------------------------
Copter 3.3.4-rc2-pixracer 20-Feb-2016
Changes from 3.3.4-rc1-pixracers
1) fix SBUS input
------------------------------------------------------------------
Copter 3.3.4-rc1-pixracer 19-Feb-2016
Changes from 3.3.3
1) Ignores accel and gyro errors during first 2 seconds of startup
------------------------------------------------------------------
Copter 3.3.3-rc2 27-Jan-2016
Changes from 3.3.3-rc1
1) bug fix to Guided mode's velocity controller to run at 400hz
2) bug fix to MAVLink routing to allow camera messages to reach MAVLink enabled cameras and gimbals (including SToRM32)
------------------------------------------------------------------
Copter 3.3.3-rc1 4-Jan-2016
Changes from 3.3.2
1) Restrict mode changes in helicopter when rotor is not at speed
2) add ATC_ANGLE_BOOST param to allow disabling angle boost for all flight modes
3) add LightWare range finder support
------------------------------------------------------------------
Copter 3.3.2 01-Dec-2015 / 3.3.2-rc2 18-Nov-2015
Changes from 3.3.2-rc1
1) Bug fix for desired climb rate initialisation that could lead to drop when entering AltHold, Loiter, PosHold
2) Fix to hard landings when WPNAV_SPEED_DN set high in RTL, Auto (resolved by using non-feedforward alt hold)
3) Reduce Bad AHRS by filtering innovations
4) Allow arming without GPS if using Optical Flow
5) Smoother throttle output in Guided mode's velocity control (z-axis now 400hz)
------------------------------------------------------------------
Copter 3.3.2-rc1 4-Nov-2015
Changes from 3.3.1
1) Helicopter Improvements:
a) Fix Arming race condition
b) Fix servos to move after arming in Stabilize and Acro
c) Implement Pirouette Compensation
d) Add Rate I-Leak-Min functionality
e) Add new Stab Collective and Acro Expo Col functions
f) Add circular swashplate limits (Cyclic Ring)
g) Add new H_SV_Man functions
h) Add Hover Roll Trim function
i) Add Engine Run Enable Aux Channel function
j) Add servo boot test function
h) Add Disarm Delay parameter
------------------------------------------------------------------
Copter 3.3.1 26-Oct-2015 / 3.3.1-rc1 20-Oct-2015
Changes from 3.3
1) Bug fix to prevent potential crash if Follow-Me is used after an aborted takeoff
2) compiler upgraded to 4.9.3 (runs slightly faster than 4.7.2 which was used previously)
------------------------------------------------------------------
Copter 3.3 29-Sep-2015 / 3.3-rc12 22-Sep-2015
Changes from 3.3-rc11
1) EKF recovers from pre-arm "Compass variance" failure if compasses are consistent
------------------------------------------------------------------
Copter 3.3-rc11 10-Sep-2015
Changes from 3.3-rc10
1) PreArm "Need 3D Fix" message replaced with detailed reason from EKF
------------------------------------------------------------------
Copter 3.3-rc10 28-Aug-2015
Changes from 3.3-rc9
1) EKF improvements:
a) simpler optical flow takeoff check
2) Bug Fixes/Minor enhancements:
a) fix INS3_USE parameter eeprom location
b) fix SToRM32 serial protocol driver to work with recent versions
c) increase motor pwm->thrust conversion (aka MOT_THST_EXPO) to 0.65 (was 0.50)
d) Firmware version sent to GCS in AUTOPILOT_VERSION message
3) Safety:
a) pre-arm check of compass variance if arming in Loiter, PosHold, Guided
b) always check GPS before arming in Loiter (previously could be disabled if ARMING_CHECK=0)
c) sanity check locations received from GCS for follow-me, do-set-home, do-set-ROI
d) fix optical flow failsafe (was not always triggering LAND when optical flow failed)
e) failsafe RTL vs LAND decision based on hardcoded 5m from home check (previously used WPNAV_RADIUS parameter)
------------------------------------------------------------------
Copter 3.3-rc9 19-Aug-2015
Changes from 3.3-rc8
1) EKF improvements:
a) IMU weighting based on vibration levels (previously used accel clipping)
b) fix blended acceleration (used for altitude control) in cases where first IMU fails
c) ensure unhealthy barometer values are never consumed
2) TradHeli: remove acceleration feed forward
3) Safety:
a) check accel, gyro and baro are healthy when arming (previously was only checked pre-arm)
b) Guided mode velocity controller timeout (vehicle stops) after 3 seconds with no update from GCS
4) Minor enhancements:
a) fix for AUAV board's usb-connected detection
b) add Lidar-Lite-V2 support
c) MOT_THR_MIN_MAX param added to control prioritisation of throttle vs attitude during dynamic flight
d) RALLY_INCL_HOME param allows always including home when using rally points
e) DO_FLIGHT_TERMINATION message from GCS acts as kill switch
5) Bug Fixes:
a) fix to ensure motors start slowly on 2nd spin-up
b) fix RTL_CLIMB_MIN feature (vehicle climbed too high above home)
------------------------------------------------------------------
Copter 3.3-rc8 25-Jul-2015
Changes from 3.3-rc7
1) EKF improvements:
@ -16,6 +111,7 @@ Changes from 3.3-rc7
d) Circle rate adjustment with ch6 takes effect immediately
e) log home and origin
f) pre-arm check of battery voltage and fence
g) RTL_CLIMB_MIN parameter forces vehicle to climb at least this many cm when RTL is engaged (default is zero)
5) Bug fixes:
a) fix THR_MIN being incorrectly scaled as pwm value during low-throttle check
b) fence distance calculated from home (was incorrectly calculated from ekf-origin)
@ -26,7 +122,7 @@ Changes from 3.3-rc7
g) fix initialisation of mount's mode
h) start-up logging so parameters only logged once, mission always written
6) Linux:
a) bebop support
a) bebop support
------------------------------------------------------------------
Copter 3.3-rc7 28-Jun-2015
Changes from 3.3-rc6

View File

@ -0,0 +1,12 @@
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "Copter.h"
void Copter::init_capabilities(void)
{
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION);
}

View File

@ -168,7 +168,7 @@ bool Copter::verify_command_callback(const AP_Mission::Mission_Command& cmd)
// send message to GCS
if (cmd_complete) {
gcs_send_mission_item_reached(cmd.index);
gcs_send_mission_item_reached_message(cmd.index);
}
return cmd_complete;
@ -189,40 +189,31 @@ bool Copter::verify_command(const AP_Mission::Mission_Command& cmd)
//
case MAV_CMD_NAV_TAKEOFF:
return verify_takeoff();
break;
case MAV_CMD_NAV_WAYPOINT:
return verify_nav_wp(cmd);
break;
case MAV_CMD_NAV_LAND:
return verify_land();
break;
case MAV_CMD_NAV_LOITER_UNLIM:
return verify_loiter_unlimited();
break;
case MAV_CMD_NAV_LOITER_TURNS:
return verify_circle(cmd);
break;
case MAV_CMD_NAV_LOITER_TIME:
return verify_loiter_time();
break;
case MAV_CMD_NAV_RETURN_TO_LAUNCH:
return verify_RTL();
break;
case MAV_CMD_NAV_SPLINE_WAYPOINT:
return verify_spline_wp(cmd);
break;
#if NAV_GUIDED == ENABLED
case MAV_CMD_NAV_GUIDED_ENABLE:
return verify_nav_guided_enable(cmd);
break;
#endif
///
@ -230,29 +221,23 @@ bool Copter::verify_command(const AP_Mission::Mission_Command& cmd)
///
case MAV_CMD_CONDITION_DELAY:
return verify_wait_delay();
break;
case MAV_CMD_CONDITION_DISTANCE:
return verify_within_distance();
break;
case MAV_CMD_CONDITION_CHANGE_ALT:
return verify_change_alt();
break;
case MAV_CMD_CONDITION_YAW:
return verify_yaw();
break;
case MAV_CMD_DO_PARACHUTE:
// assume parachute was released successfully
return true;
break;
default:
// return true if we do not recognise the command so that we move on to the next command
// return true if we do not recognize the command so that we move on to the next command
return true;
break;
}
}

View File

@ -122,8 +122,6 @@
# define RATE_YAW_IMAX 4500
# define RATE_YAW_FF 0.02
# define RATE_YAW_FILT_HZ 20.0f
# define HELI_STAB_COLLECTIVE_MIN_DEFAULT 0
# define HELI_STAB_COLLECTIVE_MAX_DEFAULT 1000
# define THR_MIN_DEFAULT 0
# define AUTOTUNE_ENABLED DISABLED
#endif
@ -238,6 +236,11 @@
# define FS_GCS_TIMEOUT_MS 5000 // gcs failsafe triggers after 5 seconds with no GCS heartbeat
#endif
// possible values for FS_GCS parameter
#define FS_GCS_DISABLED 0
#define FS_GCS_ENABLED_ALWAYS_RTL 1
#define FS_GCS_ENABLED_CONTINUE_MISSION 2
// Radio failsafe while using RC_override
#ifndef FS_RADIO_RC_OVERRIDE_TIMEOUT_MS
# define FS_RADIO_RC_OVERRIDE_TIMEOUT_MS 1000 // RC Radio failsafe triggers after 1 second while using RC_override from ground station
@ -248,10 +251,9 @@
#define FS_RADIO_TIMEOUT_MS 500 // RC Radio Failsafe triggers after 500 miliseconds with No RC Input
#endif
// possible values for FS_GCS parameter
#define FS_GCS_DISABLED 0
#define FS_GCS_ENABLED_ALWAYS_RTL 1
#define FS_GCS_ENABLED_CONTINUE_MISSION 2
#ifndef FS_CLOSE_TO_HOME_CM
# define FS_CLOSE_TO_HOME_CM 200 // if vehicle within 2m of home, vehicle will LAND instead of RTL during some failsafes
#endif
// pre-arm baro vs inertial nav max alt disparity
#ifndef PREARM_MAX_ALT_DISPARITY_CM
@ -303,11 +305,6 @@
#endif
#endif
// arming check's maximum acceptable vector difference between internal and external compass after vectors are normalized to field length of 1.0
#ifndef COMPASS_ACCEPTABLE_VECTOR_DIFF
#define COMPASS_ACCEPTABLE_VECTOR_DIFF 0.75f // pre arm compass check will fail if internal vs external compass direction differ by more than 45 degrees
#endif
//////////////////////////////////////////////////////////////////////////////
// OPTICAL_FLOW
#ifndef OPTFLOW
@ -691,6 +688,10 @@
# define ALT_HOLD_ACCEL_MAX 250 // if you change this you must also update the duplicate declaration in AC_WPNav.h
#endif
#ifndef AUTO_DISARMING_DELAY
# define AUTO_DISARMING_DELAY 10
#endif
//////////////////////////////////////////////////////////////////////////////
// Dataflash logging control
//

View File

@ -23,6 +23,10 @@ void Copter::acro_run()
// if motors not running reset angle targets
if(!motors.armed() || ap.throttle_zero) {
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
// slow start if landed
if (ap.land_complete) {
motors.slow_start(true);
}
return;
}

View File

@ -9,12 +9,21 @@
// althold_init - initialise althold controller
bool Copter::althold_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
// initialize vertical speeds and leash lengths
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialise position and desired velocity
pos_control.set_alt_target(inertial_nav.get_altitude());
pos_control.set_desired_velocity_z(inertial_nav.get_velocity_z());
// stop takeoff if running
takeoff_stop();
@ -51,8 +60,10 @@ void Copter::althold_run()
#endif
// Alt Hold State Machine Determination
if(!ap.auto_armed || !motors.get_interlock()) {
if(!ap.auto_armed) {
althold_state = AltHold_Disarmed;
} else if (!motors.get_interlock()){
althold_state = AltHold_MotorStop;
} else if (takeoff_state.running || takeoff_triggered){
althold_state = AltHold_Takeoff;
} else if (ap.land_complete){
@ -77,6 +88,22 @@ void Copter::althold_run()
pos_control.relax_alt_hold_controllers(get_throttle_pre_takeoff(channel_throttle->control_in)-throttle_average);
break;
case AltHold_MotorStop:
#if FRAME_CONFIG == HELI_FRAME
// helicopters are capable of flying even with the motor stopped, therefore we will attempt to keep flying
// call attitude controller
attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(target_roll, target_pitch, target_yaw_rate, get_smoothing_gain());
// force descent rate and call position controller
pos_control.set_alt_target_from_climb_rate(-abs(g.land_speed), G_Dt, false);
pos_control.update_z_controller();
#else // Multicopter do not stabilize roll/pitch/yaw when motor are stopped
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
pos_control.relax_alt_hold_controllers(get_throttle_pre_takeoff(channel_throttle->control_in)-throttle_average);
#endif // HELI_FRAME
break;
case AltHold_Takeoff:
// initiate take-off
@ -95,7 +122,7 @@ void Copter::althold_run()
attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(target_roll, target_pitch, target_yaw_rate, get_smoothing_gain());
// call position controller
pos_control.set_alt_target_from_climb_rate(target_climb_rate, G_Dt, false);
pos_control.set_alt_target_from_climb_rate_ff(target_climb_rate, G_Dt, false);
pos_control.add_takeoff_climb_rate(takeoff_climb_rate, G_Dt);
pos_control.update_z_controller();
break;
@ -124,7 +151,7 @@ void Copter::althold_run()
}
// call position controller
pos_control.set_alt_target_from_climb_rate(target_climb_rate, G_Dt, false);
pos_control.set_alt_target_from_climb_rate_ff(target_climb_rate, G_Dt, false);
pos_control.update_z_controller();
break;
}

View File

@ -22,6 +22,14 @@
// auto_init - initialise auto controller
bool Copter::auto_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
if ((position_ok() && mission.num_commands() > 1) || ignore_checks) {
auto_mode = Auto_Loiter;

View File

@ -57,7 +57,6 @@
#define AUTOTUNE_PI_RATIO_FOR_TESTING 0.1f // I is set 10x smaller than P during testing
#define AUTOTUNE_PI_RATIO_FINAL 1.0f // I is set 1x P after testing
#define AUTOTUNE_YAW_PI_RATIO_FINAL 0.1f // I is set 1x P after testing
#define AUTOTUNE_RD_MIN 0.004f // minimum Rate D value
#define AUTOTUNE_RD_MAX 0.050f // maximum Rate D value
#define AUTOTUNE_RLPF_MIN 1.0f // minimum Rate Yaw filter value
#define AUTOTUNE_RLPF_MAX 5.0f // maximum Rate Yaw filter value
@ -165,6 +164,11 @@ static float tune_yaw_rp, tune_yaw_rLPF, tune_yaw_sp, tune_yaw_accel;
// autotune_init - should be called when autotune mode is selected
bool Copter::autotune_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// Autotune mode not available for helicopters
return false;
#endif
bool success = true;
switch (autotune_state.mode) {
@ -248,8 +252,9 @@ bool Copter::autotune_start(bool ignore_checks)
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialise position and desired velocity
pos_control.set_alt_target(inertial_nav.get_altitude());
pos_control.set_desired_velocity_z(inertial_nav.get_velocity_z());
return true;
}
@ -326,7 +331,7 @@ void Copter::autotune_run()
}
// call position controller
pos_control.set_alt_target_from_climb_rate(target_climb_rate, G_Dt, false);
pos_control.set_alt_target_from_climb_rate_ff(target_climb_rate, G_Dt, false);
pos_control.update_z_controller();
}
}
@ -552,10 +557,10 @@ void Copter::autotune_attitude_control()
case AUTOTUNE_TYPE_RD_UP:
switch (autotune_state.axis) {
case AUTOTUNE_AXIS_ROLL:
autotune_updating_d_up(tune_roll_rd, AUTOTUNE_RD_MIN, AUTOTUNE_RD_MAX, AUTOTUNE_RD_STEP, tune_roll_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
autotune_updating_d_up(tune_roll_rd, g.autotune_min_d, AUTOTUNE_RD_MAX, AUTOTUNE_RD_STEP, tune_roll_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
break;
case AUTOTUNE_AXIS_PITCH:
autotune_updating_d_up(tune_pitch_rd, AUTOTUNE_RD_MIN, AUTOTUNE_RD_MAX, AUTOTUNE_RD_STEP, tune_pitch_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
autotune_updating_d_up(tune_pitch_rd, g.autotune_min_d, AUTOTUNE_RD_MAX, AUTOTUNE_RD_STEP, tune_pitch_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
break;
case AUTOTUNE_AXIS_YAW:
autotune_updating_d_up(tune_yaw_rLPF, AUTOTUNE_RLPF_MIN, AUTOTUNE_RLPF_MAX, AUTOTUNE_RD_STEP, tune_yaw_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
@ -566,10 +571,10 @@ void Copter::autotune_attitude_control()
case AUTOTUNE_TYPE_RD_DOWN:
switch (autotune_state.axis) {
case AUTOTUNE_AXIS_ROLL:
autotune_updating_d_down(tune_roll_rd, AUTOTUNE_RD_MIN, AUTOTUNE_RD_STEP, tune_roll_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
autotune_updating_d_down(tune_roll_rd, g.autotune_min_d, AUTOTUNE_RD_STEP, tune_roll_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
break;
case AUTOTUNE_AXIS_PITCH:
autotune_updating_d_down(tune_pitch_rd, AUTOTUNE_RD_MIN, AUTOTUNE_RD_STEP, tune_pitch_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
autotune_updating_d_down(tune_pitch_rd, g.autotune_min_d, AUTOTUNE_RD_STEP, tune_pitch_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
break;
case AUTOTUNE_AXIS_YAW:
autotune_updating_d_down(tune_yaw_rLPF, AUTOTUNE_RLPF_MIN, AUTOTUNE_RD_STEP, tune_yaw_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
@ -580,10 +585,10 @@ void Copter::autotune_attitude_control()
case AUTOTUNE_TYPE_RP_UP:
switch (autotune_state.axis) {
case AUTOTUNE_AXIS_ROLL:
autotune_updating_p_up_d_down(tune_roll_rd, AUTOTUNE_RD_MIN, AUTOTUNE_RD_STEP, tune_roll_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
autotune_updating_p_up_d_down(tune_roll_rd, g.autotune_min_d, AUTOTUNE_RD_STEP, tune_roll_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
break;
case AUTOTUNE_AXIS_PITCH:
autotune_updating_p_up_d_down(tune_pitch_rd, AUTOTUNE_RD_MIN, AUTOTUNE_RD_STEP, tune_pitch_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
autotune_updating_p_up_d_down(tune_pitch_rd, g.autotune_min_d, AUTOTUNE_RD_STEP, tune_pitch_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
break;
case AUTOTUNE_AXIS_YAW:
autotune_updating_p_up_d_down(tune_yaw_rLPF, AUTOTUNE_RLPF_MIN, AUTOTUNE_RD_STEP, tune_yaw_rp, AUTOTUNE_RP_MIN, AUTOTUNE_RP_MAX, AUTOTUNE_RP_STEP, autotune_target_rate, autotune_test_min, autotune_test_max);
@ -635,11 +640,11 @@ void Copter::autotune_attitude_control()
autotune_state.tune_type = AutoTuneTuneType(autotune_state.tune_type + 1);
switch (autotune_state.axis) {
case AUTOTUNE_AXIS_ROLL:
tune_roll_rd = max(AUTOTUNE_RD_MIN, tune_roll_rd * AUTOTUNE_RD_BACKOFF);
tune_roll_rd = max(g.autotune_min_d, tune_roll_rd * AUTOTUNE_RD_BACKOFF);
tune_roll_rp = max(AUTOTUNE_RP_MIN, tune_roll_rp * AUTOTUNE_RD_BACKOFF);
break;
case AUTOTUNE_AXIS_PITCH:
tune_pitch_rd = max(AUTOTUNE_RD_MIN, tune_pitch_rd * AUTOTUNE_RD_BACKOFF);
tune_pitch_rd = max(g.autotune_min_d, tune_pitch_rd * AUTOTUNE_RD_BACKOFF);
tune_pitch_rp = max(AUTOTUNE_RP_MIN, tune_pitch_rp * AUTOTUNE_RD_BACKOFF);
break;
case AUTOTUNE_AXIS_YAW:

View File

@ -9,7 +9,15 @@
// brake_init - initialise brake controller
bool Copter::brake_init(bool ignore_checks)
{
if (position_ok() || optflow_position_ok() || ignore_checks) {
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
if (position_ok() || ignore_checks) {
// set desired acceleration to zero
wp_nav.clear_pilot_desired_acceleration();
@ -21,8 +29,9 @@ bool Copter::brake_init(bool ignore_checks)
pos_control.set_speed_z(BRAKE_MODE_SPEED_Z, BRAKE_MODE_SPEED_Z);
pos_control.set_accel_z(BRAKE_MODE_DECEL_RATE);
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialise position and desired velocity
pos_control.set_alt_target(inertial_nav.get_altitude());
pos_control.set_desired_velocity_z(inertial_nav.get_velocity_z());
return true;
}else{
@ -67,6 +76,6 @@ void Copter::brake_run()
// body-frame rate controller is run directly from 100hz loop
// update altitude target and call position controller
pos_control.set_alt_target_from_climb_rate(0.0f, G_Dt, false);
pos_control.set_alt_target_from_climb_rate_ff(0.0f, G_Dt, false);
pos_control.update_z_controller();
}

View File

@ -9,6 +9,14 @@
// circle_init - initialise circle controller flight mode
bool Copter::circle_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
if (position_ok() || ignore_checks) {
circle_pilot_yaw_override = false;

View File

@ -31,6 +31,14 @@
// drift_init - initialise drift controller
bool Copter::drift_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
if (position_ok() || ignore_checks) {
return true;
}else{

View File

@ -41,6 +41,12 @@ int8_t flip_pitch_dir; // pitch direction (-1 = pitch forward, 1 =
// flip_init - initialise flip controller
bool Copter::flip_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// Flip mode not available for helis as it is untested.
return false;
#endif
// only allow flip from ACRO, Stabilize, AltHold or Drift flight modes
if (control_mode != ACRO && control_mode != STABILIZE && control_mode != ALT_HOLD) {
return false;

View File

@ -15,6 +15,7 @@
static Vector3f posvel_pos_target_cm;
static Vector3f posvel_vel_target_cms;
static uint32_t posvel_update_time_ms;
static uint32_t vel_update_time_ms;
struct Guided_Limit {
uint32_t timeout_ms; // timeout (in seconds) from the time that guided is invoked
@ -28,6 +29,14 @@ struct Guided_Limit {
// guided_init - initialise guided controller
bool Copter::guided_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
if (position_ok() || ignore_checks) {
// initialise yaw
set_auto_yaw_mode(get_default_auto_yaw_mode(false));
@ -138,6 +147,8 @@ void Copter::guided_set_velocity(const Vector3f& velocity)
guided_vel_control_start();
}
vel_update_time_ms = millis();
// set position controller velocity target
pos_control.set_desired_velocity(velocity);
}
@ -160,20 +171,6 @@ void Copter::guided_set_destination_posvel(const Vector3f& destination, const Ve
// should be called at 100hz or more
void Copter::guided_run()
{
// if not auto armed or motors not enabled set throttle to zero and exit immediately
if(!ap.auto_armed || !motors.get_interlock()) {
// To-Do: reset waypoint controller?
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
// call attitude controller
attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(0, 0, 0, get_smoothing_gain());
attitude_control.set_throttle_out(0,false,g.throttle_filt);
#else // multicopters do not stabilize roll/pitch/yaw when disarmed
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
#endif
// To-Do: handle take-offs - these may not only be immediately after auto_armed becomes true
return;
}
// call the correct auto controller
switch (guided_mode) {
@ -203,20 +200,15 @@ void Copter::guided_run()
// called by guided_run at 100hz or more
void Copter::guided_takeoff_run()
{
// if not auto armed or motors interlock not enabled set throttle to zero and exit immediately
if(!ap.auto_armed || !motors.get_interlock()) {
// initialise wpnav targets
wp_nav.shift_wp_origin_to_current_pos();
// if not auto armed or motors not enabled set throttle to zero and exit immediately
if (!ap.auto_armed || !motors.get_interlock()) {
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
// call attitude controller
attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(0, 0, 0, get_smoothing_gain());
attitude_control.set_throttle_out(0,false,g.throttle_filt);
#else // multicopters do not stabilize roll/pitch/yaw when disarmed
// reset attitude control targets
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
#endif
// clear i term when we're taking off
set_throttle_takeoff();
return;
}
@ -241,6 +233,18 @@ void Copter::guided_takeoff_run()
// called from guided_run
void Copter::guided_pos_control_run()
{
// if not auto armed or motors not enabled set throttle to zero and exit immediately
if (!ap.auto_armed || !motors.get_interlock() || ap.land_complete) {
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
// call attitude controller
attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(0, 0, 0, get_smoothing_gain());
attitude_control.set_throttle_out(0,false,g.throttle_filt);
#else // multicopters do not stabilize roll/pitch/yaw when disarmed
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
#endif
return;
}
// process pilot's yaw input
float target_yaw_rate = 0;
if (!failsafe.radio) {
@ -271,6 +275,20 @@ void Copter::guided_pos_control_run()
// called from guided_run
void Copter::guided_vel_control_run()
{
// if not auto armed or motors not enabled set throttle to zero and exit immediately
if (!ap.auto_armed || !motors.get_interlock() || ap.land_complete) {
// initialise velocity controller
pos_control.init_vel_controller_xyz();
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
// call attitude controller
attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(0, 0, 0, get_smoothing_gain());
attitude_control.set_throttle_out(0,false,g.throttle_filt);
#else // multicopters do not stabilize roll/pitch/yaw when disarmed
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
#endif
return;
}
// process pilot's yaw input
float target_yaw_rate = 0;
if (!failsafe.radio) {
@ -281,20 +299,15 @@ void Copter::guided_vel_control_run()
}
}
// calculate dt
float dt = pos_control.time_since_last_xy_update();
// update at poscontrol update rate
if (dt >= pos_control.get_dt_xy()) {
// sanity check dt
if (dt >= 0.2f) {
dt = 0.0f;
}
// call velocity controller which includes z axis controller
pos_control.update_vel_controller_xyz(ekfNavVelGainScaler);
// set velocity to zero if no updates received for 3 seconds
uint32_t tnow = millis();
if (tnow - vel_update_time_ms > GUIDED_POSVEL_TIMEOUT_MS && !pos_control.get_desired_velocity().is_zero()) {
pos_control.set_desired_velocity(Vector3f(0,0,0));
}
// call velocity controller which includes z axis controller
pos_control.update_vel_controller_xyz(ekfNavVelGainScaler);
// call attitude controller
if (auto_yaw_mode == AUTO_YAW_HOLD) {
// roll & pitch from waypoint controller, yaw rate from pilot
@ -309,6 +322,21 @@ void Copter::guided_vel_control_run()
// called from guided_run
void Copter::guided_posvel_control_run()
{
// if not auto armed or motors not enabled set throttle to zero and exit immediately
if (!ap.auto_armed || !motors.get_interlock() || ap.land_complete) {
// set target position and velocity to current position and velocity
pos_control.set_pos_target(inertial_nav.get_position());
pos_control.set_desired_velocity(Vector3f(0,0,0));
#if FRAME_CONFIG == HELI_FRAME // Helicopters always stabilize roll/pitch/yaw
// call attitude controller
attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(0, 0, 0, get_smoothing_gain());
attitude_control.set_throttle_out(0,false,g.throttle_filt);
#else // multicopters do not stabilize roll/pitch/yaw when disarmed
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
#endif
return;
}
// process pilot's yaw input
float target_yaw_rate = 0;

View File

@ -9,7 +9,15 @@
// loiter_init - initialise loiter controller
bool Copter::loiter_init(bool ignore_checks)
{
if (position_ok() || optflow_position_ok() || ignore_checks) {
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
if (position_ok() || ignore_checks) {
// set target to current position
wp_nav.init_loiter_target();
@ -18,8 +26,9 @@ bool Copter::loiter_init(bool ignore_checks)
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialise position and desired velocity
pos_control.set_alt_target(inertial_nav.get_altitude());
pos_control.set_desired_velocity_z(inertial_nav.get_velocity_z());
return true;
}else{
@ -61,8 +70,10 @@ void Copter::loiter_run()
}
// Loiter State Machine Determination
if(!ap.auto_armed || !motors.get_interlock()) {
if(!ap.auto_armed) {
loiter_state = Loiter_Disarmed;
} else if (!motors.get_interlock()){
loiter_state = Loiter_MotorStop;
} else if (takeoff_state.running || (ap.land_complete && (channel_throttle->control_in > get_takeoff_trigger_throttle()))){
loiter_state = Loiter_Takeoff;
} else if (ap.land_complete){
@ -87,6 +98,27 @@ void Copter::loiter_run()
pos_control.relax_alt_hold_controllers(get_throttle_pre_takeoff(channel_throttle->control_in)-throttle_average);
break;
case Loiter_MotorStop:
#if FRAME_CONFIG == HELI_FRAME
// helicopters are capable of flying even with the motor stopped, therefore we will attempt to keep flying
// run loiter controller
wp_nav.update_loiter(ekfGndSpdLimit, ekfNavVelGainScaler);
// call attitude controller
attitude_control.angle_ef_roll_pitch_rate_ef_yaw(wp_nav.get_roll(), wp_nav.get_pitch(), target_yaw_rate);
// force descent rate and call position controller
pos_control.set_alt_target_from_climb_rate(-abs(g.land_speed), G_Dt, false);
pos_control.update_z_controller();
#else
wp_nav.init_loiter_target();
// multicopters do not stabilize roll/pitch/yaw when motors are stopped
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
pos_control.relax_alt_hold_controllers(get_throttle_pre_takeoff(channel_throttle->control_in)-throttle_average);
#endif // HELI_FRAME
break;
case Loiter_Takeoff:
if (!takeoff_state.running) {
@ -107,7 +139,7 @@ void Copter::loiter_run()
attitude_control.angle_ef_roll_pitch_rate_ef_yaw(wp_nav.get_roll(), wp_nav.get_pitch(), target_yaw_rate);
// update altitude target and call position controller
pos_control.set_alt_target_from_climb_rate(target_climb_rate, G_Dt, false);
pos_control.set_alt_target_from_climb_rate_ff(target_climb_rate, G_Dt, false);
pos_control.add_takeoff_climb_rate(takeoff_climb_rate, G_Dt);
pos_control.update_z_controller();
break;
@ -141,7 +173,7 @@ void Copter::loiter_run()
}
// update altitude target and call position controller
pos_control.set_alt_target_from_climb_rate(target_climb_rate, G_Dt, false);
pos_control.set_alt_target_from_climb_rate_ff(target_climb_rate, G_Dt, false);
pos_control.update_z_controller();
break;
}

View File

@ -77,6 +77,14 @@ static struct {
// poshold_init - initialise PosHold controller
bool Copter::poshold_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
// fail to initialise PosHold mode if no GPS lock
if (!position_ok() && !ignore_checks) {
return false;
@ -86,8 +94,9 @@ bool Copter::poshold_init(bool ignore_checks)
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialise position and desired velocity
pos_control.set_alt_target(inertial_nav.get_altitude());
pos_control.set_desired_velocity_z(inertial_nav.get_velocity_z());
// initialise lean angles to current attitude
poshold.pilot_roll = 0;
@ -510,7 +519,7 @@ void Copter::poshold_run()
target_climb_rate = get_surface_tracking_climb_rate(target_climb_rate, pos_control.get_alt_target(), G_Dt);
}
// update altitude target and call position controller
pos_control.set_alt_target_from_climb_rate(target_climb_rate, G_Dt, false);
pos_control.set_alt_target_from_climb_rate_ff(target_climb_rate, G_Dt, false);
pos_control.add_takeoff_climb_rate(takeoff_climb_rate, G_Dt);
pos_control.update_z_controller();
}

View File

@ -12,6 +12,14 @@
// rtl_init - initialise rtl controller
bool Copter::rtl_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
if (position_ok() || ignore_checks) {
rtl_climb_start();
return true;
@ -79,6 +87,7 @@ void Copter::rtl_climb_start()
{
rtl_state = RTL_InitialClimb;
rtl_state_complete = false;
rtl_alt = get_RTL_alt();
// initialise waypoint and spline controller
wp_nav.wp_and_spline_init();
@ -89,12 +98,12 @@ void Copter::rtl_climb_start()
#if AC_RALLY == ENABLED
// rally_point.alt will be the altitude of the nearest rally point or the RTL_ALT. uses absolute altitudes
Location rally_point = rally.calc_best_rally_or_home_location(current_loc, get_RTL_alt()+ahrs.get_home().alt);
Location rally_point = rally.calc_best_rally_or_home_location(current_loc, rtl_alt+ahrs.get_home().alt);
rally_point.alt -= ahrs.get_home().alt; // convert to altitude above home
rally_point.alt = max(rally_point.alt, current_loc.alt); // ensure we do not descend before reaching home
destination.z = pv_alt_above_origin(rally_point.alt);
#else
destination.z = pv_alt_above_origin(get_RTL_alt());
destination.z = pv_alt_above_origin(rtl_alt);
#endif
// set the destination
@ -114,13 +123,13 @@ void Copter::rtl_return_start()
// set target to above home/rally point
#if AC_RALLY == ENABLED
// rally_point will be the nearest rally point or home. uses absolute altitudes
Location rally_point = rally.calc_best_rally_or_home_location(current_loc, get_RTL_alt()+ahrs.get_home().alt);
Location rally_point = rally.calc_best_rally_or_home_location(current_loc, rtl_alt+ahrs.get_home().alt);
rally_point.alt -= ahrs.get_home().alt; // convert to altitude above home
rally_point.alt = max(rally_point.alt, current_loc.alt); // ensure we do not descend before reaching home
Vector3f destination = pv_location_to_vector(rally_point);
#else
Vector3f destination = pv_location_to_vector(ahrs.get_home());
destination.z = pv_alt_above_origin(get_RTL_alt());
destination.z = pv_alt_above_origin(rtl_alt));
#endif
wp_nav.set_wp_destination(destination);
@ -414,16 +423,16 @@ void Copter::rtl_land_run()
float Copter::get_RTL_alt()
{
// maximum of current altitude + climb_min and rtl altitude
float rtl_alt = max(current_loc.alt + max(0, g.rtl_climb_min), g.rtl_altitude);
rtl_alt = max(rtl_alt, RTL_ALT_MIN);
float ret = max(current_loc.alt + max(0, g.rtl_climb_min), g.rtl_altitude);
ret = max(ret, RTL_ALT_MIN);
#if AC_FENCE == ENABLED
// ensure not above fence altitude if alt fence is enabled
if ((fence.get_enabled_fences() & AC_FENCE_TYPE_ALT_MAX) != 0) {
rtl_alt = min(rtl_alt, fence.get_safe_alt()*100.0f);
ret = min(ret, fence.get_safe_alt()*100.0f);
}
#endif
return rtl_alt;
return ret;
}

View File

@ -9,12 +9,21 @@
// sport_init - initialise sport controller
bool Copter::sport_init(bool ignore_checks)
{
#if FRAME_CONFIG == HELI_FRAME
// do not allow helis to enter Alt Hold if the Rotor Runup is not complete and current control mode has manual throttle control,
// as this will force the helicopter to descend.
if (!ignore_checks && mode_has_manual_throttle(control_mode) && !motors.rotor_runup_complete()){
return false;
}
#endif
// initialize vertical speed and accelerationj
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialise position and desired velocity
pos_control.set_alt_target(inertial_nav.get_altitude());
pos_control.set_desired_velocity_z(inertial_nav.get_velocity_z());
return true;
}
@ -101,7 +110,7 @@ void Copter::sport_run()
}
// call position controller
pos_control.set_alt_target_from_climb_rate(target_climb_rate, G_Dt, false);
pos_control.set_alt_target_from_climb_rate_ff(target_climb_rate, G_Dt, false);
pos_control.add_takeoff_climb_rate(takeoff_climb_rate, G_Dt);
pos_control.update_z_controller();
}

View File

@ -28,6 +28,10 @@ void Copter::stabilize_run()
// if not armed or throttle at zero, set throttle to zero and exit immediately
if(!motors.armed() || ap.throttle_zero) {
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
// slow start if landed
if (ap.land_complete) {
motors.slow_start(true);
}
return;
}

View File

@ -3,7 +3,7 @@
#ifndef _DEFINES_H
#define _DEFINES_H
#include <AP_HAL_Boards.h>
#include <AP_HAL/AP_HAL_Boards.h>
// Just so that it's completely clear...
#define ENABLED 1
@ -199,6 +199,7 @@ enum RTLState {
// Alt_Hold states
enum AltHoldModeState {
AltHold_Disarmed,
AltHold_MotorStop,
AltHold_Takeoff,
AltHold_Flying,
AltHold_Landed
@ -207,6 +208,7 @@ enum AltHoldModeState {
// Loiter states
enum LoiterModeState {
Loiter_Disarmed,
Loiter_MotorStop,
Loiter_Takeoff,
Loiter_Flying,
Loiter_Landed

View File

@ -26,7 +26,7 @@ void Copter::failsafe_radio_on_event()
set_mode_land_with_pause();
// if far from home then RTL
}else if(home_distance > wp_nav.get_wp_radius()) {
} else if(home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
@ -47,7 +47,7 @@ void Copter::failsafe_radio_on_event()
// if failsafe_throttle is FS_THR_ENABLED_ALWAYS_RTL do RTL
} else if (g.failsafe_throttle == FS_THR_ENABLED_ALWAYS_RTL) {
if(home_distance > wp_nav.get_wp_radius()) {
if (home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
}else{
@ -75,7 +75,7 @@ void Copter::failsafe_radio_on_event()
set_mode_land_with_pause();
// if far from home then RTL
}else if(home_distance > wp_nav.get_wp_radius()) {
} else if(home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
}else{
@ -117,7 +117,7 @@ void Copter::failsafe_battery_event(void)
init_disarm_motors();
}else{
// set mode to RTL or LAND
if (g.failsafe_battery_enabled == FS_BATT_RTL && home_distance > wp_nav.get_wp_radius()) {
if (g.failsafe_battery_enabled == FS_BATT_RTL && home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
}else{
@ -131,7 +131,7 @@ void Copter::failsafe_battery_event(void)
init_disarm_motors();
// set mode to RTL or LAND
} else if (home_distance > wp_nav.get_wp_radius()) {
} else if (home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
} else {
@ -145,7 +145,7 @@ void Copter::failsafe_battery_event(void)
init_disarm_motors();
// set mode to RTL or LAND
} else if (g.failsafe_battery_enabled == FS_BATT_RTL && home_distance > wp_nav.get_wp_radius()) {
} else if (g.failsafe_battery_enabled == FS_BATT_RTL && home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
} else {
@ -212,7 +212,7 @@ void Copter::failsafe_gcs_check()
// if throttle is zero disarm motors
if (ap.throttle_zero || ap.land_complete) {
init_disarm_motors();
}else if(home_distance > wp_nav.get_wp_radius()) {
}else if(home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
}else{
@ -226,7 +226,7 @@ void Copter::failsafe_gcs_check()
init_disarm_motors();
// if g.failsafe_gcs is 1 do RTL, 2 means continue with the mission
} else if (g.failsafe_gcs == FS_GCS_ENABLED_ALWAYS_RTL) {
if (home_distance > wp_nav.get_wp_radius()) {
if (home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
}else{
@ -241,7 +241,7 @@ void Copter::failsafe_gcs_check()
// if landed disarm
if (ap.land_complete) {
init_disarm_motors();
} else if (home_distance > wp_nav.get_wp_radius()) {
} else if (home_distance > FS_CLOSE_TO_HOME_CM) {
// switch to RTL or if that fails, LAND
set_mode_RTL_or_land_with_pause();
}else{

View File

@ -243,6 +243,17 @@ void Copter::exit_mode(uint8_t old_control_mode, uint8_t new_control_mode)
attitude_control.use_flybar_passthrough(false, false);
}
// if we are changing from a mode that did not use manual throttle,
// stab col ramp value should be pre-loaded to the correct value to avoid a twitch
// heli_stab_col_ramp should really only be active switching between Stabilize and Acro modes
if (!mode_has_manual_throttle(old_control_mode)){
if (new_control_mode == STABILIZE){
input_manager.set_stab_col_ramp(1.0);
} else if (new_control_mode == ACRO){
input_manager.set_stab_col_ramp(0.0);
}
}
// reset RC Passthrough to motors
motors.reset_radio_passthrough();
#endif //HELI_FRAME

View File

@ -16,22 +16,25 @@ static int8_t heli_dynamic_flight_counter;
// heli_init - perform any special initialisation required for the tradheli
void Copter::heli_init()
{
// Nothing in here for now. To-Do: Eliminate this function completely?
}
// helicopters are always using motor interlock
set_using_interlock(true);
// get_pilot_desired_collective - converts pilot input (from 0 ~ 1000) to a value that can be fed into the channel_throttle->servo_out function
int16_t Copter::get_pilot_desired_collective(int16_t control_in)
{
// return immediately if reduce collective range for manual flight has not been configured
if (g.heli_stab_col_min == 0 && g.heli_stab_col_max == 1000) {
return control_in;
/*
automatically set H_RSC_MIN and H_RSC_MAX from RC8_MIN and
RC8_MAX so that when users upgrade from tradheli version 3.2 to
3.3 they get the same throttle range as in previous versions of
the code
*/
if (!g.heli_servo_rsc.radio_min.load()) {
g.heli_servo_rsc.radio_min.set_and_save(g.rc_8.radio_min.get());
}
if (!g.heli_servo_rsc.radio_max.load()) {
g.heli_servo_rsc.radio_max.set_and_save(g.rc_8.radio_max.get());
}
// scale pilot input to reduced collective range
float scalar = ((float)(g.heli_stab_col_max - g.heli_stab_col_min))/1000.0f;
int16_t collective_out = g.heli_stab_col_min + control_in * scalar;
collective_out = constrain_int16(collective_out, 0, 1000);
return collective_out;
// pre-load stab col values as mode is initialized as Stabilize, but stabilize_init() function is not run on start-up.
input_manager.set_use_stab_col(true);
input_manager.set_stab_col_ramp(1.0);
}
// heli_check_dynamic_flight - updates the dynamic_flight flag based on our horizontal velocity
@ -82,10 +85,22 @@ void Copter::check_dynamic_flight(void)
// should be run between the rate controller and the servo updates.
void Copter::update_heli_control_dynamics(void)
{
static int16_t hover_roll_trim_scalar_slew = 0;
// Use Leaky_I if we are not moving fast
attitude_control.use_leaky_i(!heli_flags.dynamic_flight);
// To-Do: Update dynamic phase angle of swashplate
if (ap.land_complete || (motors.get_desired_rotor_speed() == 0)){
// if we are landed or there is no rotor power demanded, decrement slew scalar
hover_roll_trim_scalar_slew--;
} else {
// if we are not landed and motor power is demanded, increment slew scalar
hover_roll_trim_scalar_slew++;
}
hover_roll_trim_scalar_slew = constrain_int16(hover_roll_trim_scalar_slew, 0, MAIN_LOOP_RATE);
// set hover roll trim scalar, will ramp from 0 to 1 over 1 second after we think helicopter has taken off
attitude_control.set_hover_roll_trim_scalar((float)(hover_roll_trim_scalar_slew/MAIN_LOOP_RATE));
}
// heli_update_landing_swash - sets swash plate flag so higher minimum is used when landed or landing
@ -140,27 +155,39 @@ void Copter::heli_update_rotor_speed_targets()
rsc_control_deglitched = rotor_speed_deglitch_filter.apply(g.rc_8.control_in);
if (motors.armed()) {
switch (rsc_control_mode) {
case AP_MOTORS_HELI_RSC_MODE_NONE:
// even though pilot passes rotors speed directly to rotor ESC via receiver, motor lib needs to know if
// rotor is spinning in case we are using direct drive tailrotor which must be spun up at same time
case AP_MOTORS_HELI_RSC_MODE_CH8_PASSTHROUGH:
// pass through pilot desired rotor speed
switch (rsc_control_mode) {
case AP_MOTORS_HELI_RSC_MODE_CH8_PASSTHROUGH:
// pass through pilot desired rotor speed if control input is higher than 10, creating a deadband at the bottom
if (rsc_control_deglitched > 10) {
motors.set_interlock(true);
motors.set_desired_rotor_speed(rsc_control_deglitched);
break;
case AP_MOTORS_HELI_RSC_MODE_SETPOINT:
// pass setpoint through as desired rotor speed
if (rsc_control_deglitched > 0) {
motors.set_desired_rotor_speed(motors.get_rsc_setpoint());
}else{
motors.set_desired_rotor_speed(0);
}
break;
}
} else {
// if disarmed, force desired_rotor_speed to Zero
motors.set_desired_rotor_speed(0);
} else {
motors.set_interlock(false);
motors.set_desired_rotor_speed(0);
}
break;
case AP_MOTORS_HELI_RSC_MODE_SETPOINT:
// pass setpoint through as desired rotor speed
if (rsc_control_deglitched > 0) {
motors.set_interlock(true);
motors.set_desired_rotor_speed(motors.get_rsc_setpoint());
}else{
motors.set_interlock(false);
motors.set_desired_rotor_speed(0);
}
break;
case AP_MOTORS_HELI_RSC_MODE_THROTTLE_CURVE:
// pass setpoint through as desired rotor speed, this is almost pointless as the Setpoint serves no function in this mode
// other than being used to create a crude estimate of rotor speed
if (rsc_control_deglitched > 0) {
motors.set_interlock(true);
motors.set_desired_rotor_speed(motors.get_rsc_setpoint());
}else{
motors.set_interlock(false);
motors.set_desired_rotor_speed(0);
}
break;
}
// when rotor_runup_complete changes to true, log event

View File

@ -11,7 +11,10 @@
bool Copter::heli_acro_init(bool ignore_checks)
{
// if heli is equipped with a flybar, then tell the attitude controller to pass through controls directly to servos
attitude_control.use_flybar_passthrough(motors.has_flybar(), motors.tail_type() == AP_MOTORS_HELI_TAILTYPE_SERVO_EXTGYRO);
attitude_control.use_flybar_passthrough(motors.has_flybar(), motors.supports_yaw_passthrough());
// set stab collective false to use full collective pitch range
input_manager.set_use_stab_col(false);
// always successfully enter acro
return true;
@ -22,6 +25,7 @@ bool Copter::heli_acro_init(bool ignore_checks)
void Copter::heli_acro_run()
{
float target_roll, target_pitch, target_yaw;
int16_t pilot_throttle_scaled;
// Tradheli should not reset roll, pitch, yaw targets when motors are not runup, because
// we may be in autorotation flight. These should be reset only when transitioning from disarmed
@ -35,7 +39,6 @@ void Copter::heli_acro_run()
}
if(motors.armed() && heli_flags.init_targets_on_arming) {
attitude_control.relax_bf_rate_controller();
attitude_control.set_yaw_target_to_current_heading();
if (motors.rotor_speed_above_critical()) {
heli_flags.init_targets_on_arming=false;
@ -57,8 +60,11 @@ void Copter::heli_acro_run()
attitude_control.passthrough_bf_roll_pitch_rate_yaw(channel_roll->control_in, channel_pitch->control_in, target_yaw);
}
// get pilot's desired throttle
pilot_throttle_scaled = input_manager.get_pilot_desired_collective(channel_throttle->control_in);
// output pilot's throttle without angle boost
attitude_control.set_throttle_out(channel_throttle->control_in, false, g.throttle_filt);
attitude_control.set_throttle_out(pilot_throttle_scaled, false, g.throttle_filt);
}
// get_pilot_desired_yaw_rate - transform pilot's yaw input into a desired yaw angle rate

View File

@ -13,6 +13,10 @@ bool Copter::heli_stabilize_init(bool ignore_checks)
// set target altitude to zero for reporting
// To-Do: make pos controller aware when it's active/inactive so it can always report the altitude error?
pos_control.set_alt_target(0);
// set stab collective true to use stabilize scaled collective pitch range
input_manager.set_use_stab_col(true);
return true;
}
@ -36,7 +40,6 @@ void Copter::heli_stabilize_run()
}
if(motors.armed() && heli_flags.init_targets_on_arming) {
attitude_control.relax_bf_rate_controller();
attitude_control.set_yaw_target_to_current_heading();
if (motors.rotor_speed_above_critical()) {
heli_flags.init_targets_on_arming=false;
@ -57,7 +60,7 @@ void Copter::heli_stabilize_run()
target_yaw_rate = get_pilot_desired_yaw_rate(channel_yaw->control_in);
// get pilot's desired throttle
pilot_throttle_scaled = get_pilot_desired_collective(channel_throttle->control_in);
pilot_throttle_scaled = input_manager.get_pilot_desired_collective(channel_throttle->control_in);
// call attitude controller
attitude_control.angle_ef_roll_pitch_rate_ef_yaw_smooth(target_roll, target_pitch, target_yaw_rate, get_smoothing_gain());

View File

@ -63,3 +63,5 @@ LIBRARIES += AP_EPM
LIBRARIES += AP_Parachute
LIBRARIES += AP_LandingGear
LIBRARIES += AP_Terrain
LIBRARIES += AP_RPM
LIBRARIES += AC_InputManager

View File

@ -5,8 +5,6 @@
#define ARM_DELAY 20 // called at 10hz so 2 seconds
#define DISARM_DELAY 20 // called at 10hz so 2 seconds
#define AUTO_TRIM_DELAY 100 // called at 10hz so 10 seconds
#define AUTO_DISARMING_DELAY_LONG 15 // called at 1hz so 15 seconds
#define AUTO_DISARMING_DELAY_SHORT 5 // called at 1hz so 5 seconds
#define LOST_VEHICLE_DELAY 10 // called at 10hz so 1 second
static uint8_t auto_disarming_counter;
@ -75,33 +73,43 @@ void Copter::arm_motors_check()
// called at 1hz
void Copter::auto_disarm_check()
{
uint8_t disarm_delay = constrain_int16(g.disarm_delay, 0, 127);
uint8_t disarm_delay;
// exit immediately if we are already disarmed or throttle output is not zero,
if (!motors.armed() || !ap.throttle_zero) {
// exit immediately if we are already disarmed, or if auto
// disarming is disabled
if (!motors.armed() || disarm_delay == 0) {
auto_disarming_counter = 0;
return;
}
// allow auto disarm in manual flight modes or Loiter/AltHold if we're landed
// always allow auto disarm if using interlock switch or motors are Emergency Stopped
if (mode_has_manual_throttle(control_mode) || ap.land_complete || (ap.using_interlock && !motors.get_interlock()) || ap.motor_emergency_stop) {
if ((ap.using_interlock && !motors.get_interlock()) || ap.motor_emergency_stop) {
auto_disarming_counter++;
// use a shorter delay if using throttle interlock switch or Emergency Stop, because it is less
// obvious the copter is armed as the motors will not be spinning
if (ap.using_interlock || ap.motor_emergency_stop){
disarm_delay = AUTO_DISARMING_DELAY_SHORT;
disarm_delay /= 2;
} else {
bool sprung_throttle_stick = (g.throttle_behavior & THR_BEHAVE_FEEDBACK_FROM_MID_STICK) != 0;
bool thr_low;
if (mode_has_manual_throttle(control_mode) || !sprung_throttle_stick) {
thr_low = ap.throttle_zero;
} else {
disarm_delay = AUTO_DISARMING_DELAY_LONG;
float deadband_top = g.rc_3.get_control_mid() + g.throttle_deadzone;
thr_low = g.rc_3.control_in <= deadband_top;
}
if(auto_disarming_counter >= disarm_delay) {
init_disarm_motors();
if (thr_low && ap.land_complete) {
// increment counter
auto_disarming_counter++;
} else {
// reset counter
auto_disarming_counter = 0;
}
}else{
}
// disarm once counter expires
if (auto_disarming_counter >= disarm_delay) {
init_disarm_motors();
auto_disarming_counter = 0;
}
}
@ -176,27 +184,6 @@ bool Copter::init_arm_motors(bool arming_from_gcs)
did_ground_start = true;
}
// check if we are using motor interlock control on an aux switch
set_using_interlock(check_if_auxsw_mode_used(AUXSW_MOTOR_INTERLOCK));
// if we are using motor interlock switch and it's enabled, fail to arm
if (ap.using_interlock && motors.get_interlock()){
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Motor Interlock Enabled"));
AP_Notify::flags.armed = false;
return false;
}
// if we are not using Emergency Stop switch option, force Estop false to ensure motors
// can run normally
if (!check_if_auxsw_mode_used(AUXSW_MOTOR_ESTOP)){
set_motor_emergency_stop(false);
// if we are using motor Estop switch, it must not be in Estop position
} else if (check_if_auxsw_mode_used(AUXSW_MOTOR_ESTOP) && ap.motor_emergency_stop){
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Motor Emergency Stopped"));
AP_Notify::flags.armed = false;
return false;
}
// enable gps velocity based centrefugal force compensation
ahrs.set_correct_centrifugal(true);
hal.util->set_soft_armed(true);
@ -252,27 +239,6 @@ bool Copter::pre_arm_checks(bool display_failure)
return false;
}
// check if motor interlock aux switch is in use
// if it is, switch needs to be in disabled position to arm
// otherwise exit immediately. This check to be repeated,
// as state can change at any time.
set_using_interlock(check_if_auxsw_mode_used(AUXSW_MOTOR_INTERLOCK));
if (ap.using_interlock && motors.get_interlock()){
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: Motor Interlock Enabled"));
}
return false;
}
// if we are using Motor Emergency Stop aux switch, check it is not enabled
// and warn if it is
if (check_if_auxsw_mode_used(AUXSW_MOTOR_ESTOP) && ap.motor_emergency_stop){
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: Motor Emergency Stopped"));
}
return false;
}
// exit immediately if we've already successfully performed the pre-arm check
if (ap.pre_arm_check) {
// run gps checks because results may change and affect LED colour
@ -356,25 +322,13 @@ bool Copter::pre_arm_checks(bool display_failure)
return false;
}
#if COMPASS_MAX_INSTANCES > 1
// check all compasses point in roughly same direction
if (compass.get_count() > 1) {
Vector3f prime_mag_vec = compass.get_field();
prime_mag_vec.normalize();
for(uint8_t i=0; i<compass.get_count(); i++) {
// get next compass
Vector3f mag_vec = compass.get_field(i);
mag_vec.normalize();
Vector3f vec_diff = mag_vec - prime_mag_vec;
if (compass.use_for_yaw(i) && vec_diff.length() > COMPASS_ACCEPTABLE_VECTOR_DIFF) {
if (!compass.consistent()) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: inconsistent compasses"));
}
return false;
}
}
}
#endif
}
@ -618,12 +572,6 @@ bool Copter::pre_arm_gps_checks(bool display_failure)
return false;
}
// return true immediately if gps check is disabled
if (!(g.arming_check == ARMING_CHECK_ALL || g.arming_check & ARMING_CHECK_GPS)) {
AP_Notify::flags.pre_arm_gps_check = true;
return true;
}
// check if flight mode requires GPS
bool gps_required = mode_requires_GPS(control_mode);
@ -643,12 +591,29 @@ bool Copter::pre_arm_gps_checks(bool display_failure)
// ensure GPS is ok
if (!position_ok()) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: Need 3D Fix"));
const char *reason = ahrs.prearm_failure_reason();
if (reason) {
GCS_MAVLINK::send_statustext_all(SEVERITY_HIGH, PSTR("PreArm: %s"), reason);
} else {
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: Need 3D Fix"));
}
}
AP_Notify::flags.pre_arm_gps_check = false;
return false;
}
// check EKF compass variance is below failsafe threshold
float vel_variance, pos_variance, hgt_variance, tas_variance;
Vector3f mag_variance;
Vector2f offset;
ahrs.get_NavEKF().getVariances(vel_variance, pos_variance, hgt_variance, mag_variance, tas_variance, offset);
if (mag_variance.length() >= g.fs_ekf_thresh) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: EKF compass variance"));
}
return false;
}
// check home and EKF origin are not too far
if (far_from_EKF_origin(ahrs.get_home())) {
if (display_failure) {
@ -658,6 +623,12 @@ bool Copter::pre_arm_gps_checks(bool display_failure)
return false;
}
// return true immediately if gps check is disabled
if (!(g.arming_check == ARMING_CHECK_ALL || g.arming_check & ARMING_CHECK_GPS)) {
AP_Notify::flags.pre_arm_gps_check = true;
return true;
}
// warn about hdop separately - to prevent user confusion with no gps lock
if (gps.get_hdop() > g.gps_hdop_good) {
if (display_failure) {
@ -682,6 +653,22 @@ bool Copter::arm_checks(bool display_failure, bool arming_from_gcs)
start_logging();
#endif
// check accels and gyro are healthy
if ((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_INS)) {
if(!ins.get_accel_health_all()) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Accelerometers not healthy"));
}
return false;
}
if(!ins.get_gyro_health_all()) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Gyros not healthy"));
}
return false;
}
}
// always check if inertial nav has started and is ready
if(!ahrs.healthy()) {
if (display_failure) {
@ -698,29 +685,59 @@ bool Copter::arm_checks(bool display_failure, bool arming_from_gcs)
return false;
}
// always check if rotor is spinning on heli
// always check gps
if (!pre_arm_gps_checks(display_failure)) {
return false;
}
#if FRAME_CONFIG == HELI_FRAME
// heli specific arming check
if ((rsc_control_deglitched > 0) || !motors.allow_arming()){
// heli specific arming check
// check if rotor is spinning on heli because this could disrupt gyro calibration
if (!motors.allow_arming()){
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Rotor Control Engaged"));
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Rotor is Spinning"));
}
return false;
}
#endif // HELI_FRAME
#endif
// if we are using motor interlock switch and it's enabled, fail to arm
if (ap.using_interlock && motors.get_interlock()){
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Motor Interlock Enabled"));
AP_Notify::flags.armed = false;
return false;
}
// if we are not using Emergency Stop switch option, force Estop false to ensure motors
// can run normally
if (!check_if_auxsw_mode_used(AUXSW_MOTOR_ESTOP)){
set_motor_emergency_stop(false);
// if we are using motor Estop switch, it must not be in Estop position
} else if (check_if_auxsw_mode_used(AUXSW_MOTOR_ESTOP) && ap.motor_emergency_stop){
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Motor Emergency Stopped"));
return false;
}
// succeed if arming checks are disabled
if (g.arming_check == ARMING_CHECK_NONE) {
return true;
}
// Check baro & inav alt are within 1m if EKF is operating in an absolute position mode.
// Do not check if intending to operate in a ground relative height mode as EKF will output a ground relative height
// that may differ from the baro height due to baro drift.
nav_filter_status filt_status = inertial_nav.get_filter_status();
bool using_baro_ref = (!filt_status.flags.pred_horiz_pos_rel && filt_status.flags.pred_horiz_pos_abs);
if (((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_BARO)) && using_baro_ref) {
if (fabsf(inertial_nav.get_altitude() - baro_alt) > PREARM_MAX_ALT_DISPARITY_CM) {
// baro checks
if ((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_BARO)) {
// baro health check
if (!barometer.all_healthy()) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Barometer not healthy"));
}
return false;
}
// Check baro & inav alt are within 1m if EKF is operating in an absolute position mode.
// Do not check if intending to operate in a ground relative height mode as EKF will output a ground relative height
// that may differ from the baro height due to baro drift.
nav_filter_status filt_status = inertial_nav.get_filter_status();
bool using_baro_ref = (!filt_status.flags.pred_horiz_pos_rel && filt_status.flags.pred_horiz_pos_abs);
if (using_baro_ref && (fabsf(inertial_nav.get_altitude() - baro_alt) > PREARM_MAX_ALT_DISPARITY_CM)) {
if (display_failure) {
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Altitude disparity"));
}
@ -728,11 +745,6 @@ bool Copter::arm_checks(bool display_failure, bool arming_from_gcs)
}
}
// check gps
if (!pre_arm_gps_checks(display_failure)) {
return false;
}
#if AC_FENCE == ENABLED
// check vehicle is within fence
if(!fence.pre_arm_check()) {

View File

@ -69,6 +69,19 @@ int16_t Copter::read_sonar(void)
#endif
}
/*
update RPM sensors
*/
void Copter::rpm_update(void)
{
rpm_sensor.update();
if (rpm_sensor.healthy(0) || rpm_sensor.healthy(1)) {
if (should_log(MASK_LOG_RCIN)) {
DataFlash.Log_Write_RPM(rpm_sensor);
}
}
}
// initialise compass
void Copter::init_compass()
{

View File

@ -165,6 +165,11 @@ void Copter::init_ardupilot()
log_init();
#endif
#if FRAME_CONFIG == HELI_FRAME
// trad heli specific initialisation
heli_init();
#endif
init_rc_in(); // sets up rc channels from radio
init_rc_out(); // sets up motors and output to escs
@ -240,6 +245,9 @@ void Copter::init_ardupilot()
init_sonar();
#endif
// initialise AP_RPM library
rpm_sensor.init();
// initialise mission library
mission.init();
@ -248,11 +256,6 @@ void Copter::init_ardupilot()
reset_control_switch();
init_aux_switches();
#if FRAME_CONFIG == HELI_FRAME
// trad heli specific initialisation
heli_init();
#endif
startup_ground(true);
// we don't want writes to the serial port to cause us to pause
@ -266,6 +269,9 @@ void Copter::init_ardupilot()
ins.set_raw_logging(should_log(MASK_LOG_IMU_RAW));
ins.set_dataflash(&DataFlash);
// init vehicle capabilties
init_capabilities();
cliSerial->print_P(PSTR("\nReady to FLY "));
// flag that initialisation has completed
@ -311,7 +317,7 @@ bool Copter::position_ok()
}
// check ekf position estimate
return ekf_position_ok();
return (ekf_position_ok() || optflow_position_ok());
}
// ekf_position_ok - returns true if the ekf claims it's horizontal absolute position estimate is ok and home position is set
@ -347,7 +353,13 @@ bool Copter::optflow_position_ok()
// get filter status from EKF
nav_filter_status filt_status = inertial_nav.get_filter_status();
return (filt_status.flags.horiz_pos_rel || filt_status.flags.pred_horiz_pos_rel);
// if disarmed we accept a predicted horizontal relative position
if (!motors.armed()) {
return (filt_status.flags.pred_horiz_pos_rel);
} else {
return (filt_status.flags.horiz_pos_rel && !filt_status.flags.const_pos_mode);
}
#endif
}

View File

@ -137,10 +137,12 @@ void Plane::ahrs_update()
hal.util->set_soft_armed(arming.is_armed() &&
hal.util->safety_switch_state() != AP_HAL::Util::SAFETY_DISARMED);
#if HIL_SUPPORT
if (g.hil_mode == 1) {
// update hil before AHRS update
gcs_update();
}
#endif
ahrs.update();
@ -150,7 +152,9 @@ void Plane::ahrs_update()
if (should_log(MASK_LOG_IMU)) {
Log_Write_IMU();
#if HAL_CPU_CLASS >= HAL_CPU_CLASS_75
DataFlash.Log_Write_IMUDT(ins);
#endif
}
// calculate a scaled roll limit based on current pitch
@ -253,8 +257,10 @@ void Plane::update_logging2(void)
if (should_log(MASK_LOG_RC))
Log_Write_RC();
#if HAL_CPU_CLASS >= HAL_CPU_CLASS_75
if (should_log(MASK_LOG_IMU))
DataFlash.Log_Write_Vibration(ins);
#endif
}
@ -315,7 +321,9 @@ void Plane::one_second_loop()
Log_Write_Status();
}
#if HAL_CPU_CLASS >= HAL_CPU_CLASS_75
ins.set_raw_logging(should_log(MASK_LOG_IMU_RAW));
#endif
}
void Plane::log_perf_info()
@ -325,8 +333,10 @@ void Plane::log_perf_info()
(unsigned long)G_Dt_max,
(unsigned long)G_Dt_min);
}
#if HAL_CPU_CLASS >= HAL_CPU_CLASS_75
if (should_log(MASK_LOG_PM))
Log_Write_Performance();
#endif
G_Dt_max = 0;
G_Dt_min = 0;
resetPerfData();
@ -542,6 +552,7 @@ void Plane::update_flight_mode(void)
case TRAINING: {
training_manual_roll = false;
training_manual_pitch = false;
update_load_factor();
// if the roll is past the set roll limit, then
// we set target roll to the limit

View File

@ -995,6 +995,7 @@ void Plane::set_servos(void)
obc.check_crash_plane();
#endif
#if HIL_SUPPORT
if (g.hil_mode == 1) {
// get the servos to the GCS immediately for HIL
if (comm_get_txspace(MAVLINK_COMM_0) >=
@ -1005,6 +1006,7 @@ void Plane::set_servos(void)
return;
}
}
#endif
// send values to the PWM timers for output
// ----------------------------------------
@ -1080,6 +1082,7 @@ void Plane::update_load_factor(void)
// our airspeed is below the minimum airspeed. Limit roll to
// 25 degrees
nav_roll_cd = constrain_int32(nav_roll_cd, -2500, 2500);
roll_limit_cd = constrain_int32(roll_limit_cd, -2500, 2500);
} else if (max_load_factor < aerodynamic_load_factor) {
// the demanded nav_roll would take us past the aerodymamic
// load limit. Limit our roll to a bank angle that will keep
@ -1092,5 +1095,6 @@ void Plane::update_load_factor(void)
roll_limit = 2500;
}
nav_roll_cd = constrain_int32(nav_roll_cd, -roll_limit, roll_limit);
roll_limit_cd = constrain_int32(roll_limit_cd, -roll_limit, roll_limit);
}
}

View File

@ -5,8 +5,6 @@
// default sensors are present and healthy: gyro, accelerometer, barometer, rate_control, attitude_stabilization, yaw_position, altitude control, x/y position control, motor_control
#define MAVLINK_SENSOR_PRESENT_DEFAULT (MAV_SYS_STATUS_SENSOR_3D_GYRO | MAV_SYS_STATUS_SENSOR_3D_ACCEL | MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE | MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL | MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION | MAV_SYS_STATUS_SENSOR_YAW_POSITION | MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL | MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL | MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS | MAV_SYS_STATUS_AHRS)
#define HAVE_PAYLOAD_SPACE(chan, id) (comm_get_txspace(chan) >= MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_MSG_ID_ ## id ## _LEN)
void Plane::send_heartbeat(mavlink_channel_t chan)
{
uint8_t base_mode = MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
@ -69,9 +67,11 @@ void Plane::send_heartbeat(mavlink_channel_t chan)
base_mode |= MAV_MODE_FLAG_MANUAL_INPUT_ENABLED;
}
#if HIL_SUPPORT
if (g.hil_mode == 1) {
base_mode |= MAV_MODE_FLAG_HIL_ENABLED;
}
#endif
// we are armed if we are not initialising
if (control_mode != INITIALISING && hal.util->get_soft_armed()) {
@ -366,6 +366,7 @@ void Plane::send_servo_out(mavlink_channel_t chan)
void Plane::send_radio_out(mavlink_channel_t chan)
{
#if HIL_SUPPORT
if (g.hil_mode==1 && !g.hil_servos) {
mavlink_msg_servo_output_raw_send(
chan,
@ -381,6 +382,7 @@ void Plane::send_radio_out(mavlink_channel_t chan)
RC_Channel::rc_channel(7)->radio_out);
return;
}
#endif
mavlink_msg_servo_output_raw_send(
chan,
micros(),
@ -416,14 +418,16 @@ void Plane::send_vfr_hud(mavlink_channel_t chan)
/*
keep last HIL_STATE message to allow sending SIM_STATE
*/
#if HIL_SUPPORT
static mavlink_hil_state_t last_hil_state;
#endif
// report simulator state
void Plane::send_simstate(mavlink_channel_t chan)
{
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
sitl.simstate_send(chan);
#else
#elif HIL_SUPPORT
if (g.hil_mode == 1) {
mavlink_msg_simstate_send(chan,
last_hil_state.roll,
@ -564,15 +568,10 @@ bool Plane::telemetry_delayed(mavlink_channel_t chan)
return true;
}
// check if a message will fit in the payload space available
#define CHECK_PAYLOAD_SIZE(id) if (txspace < MAVLINK_NUM_NON_PAYLOAD_BYTES+MAVLINK_MSG_ID_ ## id ## _LEN) return false
#define CHECK_PAYLOAD_SIZE2(id) if (!HAVE_PAYLOAD_SPACE(chan, id)) return false
// try to send a message, return false if it won't fit in the serial tx buffer
bool GCS_MAVLINK::try_send_message(enum ap_message id)
{
uint16_t txspace = comm_get_txspace(chan);
if (plane.telemetry_delayed(chan)) {
return false;
}
@ -637,10 +636,12 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
break;
case MSG_SERVO_OUT:
#if HIL_SUPPORT
if (plane.g.hil_mode == 1) {
CHECK_PAYLOAD_SIZE(RC_CHANNELS_SCALED);
plane.send_servo_out(chan);
}
#endif
break;
case MSG_RADIO_IN:
@ -790,6 +791,15 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
CHECK_PAYLOAD_SIZE(VIBRATION);
send_vibration(plane.ins);
break;
case MSG_RPM:
// unused
break;
case MSG_MISSION_ITEM_REACHED:
CHECK_PAYLOAD_SIZE(MISSION_ITEM_REACHED);
mavlink_msg_mission_item_reached_send(chan, mission_item_reached_index);
break;
}
return true;
}
@ -937,6 +947,7 @@ GCS_MAVLINK::data_stream_send(void)
if (plane.gcs_out_of_time) return;
if (plane.in_mavlink_delay) {
#if HIL_SUPPORT
if (plane.g.hil_mode == 1) {
// in HIL we need to keep sending servo values to ensure
// the simulator doesn't pause, otherwise our sensor
@ -948,6 +959,7 @@ GCS_MAVLINK::data_stream_send(void)
send_message(MSG_RADIO_OUT);
}
}
#endif
// don't send any other stream types while in the delay callback
return;
}
@ -1330,7 +1342,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: {
if (is_equal(packet.param1,1.0f)) {
plane.gcs[chan-MAVLINK_COMM_0].send_autopilot_version();
plane.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION);
result = MAV_RESULT_ACCEPTED;
}
break;
@ -1606,6 +1618,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
case MAVLINK_MSG_ID_HIL_STATE:
{
#if HIL_SUPPORT
if (plane.g.hil_mode != 1) {
break;
}
@ -1656,6 +1669,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
wrap_PI(fabsf(packet.yaw - plane.ahrs.yaw)) > ToRad(plane.g.hil_err_limit))) {
plane.ahrs.reset_attitude(packet.roll, packet.pitch, packet.yaw);
}
#endif
break;
}
@ -1729,7 +1743,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
break;
case MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST:
plane.gcs[chan-MAVLINK_COMM_0].send_autopilot_version();
plane.gcs[chan-MAVLINK_COMM_0].send_autopilot_version(FIRMWARE_VERSION);
break;
} // end switch
@ -1781,6 +1795,19 @@ void Plane::gcs_send_message(enum ap_message id)
}
}
/*
* send a mission item reached message and load the index before the send attempt in case it may get delayed
*/
void Plane::gcs_send_mission_item_reached_message(uint16_t mission_index)
{
for (uint8_t i=0; i<num_gcs; i++) {
if (gcs[i].initialised) {
gcs[i].mission_item_reached_index = mission_index;
gcs[i].send_message(MSG_MISSION_ITEM_REACHED);
}
}
}
/*
* send data streams in the given rate range on both links
*/
@ -1868,4 +1895,3 @@ void Plane::gcs_retry_deferred(void)
{
gcs_send_message(MSG_RETRY_DEFERRED);
}

View File

@ -539,10 +539,42 @@ void Plane::log_init(void)
#else // LOGGING_ENABLED
int8_t Plane::process_logs(uint8_t argc, const Menu::arg *argv)
{
return 0;
}
#if CLI_ENABLED == ENABLED
bool Plane::print_log_menu(void) { return true; }
int8_t Plane::dump_log(uint8_t argc, const Menu::arg *argv) { return 0; }
int8_t Plane::erase_logs(uint8_t argc, const Menu::arg *argv) { return 0; }
int8_t Plane::select_logs(uint8_t argc, const Menu::arg *argv) { return 0; }
int8_t Plane::process_logs(uint8_t argc, const Menu::arg *argv) { return 0; }
#endif // CLI_ENABLED == ENABLED
void Plane::do_erase_logs(void) {}
void Plane::Log_Write_Attitude(void) {}
void Plane::Log_Write_Performance() {}
void Plane::Log_Write_Startup(uint8_t type) {}
void Plane::Log_Write_Control_Tuning() {}
void Plane::Log_Write_TECS_Tuning(void) {}
void Plane::Log_Write_Nav_Tuning() {}
void Plane::Log_Write_Status() {}
void Plane::Log_Write_Sonar() {}
#if OPTFLOW == ENABLED
void Plane::Log_Write_Optflow() {}
#endif
void Plane::Log_Write_Current() {}
void Plane::Log_Arm_Disarm() {}
void Plane::Log_Write_GPS(uint8_t instance) {}
void Plane::Log_Write_IMU() {}
void Plane::Log_Write_RC(void) {}
void Plane::Log_Write_Baro(void) {}
void Plane::Log_Write_Airspeed(void) {}
void Plane::Log_Write_Home_And_Origin() {}
#if CLI_ENABLED == ENABLED
void Plane::Log_Read(uint16_t log_num, int16_t start_page, int16_t end_page) {}
#endif // CLI_ENABLED
void Plane::start_logging() {}
void Plane::log_init(void) {}
#endif // LOGGING_ENABLED

View File

@ -55,7 +55,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: AUTOTUNE_LEVEL
// @DisplayName: Autotune level
// @Description: Level of agressiveness for autotune. When autotune is run a lower AUTOTUNE_LEVEL will result in a 'softer' tune, with less agressive gains. For most users a level of 6 is recommended.
// @Description: Level of aggressiveness for autotune. When autotune is run a lower AUTOTUNE_LEVEL will result in a 'softer' tune, with less agressive gains. For most users a level of 6 is recommended.
// @Range: 1 10
// @Increment: 1
// @User: Standard
@ -171,7 +171,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: TKOFF_TDRAG_ELEV
// @DisplayName: Takeoff tail dragger elevator
// @Description: This parameter sets the amount of elevator to apply during the initial stage of a takeoff. It is used to hold the tail wheel of a taildragger on the ground during the initial takeoff stage to give maximum steering. This option should be conbined with the TKOFF_TDRAG_SPD1 option and the GROUND_STEER_ALT option along with tuning of the ground steering controller. A value of zero means to bypass the initial "tail hold" stage of takeoff. Set to zero for hand and catapult launch. For tail-draggers you should normally set this to 100, meaning full up elevator during the initial stage of takeoff. For most tricycle undercarriage aircraft a value of zero will work well, but for some tricycle aircraft a small negative value (say around -20 to -30) will apply down elevator which will hold the nose wheel firmly on the ground during initial acceleration. Only use a negative value if you find that the nosewheel doesn't grip well during takeoff. Too much down elevator on a tricycle undercarriage may cause instability in steering as the plane pivots around the nosewheel. Add down elevator 10 percent at a time.
// @Description: This parameter sets the amount of elevator to apply during the initial stage of a takeoff. It is used to hold the tail wheel of a taildragger on the ground during the initial takeoff stage to give maximum steering. This option should be combined with the TKOFF_TDRAG_SPD1 option and the GROUND_STEER_ALT option along with tuning of the ground steering controller. A value of zero means to bypass the initial "tail hold" stage of takeoff. Set to zero for hand and catapult launch. For tail-draggers you should normally set this to 100, meaning full up elevator during the initial stage of takeoff. For most tricycle undercarriage aircraft a value of zero will work well, but for some tricycle aircraft a small negative value (say around -20 to -30) will apply down elevator which will hold the nose wheel firmly on the ground during initial acceleration. Only use a negative value if you find that the nosewheel doesn't grip well during takeoff. Too much down elevator on a tricycle undercarriage may cause instability in steering as the plane pivots around the nosewheel. Add down elevator 10 percent at a time.
// @Units: Percent
// @Range: -100 100
// @Increment: 1
@ -262,14 +262,14 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: NAV_CONTROLLER
// @DisplayName: Navigation controller selection
// @Description: Which navigation controller to enable. Currently the only navigation controller available is L1. From time to time other experimental conrtrollers will be added which are selected using this parameter.
// @Description: Which navigation controller to enable. Currently the only navigation controller available is L1. From time to time other experimental controllers will be added which are selected using this parameter.
// @Values: 0:Default,1:L1Controller
// @User: Standard
GSCALAR(nav_controller, "NAV_CONTROLLER", AP_Navigation::CONTROLLER_L1),
// @Param: ALT_MIX
// @DisplayName: GPS to Baro Mix
// @Description: The percent of mixing between GPS altitude and baro altitude. 0 = 100% gps, 1 = 100% baro. It is highly recommend that you not change this from the default of 1, as GPS altitude is notoriously unreliable. The only time I would recommend changing this is if you have a high altitude enabled GPS, and you are dropping a plane from a high altitude baloon many kilometers off the ground.
// @Description: The percent of mixing between GPS altitude and baro altitude. 0 = 100% gps, 1 = 100% baro. It is highly recommend that you not change this from the default of 1, as GPS altitude is notoriously unreliable. The only time I would recommend changing this is if you have a high altitude enabled GPS, and you are dropping a plane from a high altitude balloon many kilometers off the ground.
// @Units: Percent
// @Range: 0 1
// @Increment: 0.1
@ -278,7 +278,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: ALT_CTRL_ALG
// @DisplayName: Altitude control algorithm
// @Description: This sets what algorithm will be used for altitude control. The default is zero, which selects the most appropriate algorithm for your airframe. Currently the default is to use TECS (total energy control system). From time to time we will add other experimental altitude control algorithms which will be seleted using this parameter.
// @Description: This sets what algorithm will be used for altitude control. The default is zero, which selects the most appropriate algorithm for your airframe. Currently the default is to use TECS (total energy control system). From time to time we will add other experimental altitude control algorithms which will be selected using this parameter.
// @Values: 0:Automatic
// @User: Advanced
GSCALAR(alt_control_algorithm, "ALT_CTRL_ALG", ALT_CONTROL_DEFAULT),
@ -294,7 +294,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: WP_RADIUS
// @DisplayName: Waypoint Radius
// @Description: Defines the maximum distance from a waypoint that when crossed indicates the waypoint may be complete. To avoid the aircraft looping around the waypoint in case it misses by more than the WP_RADIUS an additional check is made to see if the aircraft has crossed a "finish line" passing through the waypoint and perpendicular to the flight path from the previous waypoint. If that finish line is crossed then the waypoint is considered complete. Note that the navigation controller may decide to turn later than WP_RADIUS before a waypoint, based on how sharp the turn is and the speed of the aircraft. It is safe to set WP_RADIUS much larger than the usual turn radius of your aircaft and the navigation controller will work out when to turn. If you set WP_RADIUS too small then you will tend to overshoot the turns.
// @Description: Defines the maximum distance from a waypoint that when crossed indicates the waypoint may be complete. To avoid the aircraft looping around the waypoint in case it misses by more than the WP_RADIUS an additional check is made to see if the aircraft has crossed a "finish line" passing through the waypoint and perpendicular to the flight path from the previous waypoint. If that finish line is crossed then the waypoint is considered complete. Note that the navigation controller may decide to turn later than WP_RADIUS before a waypoint, based on how sharp the turn is and the speed of the aircraft. It is safe to set WP_RADIUS much larger than the usual turn radius of your aircraft and the navigation controller will work out when to turn. If you set WP_RADIUS too small then you will tend to overshoot the turns.
// @Units: Meters
// @Range: 1 32767
// @Increment: 1
@ -368,7 +368,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: FENCE_AUTOENABLE
// @DisplayName: Fence automatic enable
// @Description: When set to 1, gefence automatically enables after an auto takeoff and automatically disables at the beginning of an auto landing. When on the ground before takeoff the fence is disabled. When set to 2, the fence autoenables after an auto takeoff, but only disables the fence floor during landing. It is highly recommended to not use this option for line of sight flying and use a fence enable channel instead.
// @Description: When set to 1, geofence automatically enables after an auto takeoff and automatically disables at the beginning of an auto landing. When on the ground before takeoff the fence is disabled. When set to 2, the fence autoenables after an auto takeoff, but only disables the fence floor during landing. It is highly recommended to not use this option for line of sight flying and use a fence enable channel instead.
// @Values: 0:NoAutoEnable,1:AutoEnable,2:AutoEnableDisableFloorOnly
// @User: Standard
GSCALAR(fence_autoenable, "FENCE_AUTOENABLE", 0),
@ -485,7 +485,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: THR_SUPP_MAN
// @DisplayName: Throttle suppress manual passthru
// @Description: When throttle is supressed in auto mode it is normally forced to zero. If you enable this option, then while suppressed it will be manual throttle. This is useful on petrol engines to hold the idle throttle manually while waiting for takeoff
// @Description: When throttle is suppressed in auto mode it is normally forced to zero. If you enable this option, then while suppressed it will be manual throttle. This is useful on petrol engines to hold the idle throttle manually while waiting for takeoff
// @Values: 0:Disabled,1:Enabled
// @User: Advanced
GSCALAR(throttle_suppress_manual,"THR_SUPP_MAN", 0),
@ -507,7 +507,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: THR_FS_VALUE
// @DisplayName: Throttle Failsafe Value
// @Description: The PWM level on channel 3 below which throttle sailsafe triggers
// @Description: The PWM level on channel 3 below which throttle failsafe triggers
// @Range: 925 1100
// @Increment: 1
// @User: Standard
@ -539,7 +539,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: FS_SHORT_TIMEOUT
// @DisplayName: Short failsafe timeout
// @Description: The time in seconds that a failsafe condition has to persist before a short failsafe event will occor. This defaults to 1.5 seconds
// @Description: The time in seconds that a failsafe condition has to persist before a short failsafe event will occur. This defaults to 1.5 seconds
// @Units: seconds
// @Range: 1 100
// @Increment: 0.5
@ -555,7 +555,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: FS_LONG_TIMEOUT
// @DisplayName: Long failsafe timeout
// @Description: The time in seconds that a failsafe condition has to persist before a long failsafe event will occor. This defaults to 5 seconds
// @Description: The time in seconds that a failsafe condition has to persist before a long failsafe event will occur. This defaults to 5 seconds.
// @Units: seconds
// @Range: 1 300
// @Increment: 0.5
@ -564,7 +564,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: FS_BATT_VOLTAGE
// @DisplayName: Failsafe battery voltage
// @Description: Battery voltage to trigger failsafe. Set to 0 to disable battery voltage failsafe. If the battery voltage drops below this voltage continuously for 10 seconds then the plane will switch to RTL mode
// @Description: Battery voltage to trigger failsafe. Set to 0 to disable battery voltage failsafe. If the battery voltage drops below this voltage continuously for 10 seconds then the plane will switch to RTL mode.
// @Units: Volts
// @Increment: 0.1
// @User: Standard
@ -572,7 +572,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: FS_BATT_MAH
// @DisplayName: Failsafe battery milliAmpHours
// @Description: Battery capacity remaining to trigger failsafe. Set to 0 to disable battery remaining failsafe. If the battery remaining drops below this level then the plane will switch to RTL mode immediately
// @Description: Battery capacity remaining to trigger failsafe. Set to 0 to disable battery remaining failsafe. If the battery remaining drops below this level then the plane will switch to RTL mode immediately.
// @Units: mAh
// @Increment: 50
// @User: Standard
@ -580,7 +580,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: FS_GCS_ENABL
// @DisplayName: GCS failsafe enable
// @Description: Enable ground control station telemetry failsafe. Failsafe will trigger after FS_LONG_TIMEOUT seconds of no MAVLink heartbeat messages. There are two possible enabled settings. Seeing FS_GCS_ENABL to 1 means that GCS failsafe will be triggered when the aircraft has not received a MAVLink HEARTBEAT message. Setting FS_GCS_ENABL to 2 means that GCS failsafe will be triggerded on either a loss of HEARTBEAT messages, or a RADIO_STATUS message from a MAVLink enabled 3DR radio indicating that the ground station is not receiving status updates from the aircraft, which is indicated by the RADIO_STATUS.remrssi field being zero (this may happen if you have a one way link due to asymmetric noise on the ground station and aircraft radios).Setting FS_GCS_ENABL to 3 means that GCS failsafe will be triggerded by Hearbeat(like option one), but only in AUTO mode. WARNING: Enabling this option opens up the possibility of your plane going into failsafe mode and running the motor on the ground it it loses contact with your ground station. If this option is enabled on an electric plane then you should enable ARMING_REQUIRED.
// @Description: Enable ground control station telemetry failsafe. Failsafe will trigger after FS_LONG_TIMEOUT seconds of no MAVLink heartbeat messages. There are two possible enabled settings. Seeing FS_GCS_ENABL to 1 means that GCS failsafe will be triggered when the aircraft has not received a MAVLink HEARTBEAT message. Setting FS_GCS_ENABL to 2 means that GCS failsafe will be triggered on either a loss of HEARTBEAT messages, or a RADIO_STATUS message from a MAVLink enabled 3DR radio indicating that the ground station is not receiving status updates from the aircraft, which is indicated by the RADIO_STATUS.remrssi field being zero (this may happen if you have a one way link due to asymmetric noise on the ground station and aircraft radios).Setting FS_GCS_ENABL to 3 means that GCS failsafe will be triggered by Heartbeat(like option one), but only in AUTO mode. WARNING: Enabling this option opens up the possibility of your plane going into failsafe mode and running the motor on the ground it it loses contact with your ground station. If this option is enabled on an electric plane then you should enable ARMING_REQUIRED.
// @Values: 0:Disabled,1:Heartbeat,2:HeartbeatAndREMRSSI,3:HeartbeatAndAUTO
// @User: Standard
GSCALAR(gcs_heartbeat_fs_enabled, "FS_GCS_ENABL", GCS_FAILSAFE_OFF),
@ -719,7 +719,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: ELEVON_MIXING
// @DisplayName: Elevon mixing
// @Description: This enables an older form of elevon mixing which is now deprecated. Please see the ELEVON_OUTPUT option for setting up elevons. The ELEVON_MIXING option should be set to 0 for elevon planes except for backwards compatibilty with older setups.
// @Description: This enables an older form of elevon mixing which is now deprecated. Please see the ELEVON_OUTPUT option for setting up elevons. The ELEVON_MIXING option should be set to 0 for elevon planes except for backwards compatibility with older setups.
// @Values: 0:Disabled,1:Enabled
// @User: User
GSCALAR(mix_mode, "ELEVON_MIXING", ELEVON_MIXING),
@ -830,7 +830,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: ALT_HOLD_RTL
// @DisplayName: RTL altitude
// @Description: Return to launch target altitude. This is the altitude the plane will aim for and loiter at when returning home. If this is negative (usually -1) then the plane will use the current altitude at the time of entering RTL. Note that when transiting to a Rally Point the alitude of the Rally Point is used instead of ALT_HOLD_RTL.
// @Description: Return to launch target altitude. This is the altitude the plane will aim for and loiter at when returning home. If this is negative (usually -1) then the plane will use the current altitude at the time of entering RTL. Note that when transiting to a Rally Point the altitude of the Rally Point is used instead of ALT_HOLD_RTL.
// @Units: centimeters
// @User: User
GSCALAR(RTL_altitude_cm, "ALT_HOLD_RTL", ALT_HOLD_HOME_CM),
@ -857,7 +857,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: FLAPERON_OUTPUT
// @DisplayName: Flaperon output
// @Description: Enable flaperon output in software. If enabled then the APM will provide software flaperon mixing on the FLAPERON1 and FLAPERON2 output channels specified using the FUNCTION on two auxillary channels. There are 4 different mixing modes available, which refer to the 4 ways the flap and aileron outputs can be mapped to the two flaperon servos. Note that you must not use flaperon output mixing with hardware pass-through of RC values, such as with channel 8 manual control on an APM1. So if you use an APM1 then set FLTMODE_CH to something other than 8 before you enable FLAPERON_OUTPUT. Please also see the MIXING_GAIN parameter for the output gain of the mixer. FLAPERON_OUTPUT cannot be combined with ELEVON_OUTPUT or ELEVON_MIXING.
// @Description: Enable flaperon output in software. If enabled then the APM will provide software flaperon mixing on the FLAPERON1 and FLAPERON2 output channels specified using the FUNCTION on two auxiliary channels. There are 4 different mixing modes available, which refer to the 4 ways the flap and aileron outputs can be mapped to the two flaperon servos. Note that you must not use flaperon output mixing with hardware pass-through of RC values, such as with channel 8 manual control on an APM1. So if you use an APM1 then set FLTMODE_CH to something other than 8 before you enable FLAPERON_OUTPUT. Please also see the MIXING_GAIN parameter for the output gain of the mixer. FLAPERON_OUTPUT cannot be combined with ELEVON_OUTPUT or ELEVON_MIXING.
// @Values: 0:Disabled,1:UpUp,2:UpDown,3:DownUp,4:DownDown
// @User: User
GSCALAR(flaperon_output, "FLAPERON_OUTPUT", 0),
@ -907,7 +907,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
// @Param: OVERRIDE_CHAN
// @DisplayName: PX4IO override channel
// @Description: If set to a non-zero value then this is an RC input channel number to use for testing manual control in case the main FMU microcontroller on a PX4 or Pixhawk fails. When this RC input channel goes above 1750 the FMU will stop sending servo controls to the PX4IO board, which will trigger the PX4IO board to start using its failsafe override behaviour, which should give you manual control of the aircraft. That allows you to test for correct manual behaviour without actually crashing the FMU. This parameter is normally only set to a non-zero value for ground testing purposes. When the override channel is used it also forces the PX4 safety switch into an armed state. This allows it to be used as a way to re-arm a plane after an in-flight reboot. Use in that way is considered a developer option, for people testing unstable developer code. Note that you may set OVERRIDE_CHAN to the same channel as FLTMODE_CH to get PX4IO based override when in flight mode 6. Note that when override is triggered the 6 auxillary output channels on Pixhawk will no longer be updated, so all the flight controls you need must be assigned to the first 8 channels.
// @Description: If set to a non-zero value then this is an RC input channel number to use for testing manual control in case the main FMU microcontroller on a PX4 or Pixhawk fails. When this RC input channel goes above 1750 the FMU will stop sending servo controls to the PX4IO board, which will trigger the PX4IO board to start using its failsafe override behaviour, which should give you manual control of the aircraft. That allows you to test for correct manual behaviour without actually crashing the FMU. This parameter is normally only set to a non-zero value for ground testing purposes. When the override channel is used it also forces the PX4 safety switch into an armed state. This allows it to be used as a way to re-arm a plane after an in-flight reboot. Use in that way is considered a developer option, for people testing unstable developer code. Note that you may set OVERRIDE_CHAN to the same channel as FLTMODE_CH to get PX4IO based override when in flight mode 6. Note that when override is triggered the 6 auxiliary output channels on Pixhawk will no longer be updated, so all the flight controls you need must be assigned to the first 8 channels.
// @User: Advanced
GSCALAR(override_channel, "OVERRIDE_CHAN", 0),
#endif
@ -929,17 +929,19 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Param: INVERTEDFLT_CH
// @DisplayName: Inverted flight channel
// @Description: A RC input channel number to enable inverted flight. If this is non-zero then the APM will monitor the correcponding RC input channel and will enable inverted flight when the channel goes above 1750.
// @Description: A RC input channel number to enable inverted flight. If this is non-zero then the APM will monitor the corresponding RC input channel and will enable inverted flight when the channel goes above 1750.
// @Values: 0:Disabled,1:Channel1,2:Channel2,3:Channel3,4:Channel4,5:Channel5,6:Channel6,7:Channel7,8:Channel8
// @User: Standard
GSCALAR(inverted_flight_ch, "INVERTEDFLT_CH", 0),
#if HIL_SUPPORT
// @Param: HIL_MODE
// @DisplayName: HIL mode enable
// @Description: This enables and disables hardware in the loop mode. If HIL_MODE is 1 then on the next reboot all sensors are replaced with HIL sensors which come from the GCS.
// @Values: 0:Disabled,1:Enabled
// @User: Advanced
GSCALAR(hil_mode, "HIL_MODE", 0),
#endif
// @Param: HIL_SERVOS
// @DisplayName: HIL Servos enable
@ -969,7 +971,7 @@ const AP_Param::Info Plane::var_info[] PROGMEM = {
// @Description: Automatically set roll/pitch trim from Tx at ground start. This makes the assumption that the RC transmitter has not been altered since trims were last captured.
// @Values: 0:Disable,1:Enable
// @User: Standard
GSCALAR(trim_rc_at_start, "TRIM_RC_AT_START", 1),
GSCALAR(trim_rc_at_start, "TRIM_RC_AT_START", 0),
// barometer ground calibration. The GND_ prefix is chosen for
// compatibility with previous releases of ArduPlane

View File

@ -3,7 +3,7 @@
#ifndef PARAMETERS_H
#define PARAMETERS_H
#include <AP_Common.h>
#include <AP_Common/AP_Common.h>
// Global parameter class.
//
@ -448,7 +448,9 @@ public:
AP_Int16 pitch_trim_cd;
AP_Int16 FBWB_min_altitude_cm;
AP_Int8 hil_servos;
#if HIL_SUPPORT
AP_Int8 hil_mode;
#endif
AP_Int8 compass_enabled;
AP_Int8 flap_1_percent;

View File

@ -1,6 +1,8 @@
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#define THISFIRMWARE "ArduPlane V3.3.1beta1"
#define THISFIRMWARE "ArduPlane V3.4.0beta1"
#define FIRMWARE_VERSION 3,4,0,FIRMWARE_VERSION_TYPE_BETA
/*
Lead developer: Andrew Tridgell
@ -31,62 +33,62 @@
#include <stdarg.h>
#include <stdio.h>
#include <AP_HAL.h>
#include <AP_Common.h>
#include <AP_Progmem.h>
#include <AP_Menu.h>
#include <AP_Param.h>
#include <StorageManager.h>
#include <AP_GPS.h> // ArduPilot GPS library
#include <AP_Baro.h> // ArduPilot barometer library
#include <AP_Compass.h> // ArduPilot Mega Magnetometer Library
#include <AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
#include <AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource.h>
#include <AP_InertialSensor.h> // Inertial Sensor Library
#include <AP_AHRS.h> // ArduPilot Mega DCM Library
#include <RC_Channel.h> // RC Channel Library
#include <AP_RangeFinder.h> // Range finder library
#include <Filter.h> // Filter library
#include <AP_Buffer.h> // APM FIFO Buffer
#include <AP_Relay.h> // APM relay
#include <AP_Camera.h> // Photo or video camera
#include <AP_Airspeed.h>
#include <AP_Terrain.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_Common/AP_Common.h>
#include <AP_Progmem/AP_Progmem.h>
#include <AP_Menu/AP_Menu.h>
#include <AP_Param/AP_Param.h>
#include <StorageManager/StorageManager.h>
#include <AP_GPS/AP_GPS.h> // ArduPilot GPS library
#include <AP_Baro/AP_Baro.h> // ArduPilot barometer library
#include <AP_Compass/AP_Compass.h> // ArduPilot Mega Magnetometer Library
#include <AP_Math/AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
#include <AP_ADC/AP_ADC.h> // ArduPilot Mega Analog to Digital Converter Library
#include <AP_ADC_AnalogSource/AP_ADC_AnalogSource.h>
#include <AP_InertialSensor/AP_InertialSensor.h> // Inertial Sensor Library
#include <AP_AHRS/AP_AHRS.h> // ArduPilot Mega DCM Library
#include <RC_Channel/RC_Channel.h> // RC Channel Library
#include <AP_RangeFinder/AP_RangeFinder.h> // Range finder library
#include <Filter/Filter.h> // Filter library
#include <AP_Buffer/AP_Buffer.h> // APM FIFO Buffer
#include <AP_Relay/AP_Relay.h> // APM relay
#include <AP_Camera/AP_Camera.h> // Photo or video camera
#include <AP_Airspeed/AP_Airspeed.h>
#include <AP_Terrain/AP_Terrain.h>
#include <APM_OBC.h>
#include <APM_Control.h>
#include <AP_AutoTune.h>
#include <GCS.h>
#include <GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager.h> // Serial manager library
#include <AP_Mount.h> // Camera/Antenna mount
#include <AP_Declination.h> // ArduPilot Mega Declination Helper Library
#include <DataFlash.h>
#include <SITL.h>
#include <AP_Scheduler.h> // main loop scheduler
#include <APM_OBC/APM_OBC.h>
#include <APM_Control/APM_Control.h>
#include <APM_Control/AP_AutoTune.h>
#include <GCS_MAVLink/GCS.h>
#include <GCS_MAVLink/GCS_MAVLink.h> // MAVLink GCS definitions
#include <AP_SerialManager/AP_SerialManager.h> // Serial manager library
#include <AP_Mount/AP_Mount.h> // Camera/Antenna mount
#include <AP_Declination/AP_Declination.h> // ArduPilot Mega Declination Helper Library
#include <DataFlash/DataFlash.h>
#include <SITL/SITL.h>
#include <AP_Scheduler/AP_Scheduler.h> // main loop scheduler
#include <AP_Navigation.h>
#include <AP_L1_Control.h>
#include <AP_RCMapper.h> // RC input mapping library
#include <AP_Navigation/AP_Navigation.h>
#include <AP_L1_Control/AP_L1_Control.h>
#include <AP_RCMapper/AP_RCMapper.h> // RC input mapping library
#include <AP_Vehicle.h>
#include <AP_SpdHgtControl.h>
#include <AP_TECS.h>
#include <AP_NavEKF.h>
#include <AP_Mission.h> // Mission command library
#include <AP_Vehicle/AP_Vehicle.h>
#include <AP_SpdHgtControl/AP_SpdHgtControl.h>
#include <AP_TECS/AP_TECS.h>
#include <AP_NavEKF/AP_NavEKF.h>
#include <AP_Mission/AP_Mission.h> // Mission command library
#include <AP_Notify.h> // Notify library
#include <AP_BattMonitor.h> // Battery monitor library
#include <AP_Notify/AP_Notify.h> // Notify library
#include <AP_BattMonitor/AP_BattMonitor.h> // Battery monitor library
#include <AP_Arming.h>
#include <AP_BoardConfig.h>
#include <AP_Frsky_Telem.h>
#include <AP_ServoRelayEvents.h>
#include <AP_Arming/AP_Arming.h>
#include <AP_BoardConfig/AP_BoardConfig.h>
#include <AP_Frsky_Telem/AP_Frsky_Telem.h>
#include <AP_ServoRelayEvents/AP_ServoRelayEvents.h>
#include <AP_Rally.h>
#include <AP_Rally/AP_Rally.h>
#include <AP_OpticalFlow.h> // Optical Flow library
#include <AP_OpticalFlow/AP_OpticalFlow.h> // Optical Flow library
// Configuration
#include "config.h"
@ -96,13 +98,13 @@
#include "Parameters.h"
#include <AP_HAL_AVR.h>
#include <AP_HAL_SITL.h>
#include <AP_HAL_PX4.h>
#include <AP_HAL_FLYMAPLE.h>
#include <AP_HAL_Linux.h>
#include <AP_HAL_Empty.h>
#include <AP_HAL_VRBRAIN.h>
#include <AP_HAL_AVR/AP_HAL_AVR.h>
#include <AP_HAL_SITL/AP_HAL_SITL.h>
#include <AP_HAL_PX4/AP_HAL_PX4.h>
#include <AP_HAL_FLYMAPLE/AP_HAL_FLYMAPLE.h>
#include <AP_HAL_Linux/AP_HAL_Linux.h>
#include <AP_HAL_Empty/AP_HAL_Empty.h>
#include <AP_HAL_VRBRAIN/AP_HAL_VRBRAIN.h>
/*
a plane specific arming class
@ -466,6 +468,9 @@ private:
// last time is_flying() returned true in milliseconds
uint32_t last_flying_ms;
// once landed, post some landing statistics to the GCS
bool post_landing_stats;
} auto_state;
// true if we are in an auto-throttle mode, which means
@ -667,6 +672,7 @@ private:
void send_statustext(mavlink_channel_t chan);
bool telemetry_delayed(mavlink_channel_t chan);
void gcs_send_message(enum ap_message id);
void gcs_send_mission_item_reached_message(uint16_t mission_index);
void gcs_data_stream_send(void);
void gcs_update(void);
void gcs_send_text_P(gcs_severity severity, const prog_char_t *str);
@ -717,7 +723,6 @@ private:
float lookahead_adjustment(void);
float rangefinder_correction(void);
void rangefinder_height_update(void);
void add_altitude_data(unsigned long xl, long y);
void set_next_WP(const struct Location &loc);
void set_guided_WP(void);
void init_home();
@ -915,6 +920,7 @@ private:
void log_init();
uint32_t millis() const;
uint32_t micros() const;
void init_capabilities(void);
public:
void mavlink_delay_cb();

View File

@ -398,8 +398,8 @@ bool Plane::above_location_current(const Location &loc)
#endif
float loc_alt_cm = loc.alt;
if (!loc.flags.relative_alt) {
loc_alt_cm -= home.alt;
if (loc.flags.relative_alt) {
loc_alt_cm += home.alt;
}
return current_loc.alt > loc_alt_cm;
}

View File

@ -0,0 +1,9 @@
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "Plane.h"
void Plane::init_capabilities(void)
{
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT);
hal.util->set_capabilities(MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT);
}

View File

@ -1,62 +0,0 @@
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "Plane.h"
#if 0 // currently unused
struct DataPoint {
unsigned long x;
long y;
};
DataPoint history[ALTITUDE_HISTORY_LENGTH]; // Collection of (x,y) points to regress a rate of change from
unsigned char hindex; // Index in history for the current data point
unsigned long xoffset;
unsigned char n;
// Intermediate variables for regression calculation
long xi;
long yi;
long xiyi;
unsigned long xi2;
void add_altitude_data(unsigned long xl, long y)
{
//Reset the regression if our X variable overflowed
if (xl < xoffset)
n = 0;
//To allow calculation of sum(xi*yi), make sure X hasn't exceeded 2^32/2^15/length
if (xl - xoffset > 131072/ALTITUDE_HISTORY_LENGTH)
n = 0;
if (n == ALTITUDE_HISTORY_LENGTH) {
xi -= history[hindex].x;
yi -= history[hindex].y;
xiyi -= (long)history[hindex].x * history[hindex].y;
xi2 -= history[hindex].x * history[hindex].x;
} else {
if (n == 0) {
xoffset = xl;
xi = 0;
yi = 0;
xiyi = 0;
xi2 = 0;
}
n++;
}
history[hindex].x = xl - xoffset;
history[hindex].y = y;
xi += history[hindex].x;
yi += history[hindex].y;
xiyi += (long)history[hindex].x * history[hindex].y;
xi2 += history[hindex].x * history[hindex].x;
if (++hindex >= ALTITUDE_HISTORY_LENGTH)
hindex = 0;
}
#endif

View File

@ -28,6 +28,9 @@ bool Plane::start_command(const AP_Mission::Mission_Command& cmd)
// start non-idle
auto_state.idle_mode = false;
// once landed, post some landing statistics to the GCS
auto_state.post_landing_stats = false;
gcs_send_text_fmt(PSTR("Executing nav command ID #%i"),cmd.id);
} else {
gcs_send_text_fmt(PSTR("Executing command ID #%i"),cmd.id);
@ -245,15 +248,12 @@ bool Plane::verify_command(const AP_Mission::Mission_Command& cmd) // Ret
case MAV_CMD_CONDITION_DELAY:
return verify_wait_delay();
break;
case MAV_CMD_CONDITION_DISTANCE:
return verify_within_distance();
break;
case MAV_CMD_CONDITION_CHANGE_ALT:
return verify_change_alt();
break;
// do commands (always return true)
case MAV_CMD_DO_CHANGE_SPEED:
@ -831,10 +831,12 @@ void Plane::do_take_picture()
// log_picture - log picture taken and send feedback to GCS
void Plane::log_picture()
{
#if CAMERA == ENABLED
gcs_send_message(MSG_CAMERA_FEEDBACK);
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Camera(ahrs, gps, current_loc);
}
#endif
}
// start_command_callback - callback function called from ap-mission when it begins a new mission command
@ -852,7 +854,14 @@ bool Plane::start_command_callback(const AP_Mission::Mission_Command &cmd)
bool Plane::verify_command_callback(const AP_Mission::Mission_Command& cmd)
{
if (control_mode == AUTO) {
return verify_command(cmd);
bool cmd_complete = verify_command(cmd);
// send message to GCS
if (cmd_complete) {
gcs_send_mission_item_reached_message(cmd.index);
}
return cmd_complete;
}
return false;
}

View File

@ -420,11 +420,7 @@
// use this to disable geo-fencing
#ifndef GEOFENCE_ENABLED
#if HAL_CPU_CLASS > HAL_CPU_CLASS_16
# define GEOFENCE_ENABLED ENABLED
#else
# define GEOFENCE_ENABLED DISABLE
#endif
#endif
// pwm value on FENCE_CHANNEL to use to enable fenced mode
@ -459,6 +455,12 @@
#define CLI_ENABLED DISABLED
#endif
#if HAL_CPU_CLASS < HAL_CPU_CLASS_75
#define HIL_SUPPORT DISABLED
#else
#define HIL_SUPPORT ENABLED
#endif
/*
build a firmware version string.
GIT_VERSION comes from Makefile builds

View File

@ -44,7 +44,6 @@ void Plane::read_control_switch()
set_mode((enum FlightMode)(flight_modes[switchPosition].get()));
oldSwitchPosition = switchPosition;
prev_WP_loc = current_loc;
}
if (g.reset_mission_chan != 0 &&

View File

@ -94,7 +94,8 @@ void Plane::geofence_load(void)
uint8_t i;
if (geofence_state == NULL) {
if (hal.util->available_memory() < 512 + sizeof(struct GeofenceState)) {
uint16_t boundary_size = sizeof(Vector2l) * max_fencepoints();
if (hal.util->available_memory() < 100 + boundary_size + sizeof(struct GeofenceState)) {
// too risky to enable as we could run out of stack
goto failed;
}
@ -104,7 +105,7 @@ void Plane::geofence_load(void)
goto failed;
}
geofence_state->boundary = (Vector2l *)calloc(sizeof(Vector2l), max_fencepoints());
geofence_state->boundary = (Vector2l *)calloc(1, boundary_size);
if (geofence_state->boundary == NULL) {
free(geofence_state);
geofence_state = NULL;

View File

@ -49,6 +49,7 @@ bool Plane::verify_land()
(fabsf(auto_state.sink_rate) < 0.2f && !is_flying())) {
if (!auto_state.land_complete) {
auto_state.post_landing_stats = true;
if (!is_flying() && (millis()-auto_state.last_flying_ms) > 3000) {
gcs_send_text_fmt(PSTR("Flare crash detected: speed=%.1f"), (double)gps.ground_speed());
} else {
@ -80,6 +81,13 @@ bool Plane::verify_land()
get_distance(prev_WP_loc, current_loc) + 200);
nav_controller->update_waypoint(prev_WP_loc, land_WP_loc);
// once landed and stationary, post some statistics
// this is done before disarm_if_autoland_complete() so that it happens on the next loop after the disarm
if (auto_state.post_landing_stats && !arming.is_armed()) {
auto_state.post_landing_stats = false;
gcs_send_text_fmt(PSTR("Distance from LAND point=%.2fm"), get_distance(current_loc, next_WP_loc));
}
// check if we should auto-disarm after a confirmed landing
disarm_if_autoland_complete();
@ -131,6 +139,12 @@ void Plane::setup_landing_glide_slope(void)
int32_t land_bearing_cd = get_bearing_cd(prev_WP_loc, next_WP_loc);
float total_distance = get_distance(prev_WP_loc, next_WP_loc);
// If someone mistakenly puts all 0's in their LAND command then total_distance
// will be calculated as 0 and cause a divide by 0 error below. Lets avoid that.
if (total_distance < 1) {
total_distance = 1;
}
// height we need to sink for this WP
float sink_height = (prev_WP_loc.alt - next_WP_loc.alt)*0.01f;

View File

@ -75,7 +75,9 @@ void Plane::read_battery(void)
battery.read();
compass.set_current(battery.current_amps());
if (!usb_connected && battery.exhausted(g.fs_batt_voltage, g.fs_batt_mah)) {
if (!usb_connected &&
hal.util->get_soft_armed() &&
battery.exhausted(g.fs_batt_voltage, g.fs_batt_mah)) {
low_battery_event();
}
}

View File

@ -95,12 +95,14 @@ void Plane::init_ardupilot()
//
load_parameters();
#if HIL_SUPPORT
if (g.hil_mode == 1) {
// set sensors to HIL mode
ins.set_hil_mode();
compass.set_hil_mode();
barometer.set_hil_mode();
}
#endif
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
// this must be before BoardConfig.init() so if
@ -233,6 +235,8 @@ void Plane::init_ardupilot()
}
#endif // CLI_ENABLED
init_capabilities();
startup_ground();
Log_Write_Startup(TYPE_GROUNDSTART_MSG);
@ -359,6 +363,9 @@ void Plane::set_mode(enum FlightMode mode)
// disable taildrag takeoff on mode change
auto_state.fbwa_tdrag_takeoff_mode = false;
// start with previous WP at current location
prev_WP_loc = current_loc;
switch(control_mode)
{
case INITIALISING:
@ -536,6 +543,7 @@ void Plane::check_short_failsafe()
void Plane::startup_INS_ground(void)
{
#if HIL_SUPPORT
if (g.hil_mode == 1) {
while (barometer.get_last_update() == 0) {
// the barometer begins updating when we get the first
@ -544,6 +552,7 @@ void Plane::startup_INS_ground(void)
hal.scheduler->delay(1000);
}
}
#endif
AP_InertialSensor::Start_style style;
if (g.skip_gyro_cal) {
@ -679,12 +688,14 @@ void Plane::print_comma(void)
*/
void Plane::servo_write(uint8_t ch, uint16_t pwm)
{
#if HIL_SUPPORT
if (g.hil_mode==1 && !g.hil_servos) {
if (ch < 8) {
RC_Channel::rc_channel(ch)->radio_out = pwm;
}
return;
}
#endif
hal.rcout->enable_ch(ch);
hal.rcout->write(ch, pwm);
}

View File

@ -77,6 +77,8 @@
>> - ***Subsystem***: Linux
>> - [Peter Barker](https://github.com/peterbarker)
>> - ***Subsystem***: DataFlash
>> - [Michael du Breuil](https://github.com/WickedShell)
>> - ***Subsystem***: uBlox GPS
>> - [Víctor Mayoral Vilches](https://github.com/vmayoral)
>> - ***Board***: PXF
>> - [Mirko Denecke](https://github.com/mirkix)

View File

@ -24,7 +24,7 @@
#define JetiBox_h
#include <inttypes.h>
#include "Print.h"
#include <AP_HAL/utility/Print.h>
#define jbox_key_up 0b0010
#define jbox_key_right 0b0001

View File

@ -5,39 +5,39 @@
Andrew Tridgell September 2011
*/
#include <AP_HAL.h>
#include <AP_HAL_AVR.h>
#include <AP_HAL_SITL.h>
#include <AP_HAL_PX4.h>
#include <AP_HAL_Empty.h>
#include <AP_Common.h>
#include <AP_Scheduler.h>
#include <AP_Baro.h>
#include <AP_ADC.h>
#include <AP_GPS.h>
#include <AP_InertialSensor.h>
#include <AP_Notify.h>
#include <DataFlash.h>
#include <GCS_MAVLink.h>
#include <AP_Compass.h>
#include <AP_Declination.h>
#include <SITL.h>
#include <Filter.h>
#include <AP_Param.h>
#include <StorageManager.h>
#include <AP_Progmem.h>
#include <AP_Math.h>
#include <AP_AHRS.h>
#include <AP_NavEKF.h>
#include <AP_Airspeed.h>
#include <AP_Vehicle.h>
#include <AP_Mission.h>
#include <AP_Terrain.h>
#include <AP_BattMonitor.h>
#include <AP_Rally.h>
#include <AP_ADC_AnalogSource.h>
#include <AP_OpticalFlow.h>
#include <AP_RangeFinder.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_HAL_AVR/AP_HAL_AVR.h>
#include <AP_HAL_SITL/AP_HAL_SITL.h>
#include <AP_HAL_PX4/AP_HAL_PX4.h>
#include <AP_HAL_Empty/AP_HAL_Empty.h>
#include <AP_Common/AP_Common.h>
#include <AP_Scheduler/AP_Scheduler.h>
#include <AP_Baro/AP_Baro.h>
#include <AP_ADC/AP_ADC.h>
#include <AP_GPS/AP_GPS.h>
#include <AP_InertialSensor/AP_InertialSensor.h>
#include <AP_Notify/AP_Notify.h>
#include <DataFlash/DataFlash.h>
#include <GCS_MAVLink/GCS_MAVLink.h>
#include <AP_Compass/AP_Compass.h>
#include <AP_Declination/AP_Declination.h>
#include <SITL/SITL.h>
#include <Filter/Filter.h>
#include <AP_Param/AP_Param.h>
#include <StorageManager/StorageManager.h>
#include <AP_Progmem/AP_Progmem.h>
#include <AP_Math/AP_Math.h>
#include <AP_AHRS/AP_AHRS.h>
#include <AP_NavEKF/AP_NavEKF.h>
#include <AP_Airspeed/AP_Airspeed.h>
#include <AP_Vehicle/AP_Vehicle.h>
#include <AP_Mission/AP_Mission.h>
#include <AP_Terrain/AP_Terrain.h>
#include <AP_BattMonitor/AP_BattMonitor.h>
#include <AP_Rally/AP_Rally.h>
#include <AP_ADC_AnalogSource/AP_ADC_AnalogSource.h>
#include <AP_OpticalFlow/AP_OpticalFlow.h>
#include <AP_RangeFinder/AP_RangeFinder.h>
const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;

View File

@ -9,8 +9,8 @@ version 2.1 of the License, or (at your option) any later version.
// Libraries
#include <FastSerial.h>
#include <AP_Common.h>
#include <AP_Math.h>
#include <AP_Common/AP_Common.h>
#include <AP_Math/AP_Math.h>
#include <Arduino_Mega_ISR_Registry.h>
#include <APM_RC.h> // ArduPilot Mega RC Library

View File

@ -59,12 +59,12 @@
#include <unistd.h>
#pragma pack(1)
#include "mavlink_types.h"
#include <GCS_MAVLink/include/mavlink/v1.0/mavlink_types.h>
mavlink_system_t mavlink_system;
void comm_send_ch(mavlink_channel_t chan, uint8_t ch);
#define MAVLINK_USE_CONVENIENCE_FUNCTIONS
#include "ardupilotmega/mavlink.h"
#include <GCS_MAVLink/include/mavlink/v1.0/ardupilotmega/mavlink.h>
#define TARGET_SYSTEM 7 /* XXX what should these really be? */
#define TARGET_COMPONENT 1

View File

@ -5,30 +5,30 @@
Andrew Tridgell September 2011
*/
#include <AP_Common.h>
#include <AP_Progmem.h>
#include <AP_HAL.h>
#include <AP_HAL_AVR.h>
#include <AP_HAL_SITL.h>
#include <AP_HAL_PX4.h>
#include <AP_HAL_Empty.h>
#include <AP_Math.h>
#include <Filter.h>
#include <AP_InertialSensor.h>
#include <AP_ADC.h>
#include <GCS_MAVLink.h>
#include <AP_Param.h>
#include <AP_Baro.h>
#include <AP_Compass.h>
#include <AP_Declination.h>
#include <SITL.h>
#include <DataFlash.h>
#include <AP_GPS.h>
#include <AP_AHRS.h>
#include <AP_Airspeed.h>
#include <AP_Vehicle.h>
#include <AP_ADC_AnalogSource.h>
#include <AP_Notify.h>
#include <AP_Common/AP_Common.h>
#include <AP_Progmem/AP_Progmem.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_HAL_AVR/AP_HAL_AVR.h>
#include <AP_HAL_SITL/AP_HAL_SITL.h>
#include <AP_HAL_PX4/AP_HAL_PX4.h>
#include <AP_HAL_Empty/AP_HAL_Empty.h>
#include <AP_Math/AP_Math.h>
#include <Filter/Filter.h>
#include <AP_InertialSensor/AP_InertialSensor.h>
#include <AP_ADC/AP_ADC.h>
#include <GCS_MAVLink/GCS_MAVLink.h>
#include <AP_Param/AP_Param.h>
#include <AP_Baro/AP_Baro.h>
#include <AP_Compass/AP_Compass.h>
#include <AP_Declination/AP_Declination.h>
#include <SITL/SITL.h>
#include <DataFlash/DataFlash.h>
#include <AP_GPS/AP_GPS.h>
#include <AP_AHRS/AP_AHRS.h>
#include <AP_Airspeed/AP_Airspeed.h>
#include <AP_Vehicle/AP_Vehicle.h>
#include <AP_ADC_AnalogSource/AP_ADC_AnalogSource.h>
#include <AP_Notify/AP_Notify.h>
const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;

View File

@ -1,7 +1,7 @@
#ifndef REPLAY_DATAFLASHREADER_H
#define REPLAY_DATAFLASHREADER_H
#include <DataFlash.h>
#include <DataFlash/DataFlash.h>
class DataFlashFileReader
{

View File

@ -296,7 +296,7 @@ void LR_MsgHandler_MAG::process_message(uint8_t *msg)
update_from_msg_compass(0, msg);
}
#include <AP_AHRS.h>
#include <AP_AHRS/AP_AHRS.h>
#include "VehicleType.h"
void LR_MsgHandler_MSG::process_message(uint8_t *msg)

View File

@ -1,13 +1,13 @@
#include <AP_HAL.h>
#include <AP_Common.h>
#include <AP_Math.h>
#include <AP_Airspeed.h>
#include <AP_Compass.h>
#include <AP_GPS.h>
#include <AP_Compass.h>
#include <AP_Baro.h>
#include <AP_InertialSensor.h>
#include <DataFlash.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_Common/AP_Common.h>
#include <AP_Math/AP_Math.h>
#include <AP_Airspeed/AP_Airspeed.h>
#include <AP_Compass/AP_Compass.h>
#include <AP_GPS/AP_GPS.h>
#include <AP_Compass/AP_Compass.h>
#include <AP_Baro/AP_Baro.h>
#include <AP_InertialSensor/AP_InertialSensor.h>
#include <DataFlash/DataFlash.h>
#include "LogReader.h"
#include <stdio.h>

View File

@ -1,7 +1,7 @@
#ifndef AP_MSGHANDLER_H
#define AP_MSGHANDLER_H
#include <DataFlash.h>
#include <DataFlash/DataFlash.h>
#include "VehicleType.h"
#include <stdio.h>

View File

@ -3,7 +3,7 @@
#ifndef PARAMETERS_H
#define PARAMETERS_H
#include <AP_Common.h>
#include <AP_Common/AP_Common.h>
// Global parameter class.
//

View File

@ -14,48 +14,48 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <AP_Common.h>
#include <AP_Progmem.h>
#include <AP_Param.h>
#include <StorageManager.h>
#include <AP_Common/AP_Common.h>
#include <AP_Progmem/AP_Progmem.h>
#include <AP_Param/AP_Param.h>
#include <StorageManager/StorageManager.h>
#include <fenv.h>
#include <AP_Math.h>
#include <AP_HAL.h>
#include <AP_HAL_AVR.h>
#include <AP_HAL_SITL.h>
#include <AP_HAL_Linux.h>
#include <AP_HAL_Empty.h>
#include <AP_ADC.h>
#include <AP_Declination.h>
#include <AP_ADC_AnalogSource.h>
#include <Filter.h>
#include <AP_Buffer.h>
#include <AP_Airspeed.h>
#include <AP_Vehicle.h>
#include <AP_Notify.h>
#include <DataFlash.h>
#include <GCS_MAVLink.h>
#include <AP_GPS.h>
#include <AP_AHRS.h>
#include <SITL.h>
#include <AP_Compass.h>
#include <AP_Baro.h>
#include <AP_InertialSensor.h>
#include <AP_InertialNav.h>
#include <AP_NavEKF.h>
#include <AP_Mission.h>
#include <AP_Rally.h>
#include <AP_BattMonitor.h>
#include <AP_Terrain.h>
#include <AP_OpticalFlow.h>
#include <AP_SerialManager.h>
#include <RC_Channel.h>
#include <AP_RangeFinder.h>
#include <AP_Math/AP_Math.h>
#include <AP_HAL/AP_HAL.h>
#include <AP_HAL_AVR/AP_HAL_AVR.h>
#include <AP_HAL_SITL/AP_HAL_SITL.h>
#include <AP_HAL_Linux/AP_HAL_Linux.h>
#include <AP_HAL_Empty/AP_HAL_Empty.h>
#include <AP_ADC/AP_ADC.h>
#include <AP_Declination/AP_Declination.h>
#include <AP_ADC_AnalogSource/AP_ADC_AnalogSource.h>
#include <Filter/Filter.h>
#include <AP_Buffer/AP_Buffer.h>
#include <AP_Airspeed/AP_Airspeed.h>
#include <AP_Vehicle/AP_Vehicle.h>
#include <AP_Notify/AP_Notify.h>
#include <DataFlash/DataFlash.h>
#include <GCS_MAVLink/GCS_MAVLink.h>
#include <AP_GPS/AP_GPS.h>
#include <AP_AHRS/AP_AHRS.h>
#include <SITL/SITL.h>
#include <AP_Compass/AP_Compass.h>
#include <AP_Baro/AP_Baro.h>
#include <AP_InertialSensor/AP_InertialSensor.h>
#include <AP_InertialNav/AP_InertialNav.h>
#include <AP_NavEKF/AP_NavEKF.h>
#include <AP_Mission/AP_Mission.h>
#include <AP_Rally/AP_Rally.h>
#include <AP_BattMonitor/AP_BattMonitor.h>
#include <AP_Terrain/AP_Terrain.h>
#include <AP_OpticalFlow/AP_OpticalFlow.h>
#include <AP_SerialManager/AP_SerialManager.h>
#include <RC_Channel/RC_Channel.h>
#include <AP_RangeFinder/AP_RangeFinder.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <utility/getopt_cpp.h>
#include <AP_HAL/utility/getopt_cpp.h>
#include "Parameters.h"
#include "VehicleType.h"
#include "MsgHandler.h"

View File

@ -0,0 +1,75 @@
BATT_MONITOR 4.0000
COMPASS_OFS2_X 5.0000
COMPASS_OFS2_Y 13.0000
COMPASS_OFS2_Z -18.0000
COMPASS_OFS3_X 1.0000
COMPASS_OFS3_Y 1.0000
COMPASS_OFS3_Z 1.0000
COMPASS_OFS_X 2.8749
COMPASS_OFS_Y -21.8262
COMPASS_OFS_Z -21.8422
FLTMODE1 7.0000
FLTMODE2 9.0000
FLTMODE3 6.0000
FLTMODE4 3.0000
FLTMODE5 5.0000
# we need small INS_ACC offsets so INS is recognised as being calibrated
INS_ACCOFFS_X 0.001
INS_ACCOFFS_Y 0.001
INS_ACCOFFS_Z 0.001
INS_ACCSCAL_X 1.001
INS_ACCSCAL_Y 1.001
INS_ACCSCAL_Z 1.001
INS_ACC2OFFS_X 0.001
INS_ACC2OFFS_Y 0.001
INS_ACC2OFFS_Z 0.001
INS_ACC2SCAL_X 1.001
INS_ACC2SCAL_Y 1.001
INS_ACC2SCAL_Z 1.001
INS_ACC3OFFS_X 0.000
INS_ACC3OFFS_Y 0.000
INS_ACC3OFFS_Z 0.000
INS_ACC3SCAL_X 1.000
INS_ACC3SCAL_Y 1.000
INS_ACC3SCAL_Z 1.000
RATE_PIT_D 0.0500
RATE_PIT_I 12.5000
RATE_PIT_IMAX 4500.0000
RATE_PIT_P 5.0000
RATE_PIT_VFF 0.220000
RATE_RLL_D 0.0500
RATE_RLL_I 12.5000
RATE_RLL_IMAX 4500.0000
RATE_RLL_P 5.0000
RATE_RLL_VFF 0.220000
RATE_YAW_D 0.0200
RATE_YAW_I 0.0975
RATE_YAW_VFF 0.200000
STB_PIT_P 12.5368
STB_RLL_P 15.2386
STB_YAW_P 7.6965
RC1_MAX 2000.000000
RC1_MIN 1000.000000
RC1_TRIM 1500.000000
RC2_MAX 2000.000000
RC2_MIN 1000.000000
RC2_TRIM 1500.000000
RC3_MAX 2000.000000
RC3_MIN 1000.000000
RC3_TRIM 1500.000000
RC4_MAX 2000.000000
RC4_MIN 1000.000000
RC4_TRIM 1500.000000
RC5_MAX 2000.000000
RC5_MIN 1000.000000
RC5_TRIM 1500.000000
RC6_MAX 2000.000000
RC6_MIN 1000.000000
RC6_TRIM 1500.000000
RC7_MAX 2000.000000
RC7_MIN 1000.000000
RC7_TRIM 1500.000000
RC8_MAX 2000.000000
RC8_MIN 1000.000000
RC8_TRIM 1500.000000
WP_YAW_BEHAVIOR 2

View File

@ -1,6 +0,0 @@
#!/bin/bash
# This is a helper script for run_in_terminal_window.sh. I'm not sure why Ardupilot.elf exits if not run from inside of a script
echo running $*
( $* )
echo cmd exited

View File

@ -21,6 +21,6 @@ else
echo "Window access not found, logging to $filename"
cmd="$1"
shift
( $AUTOTEST/run_cmd.sh $cmd $* &>$filename < /dev/null ) &
( $cmd $* &>$filename < /dev/null ) &
fi
exit 0

View File

@ -188,7 +188,12 @@ SIMOUT_PORT="127.0.0.1:"$((5501+10*$INSTANCE))
FG_PORT="127.0.0.1:"$((5503+10*$INSTANCE))
[ -z "$VEHICLE" ] && {
VEHICLE=$(basename $PWD)
CDIR="$PWD"
rpath=$(which realpath)
[ -n "rpath" ] && {
CDIR=$(realpath $CDIR)
}
VEHICLE=$(basename $CDIR)
}
[ -z "$FRAME" -a "$VEHICLE" = "APMrover2" ] && {
@ -247,6 +252,16 @@ case $FRAME in
BUILD_TARGET="sitl-heli"
MODEL="heli"
;;
heli-dual)
BUILD_TARGET="sitl-heli-dual"
EXTRA_SIM="$EXTRA_SIM --frame=heli-dual"
MODEL="heli-dual"
;;
heli-compound)
BUILD_TARGET="sitl-heli-compound"
EXTRA_SIM="$EXTRA_SIM --frame=heli-compound"
MODEL="heli-compound"
;;
IrisRos)
BUILD_TARGET="sitl"
;;
@ -287,8 +302,12 @@ autotest="../Tools/autotest"
# the location of the sim_vehicle.sh script to find the path
autotest=$(dirname $(readlink -e $0))
}
pushd $autotest/../../$VEHICLE || {
echo "Failed to change to vehicle directory for $VEHICLE"
VEHICLEDIR="$autotest/../../$VEHICLE"
[ -d "$VEHICLEDIR" ] || {
VEHICLEDIR=$(dirname $(readlink -e $VEHICLEDIR))
}
pushd $VEHICLEDIR || {
echo "Failed to change to vehicle directory for $VEHICLEDIR"
usage
exit 1
}

View File

@ -8,9 +8,12 @@
set -e
set -x
export BUILDROOT="/tmp/all.build"
rm -rf $BUILDROOT
echo "Testing ArduPlane build"
pushd ArduPlane
for b in all apm2 sitl linux; do
for b in sitl linux; do
pwd
make clean
make $b -j4
@ -28,7 +31,7 @@ popd
echo "Testing APMRover build"
pushd APMrover2
for b in all apm2 sitl linux; do
for b in sitl linux; do
pwd
make clean
make $b -j4
@ -37,7 +40,7 @@ popd
echo "Testing AntennaTracker build"
pushd AntennaTracker
for b in apm2 sitl; do
for b in sitl; do
pwd
make clean
make $b -j4
@ -50,15 +53,13 @@ examples="Tools/CPUInfo"
for d in $examples; do
pushd $d
make clean
make apm2 -j4
make clean
make sitl -j4
popd
done
test -d ../libmaple && {
echo "Testing flymaple build"
for d in ArduPlane APMrover2; do
for d in APMrover2; do
pushd $d
make clean
make flymaple -j4

36
Tools/scripts/build_all_fast.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
# useful script to test all the different build types that we support.
# This helps when doing large merges
# Andrew Tridgell, November 2011
. config.mk
set -e
set -x
echo "Testing ArduPlane build"
pushd ArduPlane
for b in all apm2 sitl linux; do
pwd
make clean
make $b -j4
done
popd
for d in ArduCopter APMrover2 ArduPlane AntennaTracker; do
pushd $d
make clean
make sitl -j4
make clean
make linux -j4
make clean
make px4-v2
popd
done
pushd Tools/Replay
make clean
make linux -j4
popd
exit 0

View File

@ -1,6 +1,6 @@
#!/bin/bash
export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/prefix/bin:$HOME/APM/px4/gcc-arm-none-eabi-4_7-2014q2/bin:$PATH
export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/prefix/bin:$HOME/APM/px4/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH
export PYTHONUNBUFFERED=1
export PYTHONPATH=$HOME/APM
@ -40,7 +40,7 @@ lock_file() {
if test -f "$lck" && kill -0 $pid 2> /dev/null; then
LOCKAGE=$(($(date +%s) - $(stat -c '%Y' "build.lck")))
test $LOCKAGE -gt 7200 && {
test $LOCKAGE -gt 30000 && {
echo "old lock file $lck is valid for $pid with age $LOCKAGE seconds"
}
return 1
@ -88,6 +88,9 @@ report_pull_failure() {
oldhash=$(cd APM && git rev-parse HEAD)
pushd APM
git checkout -f master
git fetch origin
git reset --hard origin/master
git pull || report_pull_failure
git clean -f -f -x -d -d
git tag autotest-$(date '+%Y-%m-%d-%H%M%S') -m "test tag `date`"
@ -148,7 +151,7 @@ popd
githash=$(cd APM && git rev-parse HEAD)
hdate=$(date +"%Y-%m-%d-%H:%m")
for d in ArduPlane ArduCopter APMrover2; do
for d in ArduPlane ArduCopter APMrover2 AntennaTracker; do
pushd APM/$d
rm -rf ../../buildlogs/$d.build
(date && TMPDIR=../../buildlogs make) > ../../buildlogs/$d.txt 2>&1
@ -177,6 +180,6 @@ killall -9 JSBSim || /bin/true
# raise core limit
ulimit -c 10000000
timelimit 12000 APM/Tools/autotest/autotest.py --timeout=11500 > buildlogs/autotest-output.txt 2>&1
timelimit 22000 APM/Tools/autotest/autotest.py --timeout=20000 > buildlogs/autotest-output.txt 2>&1
) >> build.log 2>&1

View File

@ -22,34 +22,63 @@ error_count=0
. config.mk
board_branch() {
board="$1"
case $board in
apm1|apm2)
echo "-AVR"
;;
*)
echo ""
;;
esac
}
# checkout the right version of the tree
checkout() {
vehicle="$1"
tag="$2"
board="$3"
frame="$4"
echo "Trying checkout $vehicle $tag $board $frame"
git stash
if [ "$tag" = "latest" ]; then
vtag="master"
vtag2="master"
else
vtag="$vehicle-$tag-$board"
vtag2="$vehicle-$tag"
vtag="$vehicle-$tag"
fi
echo "FORCING NON-BOARD SPECIFIC BUILD"
vtag=$vtag2
# try frame specific tag
if [ -n "$frame" ]; then
vtag2="$vtag-$frame"
echo "Checkout for $vehicle for $board with tag $tag"
git checkout -f "$vtag2" && {
echo "Using frame specific tag $vtag2"
[ -f $BASEDIR/.gitmodules ] && git submodule update
git log -1
return 0
}
fi
git checkout -f "$vtag" || git checkout -f "$vtag2" || {
return 1
# try board type specific branch extension
vtag2="$vtag"$(board_branch $board)
git checkout -f "$vtag2" && {
echo "Using board specific tag $vtag2"
[ -f $BASEDIR/.gitmodules ] && git submodule update
git log -1
return 0
}
[ -f $BASEDIR/.gitmodules ] && git submodule update
git log -1
git checkout -f "$vtag" && {
echo "Using generic tag $vtag"
[ -f $BASEDIR/.gitmodules ] && git submodule update
git log -1
return 0
}
return 0
echo "Failed to find tag for $vehicle $tag $board $frame"
return 1
}
# check if we should skip this build because we have already
@ -126,7 +155,7 @@ build_arduplane() {
echo "Building ArduPlane $tag binaries from $(pwd)"
pushd ArduPlane
for b in apm1 apm2 navio pxf; do
checkout ArduPlane $tag $b || {
checkout ArduPlane $tag $b "" || {
echo "Failed checkout of ArduPlane $b $tag"
error_count=$((error_count+1))
continue
@ -141,15 +170,15 @@ build_arduplane() {
continue
}
extension=$(board_extension $b)
copyit $TMPDIR/ArduPlane.build/ArduPlane.$extension $ddir $tag
copyit $BUILDROOT/ArduPlane.$extension $ddir $tag
touch $binaries/Plane/$tag
done
echo "Building ArduPlane PX4 binaries"
ddir=$binaries/Plane/$hdate/PX4
checkout ArduPlane $tag PX4 || {
checkout ArduPlane $tag PX4 "" || {
echo "Failed checkout of ArduPlane PX4 $tag"
error_count=$((error_count+1))
checkout ArduPlane "latest" ""
checkout ArduPlane "latest" "" ""
popd
return
}
@ -157,12 +186,13 @@ build_arduplane() {
make px4 || {
echo "Failed build of ArduPlane PX4 $tag"
error_count=$((error_count+1))
checkout ArduPlane "latest" ""
checkout ArduPlane "latest" "" ""
popd
return
}
copyit ArduPlane-v1.px4 $ddir $tag &&
copyit ArduPlane-v2.px4 $ddir $tag
copyit ArduPlane-v2.px4 $ddir $tag &&
test ! -f ArduPlane-v4.px4 || copyit ArduPlane-v4.px4 $ddir $tag
if [ "$tag" = "latest" ]; then
copyit px4io-v1.bin $binaries/PX4IO/$hdate/PX4IO $tag
copyit px4io-v1.elf $binaries/PX4IO/$hdate/PX4IO $tag
@ -170,7 +200,7 @@ build_arduplane() {
copyit px4io-v2.elf $binaries/PX4IO/$hdate/PX4IO $tag
fi
}
checkout ArduPlane "latest" ""
checkout ArduPlane "latest" "" ""
popd
}
@ -182,12 +212,12 @@ build_arducopter() {
frames="quad tri hexa y6 octa octa-quad heli"
for b in navio pxf; do
for f in $frames; do
checkout ArduCopter $tag $b || {
echo "Failed checkout of ArduCopter $b $tag"
checkout ArduCopter $tag $b $f || {
echo "Failed checkout of ArduCopter $b $tag $f"
error_count=$((error_count+1))
continue
}
echo "Building ArduCopter $b binaries"
echo "Building ArduCopter $b binaries $f"
ddir=$binaries/Copter/$hdate/$b-$f
skip_build $tag $ddir && continue
make clean || continue
@ -197,19 +227,18 @@ build_arducopter() {
continue
}
extension=$(board_extension $b)
copyit $TMPDIR/ArduCopter.build/ArduCopter.$extension $ddir $tag
copyit $BUILDROOT/ArduCopter.$extension $ddir $tag
touch $binaries/Copter/$tag
done
done
checkout ArduCopter $tag PX4 || {
echo "Failed checkout of ArduCopter PX4 $tag"
error_count=$((error_count+1))
checkout ArduCopter "latest" ""
popd
return
}
rm -rf ../Build.ArduCopter
for f in $frames; do
checkout ArduCopter $tag PX4 $f || {
echo "Failed checkout of ArduCopter PX4 $tag $f"
error_count=$((error_count+1))
checkout ArduCopter "latest" "" ""
continue
}
rm -rf ../Build.ArduCopter
echo "Building ArduCopter PX4-$f binaries"
ddir="$binaries/Copter/$hdate/PX4-$f"
skip_build $tag $ddir && continue
@ -219,9 +248,10 @@ build_arducopter() {
continue
}
copyit ArduCopter-v1.px4 $ddir $tag &&
copyit ArduCopter-v2.px4 $ddir $tag
copyit ArduCopter-v2.px4 $ddir $tag &&
test ! -f ArduCopter-v4.px4 || copyit ArduCopter-v4.px4 $ddir $tag
done
checkout ArduCopter "latest" ""
checkout ArduCopter "latest" "" ""
popd
}
@ -232,7 +262,7 @@ build_rover() {
pushd APMrover2
for b in apm1 apm2 navio pxf; do
echo "Building APMrover2 $b binaries"
checkout APMrover2 $tag $b || continue
checkout APMrover2 $tag $b "" || continue
ddir=$binaries/Rover/$hdate/$b
skip_build $tag $ddir && continue
make clean || continue
@ -242,13 +272,13 @@ build_rover() {
continue
}
extension=$(board_extension $b)
copyit $TMPDIR/APMrover2.build/APMrover2.$extension $ddir $tag
copyit $BUILDROOT/APMrover2.$extension $ddir $tag
touch $binaries/Rover/$tag
done
echo "Building APMrover2 PX4 binaries"
ddir=$binaries/Rover/$hdate/PX4
checkout APMrover2 $tag PX4 || {
checkout APMrover2 "latest" ""
checkout APMrover2 $tag PX4 "" || {
checkout APMrover2 "latest" "" ""
popd
return
}
@ -256,14 +286,15 @@ build_rover() {
make px4 || {
echo "Failed build of APMrover2 PX4 $tag"
error_count=$((error_count+1))
checkout APMrover2 "latest" ""
checkout APMrover2 "latest" "" ""
popd
return
}
copyit APMrover2-v1.px4 $binaries/Rover/$hdate/PX4 $tag &&
copyit APMrover2-v2.px4 $binaries/Rover/$hdate/PX4 $tag
copyit APMrover2-v2.px4 $binaries/Rover/$hdate/PX4 $tag &&
test ! -f APMrover2-v4.px4 || copyit APMrover2-v4.px4 $binaries/Rover/$hdate/PX4 $tag
}
checkout APMrover2 "latest" ""
checkout APMrover2 "latest" "" ""
popd
}
@ -274,7 +305,7 @@ build_antennatracker() {
pushd AntennaTracker
for b in apm2; do
echo "Building AntennaTracker $b binaries"
checkout AntennaTracker $tag $b || continue
checkout AntennaTracker $tag $b "" || continue
ddir=$binaries/AntennaTracker/$hdate/$b
skip_build $tag $ddir && continue
make clean || continue
@ -284,13 +315,13 @@ build_antennatracker() {
continue
}
extension=$(board_extension $b)
copyit $TMPDIR/AntennaTracker.build/AntennaTracker.$extension $ddir $tag
copyit $BUILDROOT/AntennaTracker.$extension $ddir $tag
touch $binaries/AntennaTracker/$tag
done
echo "Building AntennaTracker PX4 binaries"
ddir=$binaries/AntennaTracker/$hdate/PX4
checkout AntennaTracker $tag PX4 || {
checkout AntennaTracker "latest" ""
checkout AntennaTracker $tag PX4 "" || {
checkout AntennaTracker "latest" "" ""
popd
return
}
@ -298,14 +329,15 @@ build_antennatracker() {
make px4 || {
echo "Failed build of AntennaTracker PX4 $tag"
error_count=$((error_count+1))
checkout AntennaTracker "latest" ""
checkout AntennaTracker "latest" "" ""
popd
return
}
copyit AntennaTracker-v1.px4 $binaries/AntennaTracker/$hdate/PX4 $tag &&
copyit AntennaTracker-v2.px4 $binaries/AntennaTracker/$hdate/PX4 $tag
copyit AntennaTracker-v2.px4 $binaries/AntennaTracker/$hdate/PX4 $tag &&
test ! -f AntennaTracker-v4.px4 || copyit AntennaTracker-v4.px4 $binaries/AntennaTracker/$hdate/PX4 $tag
}
checkout AntennaTracker "latest" ""
checkout AntennaTracker "latest" "" ""
popd
}
@ -314,10 +346,15 @@ build_antennatracker() {
git submodule update
}
export BUILDROOT="$TMPDIR/binaries.build"
rm -rf $BUILDROOT
# make sure PX4 is rebuilt from scratch
pushd ArduPlane
make px4-clean || exit 1
popd
for d in ArduPlane ArduCopter APMrover2 AntennaTracker; do
pushd $d
make px4-clean || exit 1
popd
done
for build in stable beta latest; do
build_arduplane $build

75
Tools/scripts/build_ci.sh Executable file
View File

@ -0,0 +1,75 @@
#!/bin/bash
# useful script to test all the different build types that we support.
# This helps when doing large merges
# Andrew Tridgell, November 2011
set -ex
. ~/.profile
# CXX and CC are exported by default by travis
unset CXX CC
export BUILDROOT=/tmp/travis.build.$$
rm -rf $BUILDROOT
# If CI_BUILD_TARGET is not set, default to all of them
if [ -z "$CI_BUILD_TARGET" ]; then
CI_BUILD_TARGET="sitl linux navio raspilot minlure bebop px4-v2 px4-v4"
fi
declare -A build_platforms
declare -A build_concurrency
declare -A build_extra_clean
declare -A waf_supported_boards
build_platforms=(["ArduCopter"]="px4-v2 px4-v4")
build_concurrency=(["navio"]="-j2"
["raspilot"]="-j2"
["minlure"]="-j2"
["bebop"]="-j2"
["sitl"]="-j2"
["linux"]="-j2"
["px4-v2"]=""
["px4-v4"]="")
build_extra_clean=(["px4-v2"]="make px4-cleandep")
waf=modules/waf/waf-light
# get list of boards supported by the waf build
for board in $($waf list_boards | head -n1); do waf_supported_boards[$board]=1; done
echo "Targets: $CI_BUILD_TARGET"
for t in $CI_BUILD_TARGET; do
echo "Starting make based build for target ${t}..."
for v in ${!build_platforms[@]}; do
if [[ ${build_platforms[$v]} != *$t* ]]; then
continue
fi
echo "Building $v for ${t}..."
pushd $v
make clean
if [ ${build_extra_clean[$t]+_} ]; then
${build_extra_clean[$t]}
fi
make $t ${build_concurrency[$t]}
popd
done
if [[ -n ${waf_supported_boards[$t]} ]]; then
echo "Starting waf build for board ${t}..."
$waf configure --board $t
$waf clean
$waf ${build_concurrency[$t]} all
if [[ $t == linux ]]; then
$waf check
fi
fi
done
echo build OK
exit 0

View File

@ -6,7 +6,7 @@
set -e
set -x
targets="clean apm2"
targets="navio"
[ $# -gt 0 ] && {
targets="$*"
@ -16,6 +16,9 @@ export PATH=/usr/lib/ccache:$PATH
TESTS=$(find libraries -name 'Makefile' | grep -v FLYMAPLE | xargs -i dirname '{}')
export BUILDROOT="/tmp/examples.build"
rm -rf $BUILDROOT
for b in $TESTS; do
echo "TESTING $b"
pushd $b

66
Tools/scripts/configure-ci.sh Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
# Install dependencies and configure the environment for CI build testing
set -ex
PKGS="build-essential gawk ccache genromfs libc6-i386 \
python-argparse python-empy python-serial zlib1g-dev gcc-4.9 g++-4.9"
ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3"
ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2"
RPI_ROOT="master"
RPI_TARBALL="$RPI_ROOT.tar.gz"
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get -qq -y update
sudo apt-get -qq -y install $PKGS
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 90 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.9
pushd $HOME
mkdir -p $HOME/opt
pushd $HOME/opt
# PX4 toolchain
compiler=$ARM_ROOT
if [ ! -d "$HOME/opt/$compiler" ]; then
wget http://firmware.diydrones.com/Tools/PX4-tools/$ARM_TARBALL
tar -xf $ARM_TARBALL
fi
# RPi/BBB toolchain
compiler="tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64"
if [ ! -d "$HOME/opt/$compiler" ]; then
wget http://firmware.diydrones.com/Tools/Travis/NavIO/$RPI_TARBALL
tar -xf $RPI_TARBALL
fi
popd
mkdir -p $HOME/bin
# configure ccache
ln -s /usr/bin/ccache ~/bin/g++
ln -s /usr/bin/ccache ~/bin/gcc
ln -s /usr/bin/ccache ~/bin/arm-none-eabi-g++
ln -s /usr/bin/ccache ~/bin/arm-none-eabi-gcc
ln -s /usr/bin/ccache ~/bin/arm-linux-gnueabihf-g++
ln -s /usr/bin/ccache ~/bin/arm-linux-gnueabihf-gcc
exportline="export PATH=$HOME/bin:"
exportline="${exportline}:$HOME/opt/gcc-arm-none-eabi-4_9-2015q3/bin:"
exportline="${exportline}:$HOME/opt/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:"
exportline="${exportline}:\$PATH"
if grep -Fxq "$exportline" ~/.profile; then
echo nothing to do;
else
echo $exportline >> ~/.profile;
fi
. ~/.profile
popd

View File

@ -0,0 +1,238 @@
#!/bin/bash
src=$(realpath $(dirname $BASH_SOURCE)/../../)
base=$src/libraries
declare -A header_dirs
arg_verbose=false
arg_create_commits=false
usage(){
cat <<EOF
Usage: $(basename $BASH_SOURCE) [OPTIONS] [--] [<pathspec>...]
Fix includes of libraries headers in source files to be as the following:
- If the header is in the same directory the source belongs to, then the
notation #include "" is used with the path relative to the directory
containing the source.
- If the header is outside the directory containing the source, then we use
the notation #include <> with the path relative to libraries folder.
If pathspec is given then it's an argument passed directly to git-grep. See
git-grep(1) for more information on its format. In this case the changes will
apply only to files that match the pathspec. Otherwise changes will be made to
the entire repository.
The output is a log of the process.
OPTIONS:
-h,--help
Display this help message.
-v,--verbose
Not only log errors and warnings but also substitutions.
-c,--create-commits
Create commits in the end.
--commit
Assume that the user have run the substitutions beforehand - only
create the commits.
EOF
}
create_commits(){
for f in $(git diff-files --name-only); do
if [[ ${f%%/*} == "libraries" ]]; then
echo $f | sed "s,\(libraries/[^/]*\)/.*,\1,"
else
echo ${f%%/*}
fi
done | uniq | while read d; do
if [[ $d == libraries/* ]]; then
commit_base=${d#libraries/}
else
commit_base=$d
fi
cat >/tmp/commit_msg <<EOF
$commit_base: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:
- If the header is in the same directory the source belongs to, so the
notation '#include ""' is used with the path relative to the directory
containing the source.
- If the header is outside the directory containing the source, then we use
the notation '#include <>' with the path relative to libraries folder.
Some of the advantages of such approach:
- Only one search path for libraries headers.
- OSs like Windows may have a better lookup time.
EOF
git add -u $d
git commit -F /tmp/commit_msg
done
}
replace_include(){
local file=$1
local n=$2
local new_path=$3
local old_path=$4
local regex="\(#\s*include\s*\)[<\"].\+[>\"]"
[[ $new_path == $old_path ]] && return
$arg_verbose && echo "$file:$n: $old_path --> $new_path"
if ! sed -i "${n}s,$regex,\1$new_path," $file; then
echo Error on executing command: sed -i "${n}s,$regex,\1$new_path," $file >&2
kill -SIGINT $$
fi
}
fix_includes(){
local file=$1
local header=$2
local dirs=(${header_dirs[$header]})
local num_dirs=${#dirs[@]}
local regex="^\s*#\s*include\s*[<\"]\(.*/\)\?$header[>\"]"
grep -ahno $regex $file | while IFS=":" read n match; do
path=$(echo $match | sed "s/^\s*#\s*include\s*//g")
delim=${path:0:1}
path=${path:1:(${#path}-2)}
file_dir=$(realpath $(dirname $file))
if [[ $delim == "\"" ]]; then
localpath=$file_dir/$path
if [[ -f $localpath ]]; then
# verify if file is under to the file dir
localpath=$(realpath $localpath)
[[ $localpath == $file_dir* ]] && continue
# if not under file dir, check if $localpath is under $base
if [[ $localpath == $base* ]]; then
new_path=${localpath#$base/}
replace_include $file $n \<$new_path\> \"$path\"
continue
fi
fi
fi
match_count=0
possible_paths=()
for dir in "${dirs[@]}"; do
if [[ $dir/$header == *$path ]]; then
((match_count++))
new_path=$dir/$header
possible_paths[${#possible_paths[@]}]=$new_path
fi
done
if [[ $match_count -eq 0 ]]; then
echo "$file:$n: couldn't find a match for inclusion of $path"
elif [[ $match_count -eq 1 ]]; then
# check if included header is under file dir
if [[ -f $file_dir/$path ]]; then
new_path=\"$(realpath $file_dir/$path --relative-to $file_dir)\"
else
new_path=\<$new_path\>
fi
if [[ $delim == '"' ]]; then path=\"$path\"; else path=\<$path\>; fi
replace_include $file $n $new_path $path
else
echo "$file:$n: more than one match for inclusion of $path"
echo " possible paths:"
for p in "${possible_paths[@]}"; do
echo " $p"
done
fi
done
}
trap_reset_tree(){
echo
echo Process killed or interrupted! Reseting tree...
git -C $src reset --hard
exit 1
}
# parse args
while [[ -n $1 ]]; do
case "$1" in
-h|--help)
usage
exit 0
;;
-v|--verbose)
arg_verbose=true
;;
-c|--create-commits)
arg_create_commits=true
;;
--commit)
create_commits
exit $?
;;
--)
# remaining args are pathspecs
shift
break
;;
-*)
usage >&2
exit 1
;;
*)
# this and the remaining args are pathspecs
break
esac
shift
done
trap trap_reset_tree SIGINT SIGKILL
if ! git -C $src diff-files --quiet --exit-code; then
echo You have unstaged changes, please commit or stash them beforehand >&2
exit 1
fi
pushd $src > /dev/null
# collect all headers
git -C $base ls-files *.h > /tmp/headers
total=$(cat /tmp/headers | wc -l)
header_max_len=0
while read f; do
header=$(basename $f)
dir=$(dirname $f)
if [[ -z ${header_dirs[$header]} ]]; then
header_dirs[$header]=$dir
else
header_dirs[$header]+=" $dir"
fi
printf "\rCollecting header files paths... $((++i))/$total" >&2
[[ ${#header} -gt $header_max_len ]] && header_max_len=${#header}
done </tmp/headers
echo
total=${#header_dirs[@]}
i=0
for header in "${!header_dirs[@]}"; do
regex="#\s*include\s*[<\"]\(.*/\)\?$header[>\"]"
printf "\r($((++i))/$total) Fixing includes for header %-${header_max_len}s" $header >&2
# for each file that includes $header
git grep -l $regex -- "$@" | while read f; do
fix_includes $f $header
done
done
$arg_create_commits && create_commits
popd > /dev/null

View File

@ -0,0 +1,83 @@
#!/bin/bash
set -e
command -v yaourt >/dev/null 2>&1 || { echo >&2 "Please install yaourt first. Aborting."; exit 1; }
CWD=$(pwd)
OPT="/opt"
BASE_PKGS="wget curl base-devel git-core tk gsfonts"
SITL_PKGS="python2-pip python-pip wxpython2.8 opencv python2-numpy python2-scipy ccache"
PX4_PKGS="lib32-glibc zip zlib ncurses"
PYTHON2_PKGS="pymavlink MAVProxy droneapi argparse matplotlib pyparsing catkin_pkg"
PYTHON3_PKGS="pyserial empy"
ARCH_AUR_PKGS="genromfs"
# GNU Tools for ARM Embedded Processors
# (see https://launchpad.net/gcc-arm-embedded/)
ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3"
ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2"
ARM_TARBALL_URL="http://firmware.diydrones.com/Tools/PX4-tools/$ARM_TARBALL"
# Ardupilot Tools
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
function prompt_user() {
read -p "$1"
if [[ $REPLY =~ ^[Yy]$ ]]; then
return 0
else
return 1
fi
}
sudo usermod -a -G uucp $USER
sudo pacman -S --noconfirm $BASE_PKGS $SITL_PKGS $PX4_PKGS
sudo pip2 -q install $PYTHON2_PKGS
sudo pip3 -q install $PYTHON3_PKGS
yaourt -S --noconfirm $ARCH_AUR_PKGS
(
cd /usr/lib/ccache
sudo ln -s /usr/bin/ccache arm-none-eabi-g++
sudo ln -s /usr/bin/ccache arm-none-eabi-gcc
)
if [ ! -d $OPT/$ARM_ROOT ]; then
(
cd $OPT;
sudo wget $ARM_TARBALL_URL;
sudo tar xjf ${ARM_TARBALL};
sudo rm ${ARM_TARBALL};
)
fi
exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";
if ! grep -Fxq "$exportline" ~/.bashrc ; then
if prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [Y/n]?" ; then
echo "$exportline" >> ~/.bashrc
. ~/.bashrc
else
echo "Skipping adding $OPT/$ARM_ROOT/bin to PATH."
fi
fi
exportline2="export PATH=$CWD/$ARDUPILOT_TOOLS:\$PATH";
if ! grep -Fxq "$exportline2" ~/.bashrc ; then
if prompt_user "Add $CWD/$ARDUPILOT_TOOLS to your PATH [Y/n]?" ; then
echo "$exportline2" >> ~/.bashrc
. ~/.bashrc
else
echo "Skipping adding $CWD/$ARDUPILOT_TOOLS to PATH."
fi
fi
(
cd ./ardupilot
git submodule init
git submodule update
)
echo "Done. Please log out and log in again."

View File

@ -5,20 +5,19 @@ CWD=$(pwd)
OPT="/opt"
BASE_PKGS="gawk make git arduino-core curl"
SITL_PKGS="g++ python-pip python-matplotlib python-serial python-wxgtk2.8 python-scipy python-opencv python-numpy python-pyparsing ccache"
AVR_PKGS="gcc-avr binutils-avr avr-libc"
PYTHON_PKGS="pymavlink MAVProxy droneapi"
SITL_PKGS="g++ python-pip python-matplotlib python-serial python-wxgtk2.8 python-scipy python-opencv python-numpy python-pyparsing ccache realpath"
PYTHON_PKGS="pymavlink MAVProxy droneapi catkin_pkg"
PX4_PKGS="python-serial python-argparse openocd flex bison libncurses5-dev \
autoconf texinfo build-essential libftdi-dev libtool zlib1g-dev \
zip genromfs"
zip genromfs python-empy"
BEBOP_PKGS="g++-arm-linux-gnueabihf"
UBUNTU64_PKGS="libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386"
ASSUME_YES=false
# GNU Tools for ARM Embedded Processors
# (see https://launchpad.net/gcc-arm-embedded/)
ARM_ROOT="gcc-arm-none-eabi-4_7-2014q2"
ARM_TARBALL="$ARM_ROOT-20140408-linux.tar.bz2"
ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3"
ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2"
ARM_TARBALL_URL="http://firmware.diydrones.com/Tools/PX4-tools/$ARM_TARBALL"
# Ardupilot Tools
@ -59,7 +58,7 @@ sudo usermod -a -G dialout $USER
$APT_GET remove modemmanager
$APT_GET update
$APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS $BEBOP_PKGS $UBUNTU64_PKGS $AVR_PKGS
$APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS $BEBOP_PKGS $UBUNTU64_PKGS
sudo pip2 -q install $PYTHON_PKGS
if [ ! -d $OPT/$ARM_ROOT ]; then

159
eclipse.cproject Normal file
View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.cross.base.354374513">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.354374513" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.cross.base.354374513" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.354374513.892177930" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.526035570" name="cdt.managedbuild.toolchain.gnu.cross.base" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
<option id="cdt.managedbuild.option.gnu.cross.prefix.458442836" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
<option id="cdt.managedbuild.option.gnu.cross.path.1219552670" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.737405680" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder id="cdt.managedbuild.builder.gnu.cross.778361658" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.768396405" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.281326927" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1282124949" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1533331666" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1121841264" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1530575069" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1550437110" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1425628759" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.941717398" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.968458728" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="ardupilot.null.967258070" name="ardupilot"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="px4-v2" path="ArduCopter" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>px4-v2</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-cleandep" path="ArduCopter" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>px4-cleandep</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="ArduCopter" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-clean" path="ArduCopter" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>px4-clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-v2" path="ArduPlane" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>px4-v2</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="ArduPlane" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-clean" path="ArduPlane" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>px4-clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-cleandep" path="ArduPlane" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>px4-cleandep</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-v2" path="AntennaTracker" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>px4-v2</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-v2" path="APMrover2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>px4-v2</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="APMrover2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-clean" path="APMrover2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>px4-clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="px4-cleandep" path="APMrover2" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>px4-cleandep</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cproject>

Some files were not shown because too many files have changed in this diff Show More