Commit Graph

213 Commits

Author SHA1 Message Date
Caio Marcelo de Oliveira Filho
ec52df991c build: compile only the HAL files needed by the board
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho
2e464a53c2 AP_HAL: make code not depend on concrete HAL implementations
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.

A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.

The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.

Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.

The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11:00
Gustavo Jose de Sousa
f32c4ceda9 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-11 16:38:21 +10:00
Randy Mackay
4aef64c153 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-07 15:51:11 +09:00
Víctor Mayoral Vilches
ed3366aaae AP_OpticalFlow: Add support for Linux
Add a Linux userspace driver for the PX4FLOW sensor.
2015-08-07 15:50:41 +09:00
Randy Mackay
03356a8d3a OptFlow: fix parameter descriptions 2015-07-06 11:37:38 +09:00
Randy Mackay
7bbaeac55f OpticalFlow: init _last_update_ms member
This resolves a defect found with coverity
2015-06-08 14:46:11 +09:00
Andrew Tridgell
637f8430c9 AP_OpticalFlow: convert example from .pde to .cpp 2015-06-01 17:07:06 +10:00
Andrew Tridgell
4ee54a8915 AP_OpticalFlow: fix for HAL_SITL rename 2015-05-05 09:45:56 +10:00
Paul Riseborough
53358a4e10 AP_OpticalFlow: Add parameter to compensate for flow sensor yaw angle
AP_OpticalFlow: update parameter name
2015-04-10 11:07:31 +09:00
Randy Mackay
385558db4d OptFlow: fix example sketch 2015-03-13 16:41:01 +09:00
Andrew Tridgell
995311f807 AP_OpticalFlow: change for new PX4 device paths 2015-02-14 12:25:44 +11:00
Randy Mackay
f48a71f30a OptFlow: fix example sketch 2015-01-28 17:15:47 +09:00
Andrew Tridgell
19c717df2e AP_OpticalFlow: updates for new AP_Baro API 2015-01-09 11:50:56 +11:00
Andrew Tridgell
aff01c6d09 AP_OpticalFlow: fixed reversed timestamp
thanks to Randy
2015-01-03 14:16:34 +11:00
Andrew Tridgell
11ff12dfd3 AP_OpticalFlow: split library into frontend/backend
this will make it easier to add a SITL backend
2015-01-03 14:16:33 +11:00
Andrew Tridgell
f8bce994b5 AP_OpticalFlow: don't write an error message if no flow sensor
most users have no flow sensor
2015-01-01 11:02:43 +11:00
Randy Mackay
3c23f00e81 OptFlow: remove ADNS3080 image grabber example 2014-12-08 14:58:24 +09:00
Andrew Tridgell
22a7b69260 AP_OpticalFlow: don't build optical flow example
broken by library changes
2014-12-06 22:05:42 +11:00
Andrew Tridgell
ed510d4f87 AP_OpticalFlow: run PX4 flow sensor at 10Hz
Pair-Programmed-With: Paul Riseborough <p_riseborough@live.com.au>
2014-12-06 18:16:51 +11:00
priseborough
063fb41748 AP_OpticalFlow: Add separate scale factors for X and Y axis.
The resolution is also increased to take advantage of the planned introduction of automated calibration methods
2014-12-06 18:16:49 +11:00
priseborough
f4f0dfc45c AP_OpticalFlow: efficiency improvements to data processing 2014-12-06 18:16:49 +11:00
priseborough
7ec8dfebcf AP_OpticalFlow : Remove gyro scale factor user adjustable parameter
No longer required because bug in flow sensor has been fixed.
2014-12-06 18:16:48 +11:00
priseborough
df59f3311a AP_OpticalFlow : Add gyro scale factor correction parameter 2014-12-06 18:16:48 +11:00
priseborough
eec49ce1dd AP_OpticalFlow : Add parameter for flow rate scale factor correction 2014-12-06 18:16:48 +11:00
priseborough
92e9336fe1 AP_OpticalFlow : prevent divide by zero 2014-12-06 18:16:47 +11:00
priseborough
cb4d5986e0 AP_OpticalFlow : Update PX4Flow interface
Interface now uses the integral of flow and body rates
2014-12-06 18:16:43 +11:00
priseborough
0d774d301d AP_OpticalFlow : Remove support for ADNS3080 sensor
It is not compatible with the new interface and data fusion requirements
2014-12-06 18:16:43 +11:00
Andrew Tridgell
5ddbcc296d AP_OpticalFlow: fixed example build 2014-10-24 21:38:03 +11:00
Andrew Tridgell
d84c1cd3e4 AP_OpticalFlow: fixed example build 2014-10-20 08:42:51 +11:00
Randy Mackay
eed6a1ce61 OptFlow: fix example sketch so it compiles 2014-10-16 13:52:07 +09:00
Randy Mackay
a476a914b0 OptFlow_PX4: check healthy before updating 2014-10-15 16:36:40 +09:00
Randy Mackay
f504ea7b30 OptFlow_ADNS3080: check healthy before updating 2014-10-15 16:36:38 +09:00
Randy Mackay
d238f48dda OptFlowPX4: fix compile error for APM 2014-10-15 16:36:33 +09:00
Randy Mackay
a9cfbb71b8 OptFlowPX4: use ORB to pull data from sensor
This change is required because PX4Firmware has changed the method used
to pull data from the sensor.
2014-10-15 16:36:25 +09:00
Randy Mackay
ec4581b35a OptFlow: add ground_distance_m 2014-10-15 16:35:48 +09:00
Randy Mackay
4b0548973a OptFlow: add PX4Flow support 2014-10-15 16:35:33 +09:00
Randy Mackay
3c4be75487 OptFlow: reorganise ADNS3080 to simplified interface 2014-10-15 16:35:31 +09:00
Randy Mackay
b64f9ed964 OptFlow: rename and restructure OpticalFlow class
AP_OpticalFlow.h becomes simply a file that includes all other optical
flow header files.
OpticalFlow class simplified to only return surface quality, raw output
and velocity vector.
2014-10-15 16:35:29 +09:00
Andrew Tridgell
5025f04cb1 AP_OpticalFlow: fixed example build 2014-08-13 22:12:14 +10:00
Kevin Hester
a7820e6c71 OptFlow: fixup line endings 2014-04-15 15:57:33 +09:00
Randy Mackay
d19b566d97 OptFlow: remove unused variables
Saves 24bytes RAM by removing several static variables that were used
only for internal calculations
2014-02-10 13:53:49 +09:00
Bill Bonney
82ea5926a8 OptFlow: update function added to fix compiler error 2014-02-08 11:53:04 +09:00
Randy Mackay
3823eed865 OptFlow: update example sketch to work with shrunken library 2014-01-09 12:31:51 +09:00
Randy Mackay
8caa5159f8 OptFlow: shrink lib by removing unused functions
Saves 46bytes of RAM and 1k of flash
2014-01-09 12:31:48 +09:00
Andrew Tridgell
b178ad7344 AP_OpticalFlow: updates for AP_HAL::MemberProc 2013-09-30 21:06:42 +10:00
Andrew Tridgell
f53afaa5ac AP_OpticalFlow: use new scheduler API 2013-09-28 21:24:03 +10:00
Andrew Tridgell
d64660739e AP_OpticalFlow: fixed example build 2013-09-24 11:57:14 +10:00
Andrew Tridgell
36ea705956 AP_OpticalFlow: fixed build with print() API change 2013-09-23 18:10:22 +10:00
Andrew Tridgell
97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Randy Mackay
012d7b0c0a OptFlow: initialisation fix
Thanks to DongFang (aka Soren) for finding the issue and the solution
2013-07-11 14:14:37 +09:00
Randy Mackay
4ce4b7aef9 OptFlow: minor commenting and format changes 2013-05-28 22:56:11 +09:00
Randy Mackay
5bf55a9523 OpticalFlow: switch order of sin_yaw, cos_yaw 2013-04-02 15:49:31 +09:00
James Bielman
5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell
6bd361b9cd OpticalFlow: make surface_quality uint8_t 2013-01-13 17:53:54 +11:00
Pat Hickey
8503f3e2ae Optflow: uses new Semaphore 2013-01-03 13:48:07 -08:00
Andrew Tridgell
374af1cd14 build: change from Arduino.mk to apm.mk 2013-01-02 17:29:37 +11:00
Andrew Tridgell
a1187519a8 AP_HAL: use AP_HAL_BOARD_DRIVER in remaining test sketches 2012-12-20 14:52:37 +11:00
Pat Hickey
eb530b86e8 move Arduino.mk to /mk/Arduino.mk 2012-12-20 14:52:35 +11:00
Andrew Tridgell
7d27e420ae AP_HAL: remove unnecessary Arduino.h includes 2012-12-20 14:52:30 +11:00
Pat Hickey
475da4eca4 CONFIG_HAL_BOARD - test sketches fixed up, build all passes 2012-12-20 14:51:37 +11:00
Andrew Tridgell
7d70ff409d AP_OpticalFlow: use max() macro 2012-12-20 14:51:37 +11:00
Pat Hickey
c393374d4c AP_OpticalFlow: ported to AP_HAL
* 78 wide
* remove SPI.h, SPI3.h, and FastSerial.h dependencies (though not objects)
* gotta totally refactor HAL SPI driver to fix the rest
2012-12-20 14:51:30 +11:00
Pat Hickey
3f1d9d7f69 AP_Param: #include <AP_Param.h> fixups for libraries & sketches
* I mostly went through with grep and added an #include <AP_Param.h> below
  every #include <AP_Common.h>. Not all of these example sketches might
  strictly need AP_Param.
2012-12-20 14:51:19 +11:00
Andrew Tridgell
8311062610 AP_OpticalFlow: fixed some memory cast warnings 2012-11-19 08:42:36 +11:00
rmackay9
09485ddc5f AP_OpticalFlow: fix example sketch to work with modified AP_Opticalflow library after memory saves 2012-10-22 16:41:45 +09:00
rmackay9
57439b662c AP_OpticalFlow: change Serial.print to Serial.print_P to save 27 bytes 2012-10-22 16:37:24 +09:00
rmackay9
a1b4531545 AP_OpticalFlow: added ability to pass in semaphores for main spi bus to stop conflicts with dataflash on APM1 2012-10-18 17:02:45 +09:00
Pat Hickey
5ac21b71ce AP_OpticalFlow_test: fix build with NULL semaphore. 2012-10-09 11:36:21 -07:00
Pat Hickey
26ba391cd4 AP_OpticalFlow_ADNS3080: has private AP_Semaphore* _semaphore
Semaphore can be null, handled correctly if it is. Rather than check for
which SPI bus the sensor is using, just check whether semaphore is not null
before using it. More general and flexible.
2012-10-09 11:35:59 -07:00
rmackay9
f9b16a9a50 AP_OpticalFlow: modified to use AP_Semaphore for SPI3 bus when required 2012-10-06 12:41:42 +09:00
rmackay9
a7c2ea1891 AP_OpticalFlow: save and restore SPI bus speed to remove conflict with dataflash that runs at 8Mhz 2012-09-28 17:29:45 +09:00
Andrew Tridgell
81fd4b3a3c OpticalFlow: fixed SITL build 2012-09-25 07:10:22 +10:00
rmackay9
163a7841f6 AP_OpticalFlow: small fixes to test sketch to make it work with modified lib 2012-09-24 18:39:22 +09:00
rmackay9
cb584f81fb AP_OpticalFlow: remove APM2 version of library now that AP_OpticalFlow_ADNS3080 class can autodetect which SPI bus the sensor is on 2012-09-24 18:39:17 +09:00
rmackay9
4d3d13582b AP_OpticalFlow_ADNS3080: detect if optical flow sensor is on standard or secondary SPI bus 2012-09-24 18:39:12 +09:00
rmackay9
ca383b393d AP_OpticalFlow: use AP_PeriodicProcess to read at 20hz 2012-09-24 18:39:07 +09:00
uncrustify
d7d921119c uncrustify libraries/AP_OpticalFlow/AP_OpticalFlow_ADNS3080_APM2.h 2012-08-21 19:04:09 -07:00
uncrustify
0db2404709 uncrustify libraries/AP_OpticalFlow/AP_OpticalFlow_ADNS3080.h 2012-08-21 19:04:09 -07:00
uncrustify
ff94bd7696 uncrustify libraries/AP_OpticalFlow/AP_OpticalFlow.h 2012-08-21 19:04:09 -07:00
uncrustify
80f5d0bb51 uncrustify libraries/AP_OpticalFlow/AP_OpticalFlow_ADNS3080_APM2.cpp 2012-08-21 19:04:09 -07:00
uncrustify
b505b26226 uncrustify libraries/AP_OpticalFlow/AP_OpticalFlow_ADNS3080.cpp 2012-08-21 19:04:09 -07:00
uncrustify
ce14ba0868 uncrustify libraries/AP_OpticalFlow/AP_OpticalFlow.cpp 2012-08-21 19:04:09 -07:00
uncrustify
0fb7e82792 uncrustify libraries/AP_OpticalFlow/examples/AP_OpticalFlow_test/AP_OpticalFlow_test.pde 2012-08-21 19:04:09 -07:00
rmackay9
f18ee75b5c AP_OpticalFlow - updated test sketch to allow testing of APM2 version 2012-04-21 20:11:18 +09:00
rmackay9
3075a0c5bd AP_OpticalFlow - added support for optical flow for APM2 2012-04-21 20:10:35 +09:00
rmackay9
7bda35dc28 AP_OpticalFlow - moved most pin definitions into .cpp file 2012-04-21 20:09:15 +09:00
rmackay9
90fcdeadfd AP_OpticalFlow - small bug fix to ensure init attempts to read the product id 3 times before giving up 2012-03-28 22:00:57 +09:00
rmackay9
d371862fd2 AP_OpticalFlow - resolved compile error in example sketch (it could not find DCM.h but it's not required anyway) 2012-03-24 14:47:21 +09:00
Andrew Tridgell
6021daf423 OpticalFlow: adapt optical flow library to new rotation system 2012-03-11 15:37:07 +11:00
Andrew Tridgell
2ab3d2c080 OpticalFlow: fixed line endings
this library was a mixture of dos and unix line endings, which makes
for very messy editing
2012-03-11 15:37:07 +11:00
Randy Mackay
33aa6fe13b 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
Randy Mackay
ed19c25a97 Arduino 1.0 - changed all #includes of "WProgram.h", "wiring.h" and "WConstants.h to "Arduino.h".
Modified FastSerial's write function to return size_t (number of bytes written).
2012-01-28 12:25:47 +09:00
Randy Mackay
a8b3d2f063 OpticalFlow - fixed minor compiler warnings and moved chip select to A3 for APM2 2012-01-26 23:35:49 +09:00
Randy Mackay
99506accf4 Optical Flow - added overflow check 2012-01-25 21:45:52 +09:00
Randy Mackay
bcd63a9807 OpticalFlow - bug fix - highest resolution was incorrectly set as 1200 instead of 1600 2012-01-14 12:34:29 +09:00
Randy Mackay
bbe6dea980 OptFlow - initial support for APM2 (there are still problems) including adding ability to set Chip Select pin.
Other unrelated changes are:
a) fixed typo in 'esitmate_velocity' to 'estimate_velocity'.
b) moved init_compass from system.pde to sensors.pde which seemed consistent with other sensors.
2011-12-30 12:06:31 +09:00
Andrew Tridgell
632e0312de opticalflow: use the right path for SPI.h 2011-10-09 22:40:00 +11:00
rmackay9
12e8e27af1 Merge remote-tracking branch 'origin/master' 2011-10-01 21:56:29 +09:00
rmackay9
c80143b96e AP_Optflow - small fix to lat/lon calculation and made example sketch work again 2011-10-01 21:51:14 +09:00
James Goppert
0c7c508541 Optional recursion added. 2011-09-30 17:17:51 -04:00
James Goppert
5489b84f8e Improvements to cmake. 2011-09-29 21:23:26 -04:00
James Goppert
d887a28b91 Added ArduBoat/ ArduRover/ and APO library. 2011-09-29 14:12:15 -04:00
Andrew Tridgell
3c69404d5b fixed build of OpticalFlow code 2011-09-17 14:58:02 +10:00
Jason Short
45778a4e81 added sin and cos yaw from DCM, renamed "get" function because it doesn't return a value. 2011-09-16 19:24:57 -07:00
unknown
a4e001bbcf Adding CMake support 2011-09-14 15:44:55 +02:00
rmackay9@yahoo.com
d02d4b895c AP_OpticalFlow - small but important fixes for position calcs
git-svn-id: https://arducopter.googlecode.com/svn/trunk@3040 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-08-07 13:19:18 +00:00
rmackay9@yahoo.com
e81aa43f1c OpticalFlow - add check to see if sensor has initialised correctly.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2974 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-31 04:31:36 +00:00
rmackay9@yahoo.com
3d641a3b45 AP_OpticalFlow - fixes to position calculations (lat was reversed and would calculate position even with surface quality was very low)
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2913 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-07-18 21:51:27 +00:00
rmackay9@yahoo.com
e4cd549599 AP_OpticalFlow - moved chip select pin so it doesn't interfere with AP_ADC
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2452 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-31 13:46:56 +00:00
rmackay9@yahoo.com
c2ff95371c AP_OpticalFlow - fixed some bugs in get_position
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2380 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-22 14:44:51 +00:00
rmackay9@yahoo.com
34c7555fd1 AP_OpticalFlow - added set_orientation
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2245 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-05-11 12:49:19 +00:00
rmackay9@yahoo.com
56fd1acc4a AP_OpticalFlow - first draft of optical flow library for use with experimental ADNS3080 sensor
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1933 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-04-30 08:29:28 +00:00