Commit Graph

7464 Commits

Author SHA1 Message Date
Jonathan Challinger 2053d5e42e GCS_MAVlink: add GIMBAL_ and GOPRO_ messages 2015-04-21 21:40:05 +09:00
Randy Mackay 87e6452ee9 Mission: bug fix when jump target is zero
This would result in copter flying to a waypoint high above home
2015-04-21 20:42:49 +09:00
Andrew Tridgell a0969905ce AP_AHRS: make get_error_rp() and get_error_yaw() const
this makes them usable by multiple consumers, and allows use by EKF
2015-04-21 21:42:17 +10:00
Andrew Tridgell 2dfe3cb844 DataFlash: added a perf counter for microSD overruns
this allows us to tell if a microSD can handle a high logging rate
2015-04-21 20:45:30 +10:00
Andy Piper b0937154f5 DataFlash: log compass health
This patch simply logs the health of each compass for easy diagnosis.
2015-04-21 13:18:24 +09:00
Andrew Tridgell c153d31dd2 DataFlash: speed up DataFlash in Replay 2015-04-21 10:14:41 +10:00
Andrew Tridgell dcb25632fb AP_Compass: removed old setHIL compass offset 2015-04-21 08:30:05 +10:00
Andrew Tridgell a4bad1c703 HAL_SITL: use SIM_MAG_OFS in SITL compass 2015-04-21 08:29:51 +10:00
Andrew Tridgell 1ce9cb693a SITL: added SIM_MAG_OFS for setting compass offsets in SITL 2015-04-21 08:29:27 +10:00
Andrew Tridgell 179e47c618 HAL_Linux: prevent time from going backwards in Replay 2015-04-20 15:12:51 +10:00
Andrew Tridgell d7000c4105 AP_Compass: fixed compass timestamps in Replay 2015-04-20 15:12:51 +10:00
Randy Mackay 337a94e52e Camera: remove empty configure_msg method 2015-04-20 13:50:15 +09:00
Randy Mackay d456b97fd2 Camera: control_cmd triggers pic 2015-04-20 13:50:12 +09:00
Jaime Machuca 38491c4ff7 Camera: fix mission cmds sending msgs to components
mission commands were triggering the sending of
mavlink mission items when they should have been sending
command long messages
2015-04-20 13:50:10 +09:00
Randy Mackay 4eb3263653 Camera: mission cmds send do-digicam msgs to components
This allows digicam-control and digicam-configure mission
command to trigger sending the equivalent mavlink messages
to components
2015-04-20 13:50:08 +09:00
Randy Mackay 8dcd555037 Camera: trigger_pic sends do-digicam-control to components
This (optionally) allows pictures triggered from ch7/ch8
switch to send a mavlink do-digicam-control message to
components
2015-04-20 13:50:06 +09:00
Randy Mackay 1f705eb6a3 GCS_MAVLink: add send_to_components method 2015-04-20 13:50:04 +09:00
Randy Mackay 888c2289ce Mission: support do-digicam-control parameters 2015-04-20 13:50:01 +09:00
Peter Barker c95348c1d9 SITL: Avoid run-time FPEs due to bad gyro settings if SIM_DRIFT_TIME is set to 0
_gyro_drift essentially suffers a divide-by-zero if SIM_DRIFT_TIME is 0.  The gyro initialisation routines in AP_InertialSensor do not return once the generated NaN propogates back to them.
2015-04-19 07:24:45 +10:00
Jonathan Challinger 12957867fd AC_PosControl: fix thr twitch when changing modes 2015-04-18 12:38:44 +09:00
Randy Mackay 44d2ae06fb Mount: unix style line endings 2015-04-17 22:59:34 +09:00
Randy Mackay 06ea18f97e Filter: fix LPF example sketch 2015-04-17 22:54:06 +09:00
Randy Mackay 99a9a88529 Filter: dt check fix for LPF 2015-04-17 10:59:03 +09:00
Jonathan Challinger f20a91ec95 Filter: add dt<0 check to LPF 2015-04-17 10:47:06 +09:00
Randy Mackay 22e1156c31 Filter: add some comments to LowPassFilter 2015-04-17 10:47:04 +09:00
Jonathan Challinger 738b1967ad AC_PosControl: use LowPassFilterVector2f 2015-04-17 10:47:01 +09:00
Jonathan Challinger 8f667b3d1c AC_PosControl: fix up comments 2015-04-17 10:46:59 +09:00
Jonathan Challinger 4993fd4d71 AP_Motors: use new lowpass filter 2015-04-17 10:46:47 +09:00
Jonathan Challinger 87500d9d70 AC_AttitudeControl: use new lowpass filter 2015-04-17 10:46:45 +09:00
Jonathan Challinger 76da2868d0 Filter: rework LowPassFilter 2015-04-17 10:46:42 +09:00
Leonard Hall c2a6a0a9e2 AC_PosControl: add accel filter parameter 2015-04-16 21:00:45 +09:00
Leonard Hall a632a57d79 AC_PosControl: accessors to log z-axis vel and accel 2015-04-16 21:00:32 +09:00
Leonard Hall 0aca3c4be6 AC_PosControl: add relax Alt Hold controllers 2015-04-16 21:00:25 +09:00
Leonard Hall 24b8d32b0e AC_AttitudeControl: add comment 2015-04-16 21:00:22 +09:00
Leonard Hall 7cb3c4ba39 AC_PosControl: add feed forward to Alt Hold 2015-04-16 21:00:20 +09:00
Randy Mackay a1e6a3ee32 AC_PosControl: minor format fix 2015-04-16 21:00:14 +09:00
Jonathan Challinger 3e0dab7b2d AC_PosControl: remove accel error filter and set throttle output filter instead 2015-04-16 21:00:07 +09:00
Jonathan Challinger b7f7624aac AC_AttitudeControl: add throttle filter cutoff parameter to set_throttle_out functions 2015-04-16 21:00:04 +09:00
Jonathan Challinger e80776f1f5 AP_Motors: remove MOT_THR_FILT parameter and add interface to configure filter 2015-04-16 21:00:01 +09:00
Jonathan Challinger 518e798f53 AC_AttitudeControl: rework angle_boost 2015-04-16 20:59:58 +09:00
Jonathan Challinger 7abd02baf2 AC_PosControl: change int32/int16 to float in accel_to_throttle 2015-04-16 20:59:55 +09:00
Jonathan Challinger d14893fcd5 AC_PosControl: don't limit throttle any more 2015-04-16 20:59:51 +09:00
Jonathan Challinger f3555d0d43 AC_AttitudeControl: modify throttle interface to specify stabilization 2015-04-16 20:59:45 +09:00
Jonathan Challinger 5c2341009a AC_AttitudeControl: throttle is a float 2015-04-16 20:59:42 +09:00
Jonathan Challinger 8e442675a7 AP_Motors: introduce set_stabilize(bool), specifies whether torque demands should be output 2015-04-16 20:59:40 +09:00
Jonathan Challinger bc2afb31dd AP_Motors: virtual not necessary in child class 2015-04-16 20:59:37 +09:00
Jonathan Challinger a2c69fe90d AP_Motors: add optional motor output throttle filter 2015-04-16 20:59:31 +09:00
Leonard Hall 4d9da2720b AC_AttitudeControl: add get for angle bf errors 2015-04-16 13:29:52 +09:00
Leonard Hall 88be3d67e7 AP_Motors: add get for throttle comp 2015-04-16 13:29:50 +09:00
Leonard Hall 791fbcf9b3 AP_Motors_Class: time constants of throttle comp 2015-04-16 13:29:46 +09:00
Michael du Breuil 04e9141881 AP_TECS: Allow tecs to control throttle during takeoff 2015-04-16 08:56:37 +10:00
Michael du Breuil a9fc2b8a32 AP_Vehicle: Moved takeoff_throttle_max into plane parameters 2015-04-16 08:56:36 +10:00
Andrew Tridgell 4586de6637 AP_NavEKF: enable optimisation in Linux build
only really need debugging for SITL
2015-04-16 08:36:16 +10:00
Leonard Hall 48fb487a8c AC_AttitudeControl: Formatting fix 2015-04-15 22:04:27 +09:00
Paul Riseborough dffa2e19bf AP_NavEKF: Make copter glitch accel consistent with timeout and radius 2015-04-15 17:32:48 +09:00
Paul Riseborough 5d70854c08 AP_NavEKF: Fix minor bug in calculation of innovation variance
the innovation variance for GPS should be the sum of squares of the state and measurement uncertainty.
2015-04-15 17:32:46 +09:00
Paul Riseborough 1008c6390c AP_NavEKF: Fail absolute position status if GPS repeatedly rejected 2015-04-15 17:32:44 +09:00
Paul Riseborough 77d3798278 AP_NavEKF: Reduce recovery time after a GPS fusion timeout 2015-04-15 17:32:41 +09:00
Paul Riseborough 0852aeab6e AP_NavEKF: Allow raw innovations to be monitored during timeouts 2015-04-15 17:32:39 +09:00
Paul Riseborough d3f4b4a02b AP_NavEKF: Fix name consistency for data check time stamps 2015-04-15 17:32:36 +09:00
Jonathan Challinger 6ea91d012e AC_PID: calculate filt_alpha every time the filter is run 2015-04-14 16:19:02 +09:00
Randy Mackay f06c859d93 AC_Fence: add comment re check_fence method 2015-04-14 16:10:09 +09:00
Jonathan Challinger 05fda4ee4c AC_Fence: accept curr_alt parameter instead of getting alt from inav 2015-04-14 16:10:07 +09:00
Jonathan Challinger f06cc5d0c1 AC_Fence: change inav to const reference 2015-04-14 16:10:02 +09:00
Staroselskii Georgii dff430e136 AP_HAL_Linux: added UART port for second GPS 2015-04-14 15:59:34 +10:00
Staroselskii Georgii da6316ed4c AP_HAL_Linux: fixed TCP client connection in LinuxUARTDriver 2015-04-14 15:59:33 +10:00
Randy Mackay 39213584da AC_WPNav: minor comment and formatting changes 2015-04-14 14:50:58 +09:00
Jonathan Challinger fd55068620 AC_WPNav: fix double-twitch on stop in loiter 2015-04-14 14:50:55 +09:00
Jonathan Challinger 1da410a6c6 AC_WPNav: allow user to tune loiter 2015-04-14 14:50:53 +09:00
mirkix 13ee34c58a AP_InertialSensor: MPU9150 fix compiler warnings 2015-04-14 11:14:48 +10:00
Staroselskii Georgii 4a3e61f4e4 AP_GPS: turn UBlox autodetection only for NavIO 2015-04-14 10:45:49 +10:00
Staroselskii Georgii 716fd56c62 AP_HAL_Linux: added support for dynamic speed configration in LinuxSPIUARTDriver 2015-04-14 10:45:49 +10:00
Staroselskii Georgii 47a336d192 AP_GPS: added Ublox' hardware generation autodetection 2015-04-14 10:45:49 +10:00
Staroselskii Georgii baf2b4da4e AP_HAL_Linux: renamed AnalogIn_Navio 2015-04-14 10:16:26 +10:00
Mikhail Avkhimenia 7ba6a5e346 AP_HAL: Specify terrain directory for Navio 2015-04-14 10:16:25 +10:00
Staroselskii Georgii 930aeaf556 AP_HAL_Linux: add RPi version runtime detection 2015-04-14 10:16:25 +10:00
Mikhail Avkhimenia c11304ba7a AP_HAL_Linux: change GPIO register address for Raspberry Pi 2 2015-04-14 10:16:25 +10:00
Staroselskii Georgii 641fa05028 AP_HAL_Linux: added buffering in RCOutput_Navio 2015-04-14 10:16:25 +10:00
Staroselskii Georgii e6c2977da2 AP_HAL_Linux: fixed style in RCOutput_Navio 2015-04-14 10:16:25 +10:00
Staroselskii Georgii 024825f95a AP_HAL_Linux: fixed PCA9685 initialization for RCOutput_Navio 2015-04-14 10:16:25 +10:00
Staroselskii Georgii 2a137b6ea9 AP_HAL_Linux: fixed RCInput initialization on NavIO 2015-04-14 10:16:24 +10:00
Sean O\'Brien 6474aa2477 AP_HAL_AVR_SITL: added sensor delays to sitl. 2015-04-14 10:10:38 +10:00
Sean O\'Brien bfba8870e2 AP_HAL_AVR_SITL: added sensor delays to sitl. 2015-04-14 10:10:35 +10:00
Lucas De Marchi b292873304 AP_InertialSensor: fix starvation in L3G4200D
The main thread would always be blocked on the semaphore to read the
data from accelerometer and gyroscope. Especially if we have a slow
update of these values in _accumulate() due to the I2C transfer function
taking too much time: the timer thread would never give up the CPU,
causing starvation on the main thread.

This fixes the issue by reducing the critical region using a flip-buffer
so _accumulate() can work on its own copy of the data. Now that the
critical region is smaller, also avoid the semaphore and use a spinlock
instead.
2015-04-14 10:01:47 +10:00
Andrew Tridgell b17878c8c4 SITL: lower default GPS delay to 0.2 seconds
this matches typical uBlox
2015-04-14 09:57:47 +10:00
Andrew Tridgell d7249cc1e6 AP_AHRS: only use EKF for plane and rover if all data available
we need position and velocity to be working for plane and rover
2015-04-14 09:57:45 +10:00
Lucas De Marchi 996739df12 AP_Compass: Do not panic if compass is not found
Copter uses 2 compasses for linux configuration, but one of them may not
be available. Do not panic if a AK8963 isn't found.
2015-04-14 09:29:12 +10:00
Gustavo Jose de Sousa be67b019a7 AP_GPS: Add missing setup for GPS_AUTO_test
GPS_AUTO_test was missing some setup lines.
2015-04-14 09:27:41 +10:00
Andrew Tridgell 7f7d92913e HAL_Linux: allow running as non-root
this is needed for Replay, plus is very useful for debugging
2015-04-14 09:25:35 +10:00
Lucas De Marchi f049c8e4c5 AP_HAL_Linux: remove needless call to mlockall()
All threads share the same address space and have the same pages locked
into memory so it's not necessary to call mlockall() for each of them.

Grepping /proc/<tid>/status gives the same VmLck for all of them, even
when only the main thread locks the memory:

    # for i in `seq 477 482`; do \
	name=$(cat /proc/$i/comm); \
	vm=$(cat /proc/$i/status |grep VmLck); \
        echo -e "$name\t$vm"; \
    done
    ArduCopter.elf  VmLck:     57868 kB
    sched-timer     VmLck:     57868 kB
    sched-uart      VmLck:     57868 kB
    sched-rcin      VmLck:     57868 kB
    sched-tonealarm VmLck:     57868 kB
    sched-io        VmLck:     57868 kB
2015-04-14 09:17:21 +10:00
Lucas De Marchi b7355dc62b AP_HAL_Linux: set thread name for ease debug
Use pthread_setname_np() to set thread name so it's easier to debug
what't going on with each of them. This is the example output of the
relevant par of "ps -Leo class,rtprio,wchan,comm":

FF      12 futex_ ArduCopter.elf
FF      15 usleep sched-timer
FF      14 hrtime sched-uart
FF      13 poll_s sched-rcin
FF      11 hrtime sched-tonealarm
FF      10 hrtime sched-io
2015-04-14 09:17:21 +10:00
Lucas De Marchi 2c48434110 AP_HAL_Linux: use a table to initialize threads
Refactor function calls into a table and pass in the name so it can be
used in error message.
2015-04-14 09:17:21 +10:00
Lucas De Marchi e3d78b8960 AP_HAL_Linux: fix passing callback to member function
It's undefined behavior to pass the callback to pthread to a class
member like we were doing. Refactor the code so the callbacks are static
members.

This fixes the following warnings:

libraries/AP_HAL_Linux/Scheduler.cpp: In member function 'virtual void Linux::LinuxScheduler::init(void*)':
/home/lucas/p/dronecode/ardupilot/libraries/AP_HAL_Linux/Scheduler.cpp:61:76: warning: converting from 'void* (Linux::LinuxScheduler::*)()' to 'Linux::LinuxScheduler::pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
                            (pthread_startroutine_t)&Linux::LinuxScheduler::_timer_thread);
                                                                            ^
libraries/AP_HAL_Linux/Scheduler.cpp:65:76: warning: converting from 'void* (Linux::LinuxScheduler::*)()' to 'Linux::LinuxScheduler::pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
                            (pthread_startroutine_t)&Linux::LinuxScheduler::_uart_thread);
                                                                            ^
libraries/AP_HAL_Linux/Scheduler.cpp:69:76: warning: converting from 'void* (Linux::LinuxScheduler::*)()' to 'Linux::LinuxScheduler::pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
                            (pthread_startroutine_t)&Linux::LinuxScheduler::_rcin_thread);
                                                                            ^
libraries/AP_HAL_Linux/Scheduler.cpp:73:76: warning: converting from 'void* (Linux::LinuxScheduler::*)()' to 'Linux::LinuxScheduler::pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
                            (pthread_startroutine_t)&Linux::LinuxScheduler::_tonealarm_thread);
                                                                            ^
libraries/AP_HAL_Linux/Scheduler.cpp:77:76: warning: converting from 'void* (Linux::LinuxScheduler::*)()' to 'Linux::LinuxScheduler::pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
                            (pthread_startroutine_t)&Linux::LinuxScheduler::_io_thread);
2015-04-14 09:17:20 +10:00
Lucas De Marchi 62c2f737d5 AP_HAL_Linux: fix setting RT priorities
LinuxScheduler::init() was not really working as it should. This was the
result of "ps -Leo class,rtprio,wchan,comm | grep ArduCopter":

FF      12 futex_ ArduCopter.elf
FF      12 usleep ArduCopter.elf
FF      12 hrtime ArduCopter.elf
FF      12 poll_s ArduCopter.elf
FF      12 hrtime ArduCopter.elf
FF      12 hrtime ArduCopter.elf

As can be seen all the threads run with the same priority, the one of the main
thread. There were basically 2 mistakes:

	1) pthread_attr_setschedpolicy() needs to be called before
	   pthread_attr_setschedparam(). Otherwise the latter will just return
	   an error and not set the priority

	2) pthread_create() defaults to ignore the priority and inherit the
	   it from the parent thread. pthread_attr_setinheritsched() needs to
	   be called to change the behavior to PTHREAD_EXPLICIT_SCHED. See
	   pthread_attr_setinheritsched(3) for an example program to test the
	   behaviors.

Also, it's undefined behavior to call pthread_attr_init() several times on the
same pthread_attr_t. Although we could reutilize the same attribute without
calling  pthread_attr_init() again, lets refactor the code a little bit, so all
the pthread calls are in a single place. Then also call pthread_attr_destroy()
when we are done.
2015-04-14 09:17:20 +10:00
Lucas De Marchi 29b667efdf AP_HAL_Linux: remove useless mlock of stack
In Linux the default stack size is always greater than 32k, either 2MB
or 8MB depending on the architecture. There's no point in creating a
function to lock 32k.
2015-04-14 09:17:20 +10:00
Randy Mackay e2071a4630 Notify: ToneAlarm fix to stopping continuous tones 2015-04-13 17:44:45 +09:00
Randy Mackay 2472702838 Notify: rename lost_copter to vehicle_lost 2015-04-13 17:44:44 +09:00
Jaime Machuca 043d24f03a Notify: add Lost Copter tone 2015-04-13 17:42:07 +09:00
Andrew Tridgell 0695277773 HAL_SITL: use pthread barriers for synthetic clock synchronisation
this avoids siganls and provides a race free way of keeping time in
lock step
2015-04-13 06:05:55 +10:00
Paul Riseborough e79ccf1fcc AP_NavEKF: Fix bug allowing terrain to be above vehicle position
The terrain state and vehicle state need to be compared at the same time horizon.
2015-04-11 15:51:08 +09:00