Commit Graph

19387 Commits

Author SHA1 Message Date
Caio Marcelo de Oliveira Filho cd7cfdef91 AP_Compass: examples use millis/micros/panic functions 2015-11-20 12:30:20 +09:00
Caio Marcelo de Oliveira Filho 86954cda0e AP_CompassCalibrator: use millis/micros/panic functions 2015-11-20 12:30:14 +09:00
Caio Marcelo de Oliveira Filho 0d3fbbdd37 AP_Compass: use millis/micros/panic functions 2015-11-20 12:30:05 +09:00
Caio Marcelo de Oliveira Filho 89d6acaeaa AP_BoardConfig: use millis/micros/panic functions 2015-11-20 12:29:58 +09:00
Caio Marcelo de Oliveira Filho 3b4e18043b AP_BattMonitor: examples use millis/micros/panic functions 2015-11-20 12:29:52 +09:00
Caio Marcelo de Oliveira Filho 9eb945d24f AP_BattMonitor: use millis/micros/panic functions 2015-11-20 12:29:45 +09:00
Caio Marcelo de Oliveira Filho 8cce3067f4 AP_Baro: examples use millis/micros/panic functions 2015-11-20 12:29:38 +09:00
Caio Marcelo de Oliveira Filho 5a280838f8 AP_Baro: use millis/micros/panic functions 2015-11-20 12:29:31 +09:00
Caio Marcelo de Oliveira Filho b8f0beab83 AP_Arming: use millis/micros/panic functions 2015-11-20 12:29:24 +09:00
Caio Marcelo de Oliveira Filho 410bbe4c26 AP_Airspeed: examples use millis/micros/panic functions 2015-11-20 12:29:16 +09:00
Caio Marcelo de Oliveira Filho 2b10e0fac0 AP_Airspeed: use millis/micros/panic functions 2015-11-20 12:29:07 +09:00
Caio Marcelo de Oliveira Filho 3a17c858e3 AP_AHRS: use millis/micros/panic functions 2015-11-20 12:29:00 +09:00
Caio Marcelo de Oliveira Filho 4ea45b8df1 AP_AHRS_NavEKF: use millis/micros/panic functions 2015-11-20 12:28:53 +09:00
Caio Marcelo de Oliveira Filho 55e61538b3 AP_AHRS_DCM: use millis/micros/panic functions 2015-11-20 12:28:45 +09:00
Caio Marcelo de Oliveira Filho b293fb150c AP_ADC: use millis/micros/panic functions 2015-11-20 12:28:36 +09:00
Caio Marcelo de Oliveira Filho b331ffdd91 APM_OBC: use millis/micros/panic functions 2015-11-20 12:28:28 +09:00
Caio Marcelo de Oliveira Filho fe718a6ce8 APM_Control: use millis/micros/panic functions 2015-11-20 12:28:20 +09:00
Caio Marcelo de Oliveira Filho e867a06383 AC_WPNav: use millis/micros/panic functions 2015-11-20 12:28:13 +09:00
Caio Marcelo de Oliveira Filho 70d0ea9151 AC_Sprayer: use millis/micros/panic functions 2015-11-20 12:28:04 +09:00
Caio Marcelo de Oliveira Filho ccd03bcf60 AC_Fence: use millis/micros/panic functions 2015-11-20 12:27:11 +09:00
Caio Marcelo de Oliveira Filho ea08b6115d AC_AttControl: use millis/micros/panic functions 2015-11-20 12:27:03 +09:00
Caio Marcelo de Oliveira Filho 071d8e541e Replay: use millis/micros/panic functions 2015-11-20 12:26:55 +09:00
Caio Marcelo de Oliveira Filho ee7e3e34c0 Tools: CPUInfo use millis/micros/panic functions 2015-11-20 12:26:48 +09:00
Caio Marcelo de Oliveira Filho c8888329e1 Plane: use millis/micros/panic functions 2015-11-20 12:26:40 +09:00
Caio Marcelo de Oliveira Filho c7acc46d09 Copter: use millis/micros/panic functions 2015-11-20 12:26:31 +09:00
Caio Marcelo de Oliveira Filho dd3fb0a689 Tracker: use millis/micros/panic functions 2015-11-20 12:26:23 +09:00
Caio Marcelo de Oliveira Filho ee073787c8 Rover: use millis/micros/panic functions
Instead of going through 'hal' then 'scheduler', use directly the AP_HAL
functions. Besides removing indirection that is not necessary for such
functions, this patch ends up reducing the code size in the call sites.

For example, building ArduCopter for PX4 with this change (compared to
before introduction of the functions) yields almost 3k bytes of code
size.

    # ArduCopter build before the functions (1b29a1af46)
       text	   data	    bss	    dec	    hex	filename
     895264	   2812	  62732	 960808	  ea928	/.../px4fmu-v2_APM.build/firmware.elf

    # ArduCopter build after this patch
       text	   data	    bss	    dec	    hex	filename
     892264	   2812	  62732	 957808	  e9d70	/.../px4fmu-v2_APM.build/firmware.elf

A later patch will remove the unused functions in the Schedulers.
2015-11-20 12:26:14 +09:00
Caio Marcelo de Oliveira Filho 7662c2e73f AP_HAL_VRBRAIN: implement new AP_HAL functions
Implement the new AP_HAL functions and use them in the Scheduler when
possible.
2015-11-20 12:25:42 +09:00
Caio Marcelo de Oliveira Filho 79721feb14 AP_HAL_FLYMAPLE: implement new AP_HAL functions
Implement the new AP_HAL functions and use them in the Scheduler when
possible.

Because the functions are in a namespace, there's no need to do the
define/undef trick and avoid the globals millis() and micros() provided
by libmaple.
2015-11-20 12:25:41 +09:00
Caio Marcelo de Oliveira Filho 8db8b9b355 AP_HAL_PX4: implement new AP_HAL functions
Implement the new AP_HAL functions and use them in the Scheduler when
possible.
2015-11-20 12:25:40 +09:00
Caio Marcelo de Oliveira Filho ff016c4b5a AP_HAL_Linux: implement new AP_HAL functions
Implement the new AP_HAL functions and use them in the Scheduler when
possible.

The '_sketch_start_time' was renamed and moved as a detail of
implementation of the functions code. It allows the code to return time
starting from zero.

The 'stopped_clock_usec' was renamed to follow convention in the file
and add a getter so that AP_HAL functions can reach it. It's not a
problem this getter is public because in practice, regular code
shouldn't even access the Linux::Scheduler directly -- only code that
should is from Linux implementation.
2015-11-20 12:25:39 +09:00
Caio Marcelo de Oliveira Filho 3ef77617fd AP_HAL_SITL: implement new AP_HAL functions
Implement the new AP_HAL functions and use them in the Scheduler when
possible.

The '_sketch_start_time' was renamed and moved as a detail of
implementation of the functions code. It allows the code to return time
starting from zero.

The 'stopped_clock_usec' was renamed to follow convention in the file
and add a getter so that AP_HAL functions can reach it. It's not a
problem this getter is public because in practice, regular code
shouldn't even access the SITLScheduler directly -- only code that
should is from SITL itself.
2015-11-20 12:25:38 +09:00
Caio Marcelo de Oliveira Filho efbc7648b1 AP_HAL: create AP_HAL namespace and use for some HAL functionality
For certain basic functionality, there aren't much benefit to be able to
vary the implementation easily at runtime. So instead of using virtual
functions, use regular functions that are "resolved" at link time. The
implementation of such functions is provided per board/platform.

Examples of functions that fit this include: getting the current
time (since boot), panic'ing, getting system information, rebooting.

These functions are less likely to benefit from the indirection provided
by virtual interfaces. For more complex hardware access APIs the
indirection makes more sense and ease the testing (when we have it!).

The idea is that instead of calling

    hal.scheduler->panic("on the streets of london");

now use

    AP_HAL::panic("on the streets of london");

A less important side-effect is that call-site code gets
smaller. Currently the compiler needs to get the hal, get the scheduler
pointer, get the right function pointer in the vtable for that
scheduler. And the call must include an extra parameter ("this"). Now it
will be just a function call, with the address resolved at link time.

This patch introduces the first functions that will be in the namespace,
further patches will implementations for each board and then switch the
call-sites. The extra init() function allow any initial setup needed for
the functions to work.
2015-11-20 12:25:24 +09:00
Randy Mackay 50e3c2ce3a Copter: minor comment updates
No functional change
2015-11-18 22:12:44 +09:00
bugobliterator 945bdee452 Copter: PILOT_VELZ_MAX and PILOT_ACCEL_Z take effect immediately 2015-11-18 22:12:41 +09:00
Jonathan Challinger f9c7f15052 AC_WPNav: WPNAV_LOIT_SPEED WPNAV_LOIT_MAXA take effect immediately 2015-11-18 22:12:39 +09:00
Randy Mackay 674bedd867 Copter: acro sets alt target to zero for reporting 2015-11-18 21:48:34 +09:00
Jonathan Challinger a5e4f64b20 Copter: refuse to enter manual throttle modes while landed with throttle high 2015-11-18 21:48:27 +09:00
Paul Riseborough ff2782b790 AP_NavEKF2: Parameter changes to reduce noise on gyro bias estimates 2015-11-18 20:17:03 +09:00
Paul Riseborough 2193103586 AP_NavEKF: Reduce time to switch after an IMU fault
This revised threshold value is still double the maximum that has been observed in flight logs so far with healthy sensors
The previous value was too slow to switch for sudden IMU gyro faults
We can afford an ocasional false trigger becasue the front end will only select another instance if it is healthy and has lower errors
2015-11-18 20:17:00 +09:00
Paul Riseborough 20798316e1 AP_NavEKF2: fix bug in performance timer 2015-11-18 20:16:58 +09:00
Randy Mackay b2b8dcb8ff Copter: guided calls velocity controller at 400hz
velocity controller internally updates xy-axis at 50hz, z-axis at 400hz
2015-11-18 13:31:22 +09:00
Randy Mackay c9340dbeb6 AC_PosControl: run velocity controller z-axis at 400hz 2015-11-18 13:31:21 +09:00
Randy Mackay dbc8ce1d69 AC_PosControl: default z-axis controller to 400hz
No functional change as vehicle code always sets it explicitely
2015-11-18 13:31:20 +09:00
Randy Mackay 323a527734 AC_PosControl: velocity controller uses feed-forward althold 2015-11-18 13:31:19 +09:00
Randy Mackay 4b41710261 AC_AttControl: minor comment fix 2015-11-18 13:31:18 +09:00
Caio Marcelo de Oliveira Filho a348424551 AP_HAL: remove unused function
This was used by APM1/2 that were removed.
2015-11-18 11:50:56 +09:00
Andrew Tridgell 5561efde2b AP_NavEKF: we can assume get_sample_rate() returns a non-zero number
this fixes a build error with the previous patch
2015-11-18 11:48:50 +11:00
Paul Riseborough e32e6cfa67 AP_NavEKF: Protect against bad delta time from the INS library
Prevent arithmetic divide by zero exceptions and handle invalid delta time in a consistent way by setting invalid times to the average.
2015-11-18 11:43:40 +11:00
Paul Riseborough 2fb5a4489b AP_NavEKF2: Prevent airspeed faults from causing excessive loss of accuracy 2015-11-18 11:39:54 +11:00