Commit Graph

4143 Commits

Author SHA1 Message Date
Andrew Tridgell
3fe5b3151b allow MAG_ENABLE to be changed in flight
this disables the compass in DCM if MAG_ENABLE is changed in
flight. Without this we would use a fixed yaw once the compass is
disabled

This also makes sure we don't pass the compass to DCM till we have
done a read. This ensures we have a good compass fix for the initial
DCM heading
2012-02-25 14:51:09 +11:00
Andrew Tridgell
3abe035557 DCM: use the new use_for_yaw() compass method 2012-02-25 14:51:09 +11:00
Andrew Tridgell
c3319afadd Compass: added COMPASS_LEARN and COMPASS_USE parameters
these allow you to control if the compass should be used for yaw and
if it should learn its offsets. This is useful for locking in compass
offsets once they are confirmed to be good, and for learning offsets
without using them in flights.

The default is to behave the same as previously, which is
COMPASS_LEARN=1 and COMPASS_USE=1
2012-02-25 14:51:08 +11:00
Andrew Tridgell
d1f655beee ACM: check the return of compass.init()
if the compass fails to initialise then don't pass it to DCM, or we
will get no yaw control. Report the init failure to the user.
2012-02-25 14:51:08 +11:00
Andrew Tridgell
ce5c7c2c85 ACM: don't pass a gps pointer to DCM
after discussion with Randy, we don't want ArduCopter to fall back to
GPS for yaw when the compass becomes unhealthy. So we shouldn't pass
the gps object to the DCM code at all.
2012-02-25 14:51:08 +11:00
Andrew Tridgell
051bd78b37 AP_Param: added some comments on AP_Vector3f handling 2012-02-25 11:37:20 +11:00
Andrew Tridgell
3cf0eebac8 DCM: don't reset _have_initial_yaw for GPS heading unless very slow
wait till we reach 1m/s before we reset _have_initial_yaw. This
prevents us continually resetting the DCM matrix if our ground speed
is close to 3m/s.
2012-02-25 11:37:20 +11:00
Andrew Tridgell
42528e9c33 test: updated VARTest for new AP_Param vector3f handling 2012-02-25 11:37:20 +11:00
Andrew Tridgell
17718720b1 GCS: force scalar type in copy_name()
this enables access to compass offsets over MAVLink
2012-02-25 11:37:20 +11:00
Andrew Tridgell
007a6b8958 AP_Param: added special handling for Vector3f
We would like to be able to use Vector3f as a parameter while exposing
the individual elements of the vector as MAVLink parameters. This
change to AP_Param makes that possible, by giving AP_Vector3f a dual
personality
2012-02-25 11:37:20 +11:00
Andrew Tridgell
1d95137b71 SITL: added -C option to desktop mode
this allows running APM to stdout, which is useful for test sketches
2012-02-25 11:37:20 +11:00
Andrew Tridgell
f221bd13ab libs: removed unused library GPS_IMU 2012-02-25 11:37:20 +11:00
Andrew Tridgell
1a21c78062 libs: removed unusued library GCS_SIMPLE 2012-02-25 11:37:20 +11:00
Andrew Tridgell
af0765bb0a autotest: fixed xAccel calculation in fakepos.py 2012-02-25 11:37:20 +11:00
Andrew Tridgell
c63ca9c697 DCM: tidy up use of error_course and in_motion
in_motion is not a good name now it is also used for the compass

The error_course and heading component values don't need to be part of
the DCM object, they can be on the stack to reduce the memory usage a bit
2012-02-25 11:37:20 +11:00
Andrew Tridgell
d5b619218c DCM: use rotation_matrix_from_euler() to calculate initial yaw
When we first get a compass reading or we first start motion we need
to setup the DCM matrix with the right yaw. This uses
rotation_matrix_from_euler() to get a DCM matrix corresponding to our
current roll/pitch, but with the correct yaw
2012-02-25 11:37:20 +11:00
Jason Short
ab945f36df Compass heading added to ATT log 2012-02-24 12:11:15 -08:00
Michael Oborne
06be0d24ba APM Planner 1.1.41
fix mono ssl issue
modify log download
fix param dl on arduplane 2.28 (2x nulls in param list)
fix connect cancel
mono - add more comports
more error checking on radio
2012-02-24 19:39:02 +08:00
rmackay9
ab0e1d7632 TradHeli - increase max yaw input to 45 degrees 2012-02-24 20:18:40 +09:00
Jason Short
ed5db98522 updated Gains for Marco's loiter test 2012-02-23 22:03:26 -08:00
Jason Short
22982cda0f Loiter updates 2012-02-23 22:03:26 -08:00
Michael Oborne
58bca7d4a4 APM Planner 1.1.41
add NaN checking/error message
add config page shortcuts - F5, ctl-s and ctl-o
add +++ passthrough on terminal
add longer delay to log download
modify param receive process.
modify connecting and param receive process - re Andrew
2012-02-24 09:38:56 +08:00
Andrew Tridgell
48cad8bc25 DCM: use rotation_matrix_from_euler() in matrix reset
this makes the code a bit easier to read
2012-02-24 11:54:11 +11:00
Andrew Tridgell
5009679617 DCM: use calculate_euler_angles() to get eulers from DCM
this makes the code a bit easier to understand
2012-02-24 11:52:55 +11:00
Andrew Tridgell
df6013616e AP_Math: added rotmat <-> euler functions
these will make the dcm matrix manipulation easier to understand
2012-02-24 11:52:55 +11:00
Andrew Tridgell
4edf311865 ACM: ensure update_trig() doesn't cause NAN values for cos_roll/cos_pitch
the DCM matrix could have a value over 1.0 for c.x due to rounding
errors
2012-02-24 11:52:55 +11:00
Andrew Tridgell
50f85835bd Compass: ensure we don't produce NAN values for compass heading
this leaves the previous heading values alone if we are at a pitch of
exactly 90 or -90, at which point we can't compute a meaningful
heading
2012-02-24 11:52:55 +11:00
Andrew Tridgell
8190204287 AP_Math: added safe_sqrt() function
this function will never return NAN. It will return zero for negative
numbers.
2012-02-24 11:52:55 +11:00
Andrew Tridgell
0acea11152 DCM: tidy up the nan checking in DCM
use is_nan() on the matrix rather than just on c.x, and add
safe_asin() to the (unused) OUTPUTMODE==2 code.
2012-02-24 11:52:55 +11:00
Andrew Tridgell
b4c8d6491a DCM: added matrix recovery on reset
when we get a bad DCM error we can recover a matrix corresponding to
the current attitude, making it more likely that the aircraft will be
able to recover
2012-02-24 11:52:55 +11:00
Andrew Tridgell
1a32ececb4 AP_Math: added a safe_asin() function
this adds range checking to asin()
2012-02-24 11:52:55 +11:00
Andrew Tridgell
7dd909a16b AP_Math: added is_nan() methods to vector3f and matrix3f 2012-02-24 11:52:55 +11:00
Jason Short
2a4b7facaa added set integrator 2012-02-23 09:38:08 -08:00
Jason Short
b1340bbf80 added a constraint to D term 2012-02-23 09:14:44 -08:00
Hazy
e88e6200b4 APM Planner
a little bit translate
2012-02-23 16:39:16 +08:00
Andrew Tridgell
8707965c15 DCM: changed the sense of floating point range comparison
This allows us to detect NaN, otherwise NaN values were considered 
'in range'
2012-02-23 11:41:26 +11:00
Andrew Tridgell
9caa4aeb44 DCM: range check the matrix before calculating pitch
The asin() in the pitch calculation can only take values between -1
and 1. This change ensures that the value is in range, and if it isn't
then we force a normalization. If that fails we reset the matrix
2012-02-23 08:16:08 +11:00
Andrew Tridgell
13693e1a04 DCM: reset more values on renorm blowup
when DCM blows up, we need to reset a lot more variables to ensure
that any NaN values don't persist
2012-02-23 08:16:08 +11:00
Andrew Tridgell
b231112957 DCM: renorm_sqrt_count is now called renorm_range_count 2012-02-23 08:16:08 +11:00
Andrew Tridgell
5cfe1ad5dc DCM: remove the taylor expansion optimisation for renormalisation
The sqrt() costs about 44usec on a 2560, which is small enough for us
not to worry about the speed.

This also changes the range of values where we declare a blowup to
much less likely, which means we can cope with larger delta_t glitches
2012-02-23 08:16:08 +11:00
Jason Short
128f19cdf7 Emile's Fixes 2012-02-22 10:27:34 -08:00
Jason Short
ac5a4830a1 Marco's Hexa Motors 2012-02-22 09:55:44 -08:00
Michael Oborne
6abd825a64 firmware build 2012-02-23 01:06:56 +08:00
Jason Short
92cfc8913a revved a version 2012-02-22 09:00:42 -08:00
Jason Short
207ffee856 made timer unsigned 2012-02-21 21:49:03 -08:00
Jason Short
ac81ddef04 commented out control mode debug print 2012-02-21 21:48:07 -08:00
Chris Anderson
ba634c496f Merge branch 'master' of https://code.google.com/p/ardupilot-mega 2012-02-21 10:02:39 -08:00
Michael Oborne
0eec6d462f ensure autoupdate works 2012-02-21 12:32:19 +08:00
Michael Oborne
63cb155fdd APM Planner 1.1.40 2012-02-21 12:04:45 +08:00
Michael Oborne
3259bc6c7a APM Planner - gps lat long bug fix. 2012-02-21 11:55:36 +08:00