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
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
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
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
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
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
Andrew Tridgell
f30c721886
AP_Param: added ParamToken type for variable list traversal
2012-02-19 17:05:28 +11:00
Jason Short
669e8e34ea
added a limit to range output
2012-02-18 21:08:17 -08:00
Randy Mackay
0b369cf78b
Optflow - added reference to FastSerial to resolve compile error on Arduino 1.0.
...
also removed reference to DCM (no longer required) and removed some old code.
2012-02-18 18:09:40 +09:00
Andrew Tridgell
2472f0a2f3
SITL: increase the amount of noise in the simulated ADC
...
this increases the noise to 2 bits, which actually can have the effect
of improving accuracy, as it leads to better averaging
2012-02-18 19:27:15 +11:00
Andrew Tridgell
9602b1f91b
DCM: only add in centripetal accel if we have GPS lock
...
if we don't have a GPS or the GPS doesn't have a good lock then we
can't rely on the ground speed for adjusting the acceleration vector
2012-02-18 19:27:15 +11:00
Andrew Tridgell
371a91cfcf
IMU: move _sensor_cal to general IMU class
...
this makes it available both in shim and INS subclasses
2012-02-18 10:51:57 +11:00
Andrew Tridgell
2b8f0c3a48
AP_Param: moved AP_Vector3f and AP_Matrix3f declarations to AP_Math.h
...
this avoids us needing AP_Math.h in every utility sketch and example
2012-02-18 10:51:57 +11:00
Andrew Tridgell
70a135c47c
AP_Param: fixed copy-assignment operators for AP_Param vectors
2012-02-18 10:51:57 +11:00
Andrew Tridgell
e656928c01
AP_Param: added a set_and_save_ifchanged() method
...
this can be used to avoid the scan() in more frequenctly saved
variables, such as the MAVLink stream rates in APM
2012-02-18 10:51:57 +11:00
Andrew Tridgell
6f080742b8
AP_Param: added an initialised() method
...
this will be used by the compass code
2012-02-18 10:51:57 +11:00
justinbeech
5255512bf9
Found free extra 256 bytes of RAM eliminate _clz use from libgcc
...
Believe it or not, changing / 2^31 to >>31 saved 256 bytes in the "d" segment.
The reason is that GCC version prior to 4.3.5 does not have a count_leading_zeros (clz) assembler macro, so it uses a 256 byte lookup table called _clz
The _clz table gets pulled in if you do 64 bit division.
This tiny change is the only place that we do long long division.
Changing to a shift saves 256 bytes of ram.
2012-02-17 09:46:05 +00:00
Jason Short
560985b509
made I term return in same pattern as D term
2012-02-16 22:09:22 -08:00
Andrew Tridgell
3fbb5a2d6c
ADC: on channel overflow we should not zero last_ch6_micros
...
this happens every 64 seconds because of unused channels on the
ADC. Zeroing this creates a bad delta_t value for the DCM code.
2012-02-16 17:48:36 +11:00
Jason Short
8e88d9e19e
change constant to float 44330.0
2012-02-15 09:10:14 -08:00
Michael Oborne
b020a87c13
eedump ap param in perl
2012-02-15 21:31:58 +08:00
Andrew Tridgell
bc89b53bdc
SITL: adjust the SITL compass code to have saner z values
2012-02-15 22:34:16 +11:00
Andrew Tridgell
63d768143d
Compass: enable compass offsets for HIL compass
...
this makes the null_offsets algorithm have an effect for the HIL
compass that is used for SITL, which makes for easier testing of
compass calibration
2012-02-15 22:33:50 +11:00
Andrew Tridgell
7d21692301
fixed dump size
2012-02-15 10:44:09 +11:00
Andrew Tridgell
d2cc6740f0
show group_element too
2012-02-15 10:42:21 +11:00
Andrew Tridgell
aaba4db144
AP_Param: added eeprom_aaparam.c dump utility
2012-02-15 10:41:06 +11:00
Andrew Tridgell
812b7ae5ae
SITL: catch floating point errors
...
if we get a FPE then log a message and exit
2012-02-15 08:50:45 +11:00
Andrew Tridgell
c39914e734
DCM: added a SITL_debug() for DCM normalisation errors
...
I have seen normalisation errors during simulation runs, but have not
yet tracked down the cause. This log message may help track things
down.
2012-02-15 08:50:45 +11:00
Andrew Tridgell
7355f5613c
added SITL_debug() macro
...
this can be used to print a message into the logs in the SITL
simulator. This will be used for critical conditions.
2012-02-15 08:50:45 +11:00
Andrew Tridgell
7ba65aecf3
RC_Channel_aux: fixed a uninitialied variable error, and save a bit of stack space
2012-02-15 08:50:45 +11:00
Andrew Tridgell
273a974814
SITL: add some magnetometer offsets
...
this ensures the compass null_offset algorithm has some work to do in
autotest
2012-02-14 11:26:42 +11:00
Andrew Tridgell
9103f7688c
fixed SITL GPS heading to be 0..360
2012-02-14 11:26:42 +11:00
Andrew Tridgell
a1c041b597
use stdint types in the compass code
2012-02-14 08:35:03 +11:00
Andrew Tridgell
6c20ff9492
AP_Param: allow dumping of AP_Vector3f
...
this means the 'show' command in the CLI shows the compass offsets now
2012-02-14 08:34:50 +11:00
Andrew Tridgell
4ec3857476
GPS: change back to 4Hz for MTK GPS
...
this will hopefully fix the NO_GPS problems that have been regularly
happening in recent months. I will watch the logs carefully to see if
the problem recurs
2012-02-13 22:50:20 +11:00
Andrew Tridgell
e70e1814ac
AP_Baro: fixed some signed/unsigned warnings
...
and a potential bug on timer wrap
2012-02-13 21:39:18 +11:00