Andrew Tridgell
25c7ee4d42
AP_HAL_SITL: added SIM_GPS_ALT_OFS
...
this is used to give a bad GPS height in SITL, which is very useful for
testing origin vs home issues
2017-09-18 10:24:45 +10:00
Michael du Breuil
58e784024f
AP_HAL_SITL: Add support for blocked pitot tube simulations
2017-08-10 20:15:35 +10:00
Lucas De Marchi
5ea1784838
global: remove AP_HAL::in_timerprocess()
...
This is not used and in the only places it would make sense would be
internally to the scheduler so remove it.
2017-08-03 20:25:14 -07:00
Andrew Tridgell
42181ee7c8
HAL_SITL: use SIM_GPS_LOCKTIME
2017-07-14 15:02:14 +10:00
Miguel Arroyo
86b9942d51
AP_HAL_SITL: move SITL Compass to standard sensor backend model
2017-06-29 09:22:08 +10:00
Miguel Arroyo
4394c5145b
AP_HAL_SITL: Fixes bug with uartF.
...
uartF _timer_tick() was not being called in the scheduler.
2017-06-26 13:05:16 +01:00
Pierre Kancir
1c8d169814
AP_HAL_SITL: sitl_airspeed simplify include
2017-06-07 20:29:02 +10:00
Pierre Kancir
775ca9303a
AP_HAL_SITL: sitl_airspeed correct style
2017-06-07 20:29:02 +10:00
Pierre Kancir
0afc907b0a
AP_HAL_SITL: rename sitl_ins & _update_ins to sitl_airspeed & _update_airspeed
2017-06-07 20:29:02 +10:00
Pierre Kancir
22dd81e298
AP_HAL_SITL: rangefinder const correctness
2017-06-07 20:28:25 +10:00
Pierre Kancir
3f045a4905
AP_HAL_SITL: airspeed_simulated use is_zero
2017-06-07 20:28:25 +10:00
Pierre Kancir
4acf4538c7
AP_HAL_SITL: rangefinder don't adjust value from FDM on external data
2017-06-07 20:28:25 +10:00
Pierre Kancir
599e3d7b83
SITL: make range finder a standalone sitl plugin
2017-06-07 20:28:25 +10:00
murata
c21b586ccc
SITL: add dodeca-hexa support
2017-05-27 14:21:13 +09:00
Andrew Tridgell
e51bbcebec
AP_HAL_SITL: rename macros to avoid conflicts
...
these macros were also defined in NuttX in clock.h
2017-05-06 15:21:14 +10:00
Andrew Tridgell
ac82d1a65d
HAL_SITL: moved SITL baro to AP_Baro_SITL
2017-05-03 20:12:04 +10:00
Peter Barker
2f79a5bd90
AP_HAL_SITL: use HAL_SEMAPHORE_BLOCK_FOREVER
2017-05-01 15:05:51 +01:00
Andrew Tridgell
f257a869ac
HAL_SITL: make cork/push safe to call nested
2017-05-01 14:32:18 +10:00
Pierre Kancir
f8d6b5fc9c
AP_HAL_SITL: Allow to use a second type of gps for all type
2017-04-26 18:34:56 +01:00
Pierre Kancir
f0f7ca2386
SITL: State constrain rover motor input between 1000 and 2000
2017-04-26 10:38:01 +10:00
Pierre Kancir
327ac07d54
AP_HAL_SITL: gps correct glitchs
2017-04-19 17:44:29 +01:00
Niels Joubert
873915d82b
AP_HAL_SITL: Support both SBPv0 and SBPv2
2017-04-18 18:25:54 +01:00
Andrew Tridgell
961da9deb8
HAL_SITL: use quaterion instead of eulers
2017-04-16 14:01:36 +10:00
Eugene Shamaev
d81af8700f
AP_HAL_SITL: definitions for CAN bus
2017-04-10 22:38:12 +01:00
Andrew Tridgell
3236090d71
HAL_SITL: allow plane and rover to use SIM_ENGINE_FAIL
2017-04-09 16:45:19 +10:00
Dr.-Ing. Amilcar Do Carmo Lucas
b4260c77be
Add and update missing SITL command line usage information
2017-04-05 20:17:40 +10:00
Guilherme Sousa
584890a864
AP_HAL_SITL: Fail motors with SIM_ENGINE_FAIL
2017-03-29 22:43:14 +11:00
Michael du Breuil
2aec41e0ef
AP_HAL_SITL: Fix SIM_GPS_DISABLE not disabling the ublox GPS with PVT support
2017-03-19 23:13:11 -07:00
Pierre Kancir
d4a0a92b8b
SITL: cmdline reorder help and param for better readability and futher extension
...
add missing options
2017-03-18 19:58:11 +11:00
Pierre Kancir
ee7355a301
SITL: Reduce some variables scope and include
2017-03-18 19:58:11 +11:00
Pierre Kancir
8054405521
SITL: Change interface port to a generic solution for external simulator
2017-03-18 19:58:11 +11:00
Pierre Kancir
6e0319d513
SITL: Add RCout port option to cmdline
2017-03-18 19:58:11 +11:00
Pierre Kancir
a8d5079a38
SITL: Ensure that Instance parameter don't override manualy setted port
2017-03-18 19:58:11 +11:00
Tully Foote
25fad0a8c2
SITL: Add more command line arguments for port selection.
2017-03-18 19:58:11 +11:00
Pierre Kancir
5b8c89225a
SITL: Make socket more verbose
2017-03-18 19:58:11 +11:00
Pierre Kancir
567a8d68e5
SITL: Make socket error more verbose
2017-03-18 19:58:11 +11:00
Pierre Kancir
1bb4e3c9b7
AP_IRLock_SITL: make port variable
2017-03-18 19:58:11 +11:00
Pierre Kancir
63ea8c6f21
SITL: enable multi sitl for gazebo
2017-03-18 19:58:11 +11:00
Randy Mackay
341b926a43
AP_HAL_SITL: add glitch for 2nd ublox
2017-03-13 11:31:51 +11:00
Jacob Walser
e7caf05238
AP_HAL_SITL: Add support for Sub
2017-02-21 11:26:14 +11:00
Michael du Breuil
c716e76bfc
AP_HAL_SITL: Apply a GPS noise parameter
2017-02-13 09:23:14 +11:00
murata
30151c8253
Global: Define MSEC_PER_SEC, MSEC_PER_WEEK, SEC_PER_WEEK and UNIX_OFFSET.
2017-02-11 01:34:09 -08:00
Peter Barker
eb6826f7de
SITL: avoid use of uninitialised memory
2017-02-05 01:07:32 +00:00
murata
67fdbf5c2d
AP_HAL_SITL: Unify from print or println to printf.
2017-01-27 18:20:22 +11:00
Michael Oborne
d05b0d5885
AP_GPS_UBLOX: add pvt message support
2017-01-25 03:34:26 +00:00
Michael du Breuil
d5a5a97a3d
SITL: Use the GPS_LEAPSECOND define
2017-01-18 18:07:26 +00:00
Peter Barker
e9a0e98863
AP_HAL_SITL: use fabs on double values
2017-01-17 09:41:37 -08:00
Andrew Tridgell
117974ef0f
HAL_SITL: obey enable mask for output channels
2017-01-12 17:39:37 +11:00
Pierre Kancir
ab9e88299f
AP_HAL_SITL: Scheduler remove unreachable code & minor fix
...
usleep wasn't reached since synthetic clock is always used
correct style
make constructor explicit
use c++ cast
2017-01-12 01:27:16 +00:00
Pierre Kancir
63b3618fc7
AP_HAL_SITL: RCOuput minor fix
...
correct style
make constructor explicit
use c++ cast
2017-01-12 01:20:06 +00:00
Pierre Kancir
ff46964d22
AP_HAL_SITL: RCInput minor fix
...
fix style
make constructor explicit
remove unused _valid
correct read to return real length instead of fixed 8
correct implicit cast
2017-01-12 01:19:54 +00:00
Pierre Kancir
7f5b32f59f
AP_HAL_SITL: GPIO minor fixes
...
fix style
make constructor explicit
fix implicit cast for unsigned to signed value
correct DigitalSource constructor definition
2017-01-12 01:06:20 +00:00
Pierre Kancir
8ade9d1fe8
AP_HAL_SITL: style fixes
2017-01-12 01:06:20 +00:00
Pierre Kancir
5b2b4430b3
AP_HAL_SITL: AnalogIn minor fixes
...
change pin to int16_t to match real implementation and prevent casting.
make constructor explicit
2017-01-12 01:06:20 +00:00
Pierre Kancir
f9c8827809
SITL: Scheduler correct misplaced parenthese && switch to do while loop
2016-12-04 18:28:14 +00:00
Andrew Tridgell
7ba957b946
HAL_SITL: flush stdout on panic
2016-12-02 09:49:38 +11:00
Andrew Tridgell
def6e014cf
HAL_SITL: removed old optflow simulation
2016-11-28 08:26:56 +11:00
Pierre Kancir
84aaca7c6e
SITL: add missing break
2016-11-17 13:46:10 +00:00
Pierre Kancir
86c8145bd9
SITL: Change Flighgear port with instance number
2016-11-16 08:27:48 +11:00
Pierre Kancir
c4b5bd4bd9
SITL: revert fg view to activate by default and use flag to disable it
2016-11-16 08:27:48 +11:00
Pierre Kancir
e2b939df39
SITL: rename simin to rcin for better readability
2016-11-16 08:27:48 +11:00
Pierre Kancir
59c84c637e
SITL: make fg view optional
2016-11-16 08:27:48 +11:00
Lucas De Marchi
f6d475c1e6
AP_HAL_SITL: add O_CLOEXEC in places missing it
...
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
murata
c808ee2f49
Global: To nullptr from NULL.
...
RC_Channel: To nullptr from NULL.
AC_Fence: To nullptr from NULL.
AC_Avoidance: To nullptr from NULL.
AC_PrecLand: To nullptr from NULL.
DataFlash: To nullptr from NULL.
SITL: To nullptr from NULL.
GCS_MAVLink: To nullptr from NULL.
DataFlash: To nullptr from NULL.
AP_Compass: To nullptr from NULL.
Global: To nullptr from NULL.
Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
priseborough
747f3a8cfd
AP_HAL_SITL: Simulate range finder position offset
2016-10-27 14:54:44 +11:00
priseborough
a9f63abc6f
AP_HAL_SITL: simulate effect of GPS antenna offset
2016-10-27 14:54:44 +11:00
priseborough
3afe2b1694
AP_HAL_SITL: simulate optical flow sensor body frame position offset
2016-10-27 14:54:44 +11:00
Peter Barker
dd7d41b1f3
SITL: unhide groups when generating parameters in autotest
2016-10-26 09:53:14 +11:00
Andrew Tridgell
d2287caf1c
HAL_SITL: removed old servo slew rate code
2016-10-25 20:39:38 +11:00
Mathieu OTHACEHE
152edf7189
Global: remove mode line from headers
...
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Andrew Tridgell
97d0553938
HAL_SITL: implement cork() on RCOutput
2016-10-13 10:00:04 +11:00
Michael Oborne
11c376588d
AP_GPS_NOVA: support tersus/novatel/comnav gps
2016-09-20 10:53:49 +10:00
Andrew Tridgell
25f1dbd8c2
HAL_SITL: allowed SITL to reopen uart connections
2016-08-23 09:30:17 +10:00
Murilo Belluzzo
077e03678f
Global: Adapt Stream class to be used with Ringbuffer
2016-08-03 01:44:02 -03:00
Peter Barker
9749b91d46
SITL: initialise sigaction structs - valgrind fix
2016-07-29 10:38:03 -03:00
Lucas De Marchi
d418338e22
AP_HAL_SITL: remove I2CDriver
...
I2CDevice now serves for the same purpose.
2016-07-28 18:08:57 -03:00
Staroselskii Georgii
d69aeb4808
AP_HAL_SITL: use sigaction over signal API in SITL_State
2016-07-27 21:30:19 +10:00
Andrew Tridgell
d7faeada87
HAL_SITL: notify GCS on GPIO changes
...
useful for testing relays in SITL
2016-07-22 15:01:21 +10:00
Andrew Tridgell
5b081a704c
HAL_SITL: added GPIO simulation
...
using SIM_PIN_MASK
2016-07-22 15:01:20 +10:00
Tom Pittenger
acaf0c6a5d
SITL: LPF the SIM_WIND_DIR and SIM_WIND_SPD values to eliminate step inputs
2016-07-15 18:37:40 -07:00
Siddharth Bharat Purohit
d65f453da1
AP_HAL_SITL:use common fenv function
2016-07-07 11:35:18 -03:00
Andrew Tridgell
fc9283964a
HAL_SITL: fixed segv on cygwin
2016-06-30 20:45:03 +10:00
Peter Barker
309ac53806
SITL: correct adsb initialisation
...
Parameters have not yet been initialised in _sitl_setup, so move
should-run checks into update
2016-06-20 18:16:34 -07:00
Andrew Tridgell
acc76f80b0
HAL_SITL: added xplane support
2016-06-19 13:59:15 +10:00
Paul Riseborough
2cf5493b40
AP_HAL_SITL: Ensure simulated magnetic field is always used
2016-06-19 12:51:34 +10:00
Tom Pittenger
1770f314ac
SITL: change SIM_ADSB default to -1 to default disabled to leave telem port available
2016-06-15 17:22:54 -07:00
Tom Pittenger
52fcc36249
AP_HAL_SITL: remove -A --adsb argument, feature is now always enabled controlled by param
2016-06-14 21:05:23 -07:00
Tom Pittenger
f2b5f5f4a5
AP_HAL_SITL: adsb is always enabled in the sim, controlled by param SIM_ADSB_COUNT
2016-06-14 21:03:30 -07:00
Andrew Tridgell
0166ab2038
HAL_SITL: check for SIM_RC_FAIL
2016-06-05 05:54:56 +10:00
Tom Pittenger
5df2e57209
AP_HAL_SITL: do not compile terrain class when terrain is not disabled via compile flag
2016-06-03 11:07:36 -07:00
Andrew Tridgell
04f87a452e
HAL_SITL: fixed tcp client mode
2016-05-30 16:42:28 +10:00
Andrew Tridgell
969b6ebea9
HAL_SITL: support coaxcopter in SITL
2016-05-26 17:09:22 +10:00
Andrew Tridgell
a80e233836
HAL_SITL: added SingleCopter
2016-05-26 16:30:39 +10:00
Andrew Tridgell
635a975486
HAL_SITL: use a smaller buffer for real SITL UARTs
...
better emulation of real hw
2016-05-23 23:41:02 +10:00
Tom Pittenger
ad11f3815b
AP_HAL_SITL: rename aspd variables to arspd
2016-05-17 16:36:14 -07:00
Gustavo Jose de Sousa
2246343ec7
AP_HAL_SITL: pass signed value to abs()
...
Passing an unsigned value to abs() causes compilation error in gcc 6.1.1
(and doing that doesn't make sense too).
As a bonus, this patch fixes the code, since, for two unsigned integers
a and b, such that a > b, (a - b) without the casting to a signed
integer would produce garbage in the context of this patch. The type
int32_t is enough for the cases covered by this patch.
2016-05-16 15:04:22 -03:00
Peter Barker
8d5ceda534
AP_HAL_SITL: ensure specified SITL model is found
...
Without this check we get a null pointer exception the first time we attempt
to use the model object
2016-05-16 13:04:15 -03:00
Andrew Tridgell
c6620b03b4
HAL_SITL: added --rtscts option to SITL
...
useful for radio testing
2016-05-16 16:51:26 +10:00
Ricardo de Almeida Gonzaga
91e9dd10ba
AP_HAL_SITL: Fix typos
2016-05-13 19:20:06 -03:00
dgrat
41661f815f
AP_Math: Replace the pythagorous* functions with a variadic template
...
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
Gustavo Jose de Sousa
8c4c9ccfa6
AP_HAL_SITL: add calibration model
2016-05-10 16:16:37 +10:00
Andrew Tridgell
4318fd0ab8
HAL_SITL: update for changed API
2016-05-07 18:27:19 +10:00
Andrew Tridgell
2718b0649b
HAL_SITL: fixed GPS rate in SITL when speedup used
2016-05-07 18:27:18 +10:00
Andrew Tridgell
9081310ff1
HAL_SITL: support simulator RC input
2016-05-04 12:51:28 +10:00
Randy Mackay
3d646a26e2
AP_HAL_SITL: calls to terrain:height_amsl provide extrapolate and corrected params
2016-04-30 10:33:01 +09:00
Andrew Tridgell
46f368f17d
HAL_SITL: support fireflyy6 as quadplane
2016-04-22 10:28:15 +10:00
Andrew Tridgell
21fb38da8f
HAL_SITL: support Y6 frame
2016-04-21 21:11:46 +10:00
Andrew Tridgell
41b3cb2ff7
HAL_SITL: support tri sim
2016-04-21 20:29:58 +10:00
Andrew Tridgell
835c0b1759
HAL_SITL: follow sqrt law to 60m for wind
...
this makes testing wind in landings more useful
2016-04-20 17:26:16 +10:00
Andrew Tridgell
4ef977c68b
HAL_SITL: fixed initial path for uartF
2016-04-20 10:08:35 +10:00
Andrew Tridgell
0d27409511
HAL_SITL: added uartF
2016-04-20 09:39:49 +10:00
Ricardo de Almeida Gonzaga
5bd034a5a8
Global: start using cmath instead of math.h
2016-04-05 21:06:19 -07:00
Andrew Tridgell
4d01cb1716
HAL_SITL: fixed SITL engine mul error
...
expression without get() was treated as int
2016-03-26 14:17:12 +11:00
Andrew Tridgell
5c92adddf9
HAL_SITL: allow examples to run under SITL
2016-03-25 21:35:16 +11:00
Lucas De Marchi
e6059f5197
AP_Compass: rename files to follow other libraries
...
AP_Compass.h is the main header to be exported and AP_Compass.cpp its
implementation. There's no need for an additional header.
2016-03-23 17:50:38 -03:00
Lucas De Marchi
bcdc3336de
AP_HAL_SITL: replace header guard with pragma once
2016-03-16 18:40:41 +11:00
Will Sackfield
0a60d713af
AP HAL SITL: Use fully qualified SITL namespace
...
* using namespace SITL caused ambiguities due to
both SITL and HAL SITL using the same namespace
2016-02-29 14:14:37 +11:00
Michael du Breuil
287a3367ad
AP_HAL_SITL: Force the simulated gps time to be on valid intervals for u-blox hardware
2016-02-26 09:57:03 +11:00
Lucas De Marchi
c3d8ba3ea5
AP_HAL_SITL: use empty I2CDevice
2016-02-16 19:49:09 -02:00
Lucas De Marchi
9aa49cda93
Global: remove system_initializing() from scheduler
...
This is not used anymore.
2016-02-12 23:42:34 -02:00
Andrew Tridgell
cb60384dc4
AP_HAL_SITL: allow auto-baudrate detection in GPS driver in SITL
...
this is useful when testing a real GPS in SITL
2016-02-11 18:46:01 +11:00
Tom Pittenger
f695f37ca3
AP_HAL_SITL: handle negative throttle
...
- negative throttle was causing negative voltage offsets
2016-02-09 14:18:01 +11:00
Lucas De Marchi
0e09975fa6
AP_HAL_SITL: fix typo
2016-02-01 14:18:51 -02:00
Andrew Tridgell
097c2011e1
HAL_SITL: prevent abort on select with -1 fd
2016-01-10 21:26:35 +11:00
Andrew Tridgell
deb0b9c197
HAL_SITL: read in larger chunks
2016-01-10 17:43:01 +11:00
Andrew Tridgell
655f57ad01
HAL_SITL: cleanup class names
...
remove SITL prefix
2016-01-10 17:43:01 +11:00
Andrew Tridgell
492c733750
HAL_SITL: added RingBuffers to UART driver
...
makes for faster log download
2016-01-10 17:43:01 +11:00
Andrew Tridgell
22e25cc792
HAL_SITL: added Flightaxis support
2016-01-09 07:38:51 +11:00
Andrew Tridgell
b4cc3d9668
HAL_SITL: implement get_custom_defaults_file()
2016-01-07 09:09:40 +11:00
Andrew Tridgell
6c064ae8bd
HAL_SITL: flow control is enabled on SITL
...
faster parameter download
2016-01-06 19:16:08 +11:00
Andrew Tridgell
dd07ffce08
HAL_SITL: enable debug of rcoutput channel enable and frequency
2016-01-05 09:47:55 +11:00
Andrew Tridgell
2dd8a0af74
HAL_SITL: allow visualisation of quad motor speeds in flightgear
2016-01-04 11:09:27 +11:00
Andrew Tridgell
1450f33b51
HAL_SITL: support 16 RC input channels in SITL
2016-01-04 08:22:02 +11:00
Andrew Tridgell
83c8505b3c
HAL_SITL: send state to flightgear viewer
2016-01-04 08:02:37 +11:00
Andrew Tridgell
e6555aae6d
HAL_SITL: added quadplane model
2016-01-01 14:35:15 +11:00
Andrew Tridgell
d0896a1fb2
HAL_SITL: fixed init of channel 8 out in plane and rover
...
should be low
2016-01-01 14:35:15 +11:00
Andrew Tridgell
c6b6d7137d
HAL_SITL: added plane simulator
2016-01-01 12:41:06 +11:00
Andrew Tridgell
05e04ee1a7
HAL_SITL: added semaphore support
2015-12-21 07:38:30 +11:00
Julien BERAUD
d8bcb36530
AP_HAL_SITL: add empty optical flow
...
No embedded optical flow on sitl
2015-12-18 17:56:04 +11:00
Tom Pittenger
48ae0d645d
AP_HAL_SITL: compiler warning: float to double promotion
...
- replace atof() with strtof() for the correct return time
2015-12-08 14:54:43 +09:00
Lucas De Marchi
c72f812944
AP_HAL_SITL: rename AP_HAL_Empty instances
2015-12-08 11:12:14 +11:00
Lucas De Marchi
4c82c535cc
AP_HAL_SITL: use init() method without arguments
...
Override the init() method from parent class that doesn't have a
parameter since it's not used here.
2015-12-02 14:49:11 -02:00
Tom Pittenger
bb4f0783ad
AP_HAL_SITL: created ADS-B simulator to generate additional ghost aircraft within SITL
...
- The values are very aggressive, you'll come into contact with another aircraft very soon
- Credit goes to Tridge for this work
- This also allows hardware attached via UART to feed real aircraft into the simulator
This feature is enabled with the following command:
sim_vehicle -A --adsb
2015-11-23 19:45:40 +11:00
Andrew Tridgell
7a5c4ec65d
HAL_SITL: use battery info from FDM if available
2015-11-23 13:31:29 +11:00
Andrew Tridgell
a6ef064950
HAL_SITL: removed support for the old FDM protocol
...
we are now fully converted to the new C++ based SITL system
2015-11-23 13:21:33 +11:00
Caio Marcelo de Oliveira Filho
bb165d8a4c
AP_HAL_SITL: Remove unused extern declaration for HALs
2015-11-20 16:32:45 +09:00
Caio Marcelo de Oliveira Filho
783db23a0f
AP_HAL_SITL: remove unused functions
2015-11-20 12:36:42 +09:00
Caio Marcelo de Oliveira Filho
85d12efbef
AP_HAL_SITL: use millis/micros/panic functions
2015-11-20 12:31:20 +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
Andrew Tridgell
95ca0b39a8
HAL_SITL: moved virtual INS sensor to AP_InertialSensor_SITL
2015-11-16 17:57:35 +11:00
Andrew Tridgell
2675edcb96
HAL_SITL: removed unused variables
2015-11-16 17:57:35 +11:00
Andrew Tridgell
81e34006a5
HAL_SITL: make available_memory() uint32_t
2015-11-05 16:09:00 +11:00
Andrew Tridgell
75d2aed6e1
HAL_SITL: added help for uart command line checks
2015-11-04 14:26:55 +11:00
Lucas De Marchi
cf8203c08b
AP_HAL_SITL: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1
2015-11-04 12:14:12 +11:00
Andrew Tridgell
a5a1680fb3
HAL_SITL: added support for real UART devices
...
This allows use of real UART devices in the simulator. Useful for GPS
driver work or other MAVLink peripherals
2015-11-04 11:29:04 +11:00
Lucas De Marchi
1b07dabeb7
Replace prog_char and prog_char_t with char
...
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.
AVR-specific places were not changed.
2015-10-30 14:35:30 +09:00
Lucas De Marchi
20c6ffc5e3
Replace use of UARTDriver::printf_P() with UARTDriver::printf()
...
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi
7ceffb1e2b
Replace use of vprintf_P() with vprintf()
2015-10-30 14:35:23 +09:00
Lucas De Marchi
6f4904189b
Replace use of println_P() with println()
2015-10-30 14:35:22 +09:00
Lucas De Marchi
2c38e31c93
Remove use of PSTR
...
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.
This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.
AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Lucas De Marchi
9eaf7c5660
AP_HAL: add format attribute to panic()
2015-10-24 14:26:36 +11:00
Lucas De Marchi
6027a02fe9
AP_HAL_SITL: Scheduler: implement variadic version of panic()
2015-10-24 14:26:36 +11:00
Lucas De Marchi
ad61a93c14
AP_HAL: turn panic() into a variadic method
...
Change the declaration on all HAL implementations so panic() in future
may implement a printf-like interface.
2015-10-24 14:26:35 +11:00
Caio Marcelo de Oliveira Filho
49a42dc985
SITL: use a SITL namespace
2015-10-22 11:04:42 -02:00
Andrew Tridgell
6b048b4045
HAL_SITL: use SimRover
2015-10-21 22:04:21 +11:00
wsilva32
ab7148386c
AP_HAL_AVR_SITL: Limit SITL compass reports to 100Hz
...
Similarly to how the SITL baro currently works, setHIL is only called at 100Hz.
2015-10-21 10:39:27 +11:00
Caio Marcelo de Oliveira Filho
19b4ca60c4
AP_HAL: provide AP_HAL_MAIN()
...
Move the macros to a single place and reduce the variations not based on
board, but based on
- The name of the entry-point function, specified by AP_MAIN;
- Whether it contains argc/argv arguments or not.
The goal here is that programs (vehicles and examples) don't need to
include all possible boards to define a main function. Further patches
will change the programs.
2015-10-21 09:16:09 +11:00
Caio Marcelo de Oliveira Filho
e4ef0e43c0
AP_HAL_SITL: merge init() and run()
2015-10-21 09:16:08 +11:00
Caio Marcelo de Oliveira Filho
c6292ff097
AP_HAL_SITL: implement HAL::run()
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
teddytrowbridge
a4690a7b0a
SITL_State: fixed _set_param_default
...
Fixed _set_param_default() so that it finds the parameter using it's
NAME rather than the entire NAME=VALUE string
2015-10-16 10:20:31 +11:00
Lucas De Marchi
7d9c75478f
AP_HAL_SITL: remove unused write method
2015-09-29 11:53:51 +09:00
Lucas De Marchi
0ed7f94bfc
AP_HAL_SITL: use method for downcast
...
Instead of just doing a static cast to the desired class, use a method
named "from". Pros:
- When we have data shared on the parent class, the code is cleaner in
child class when it needs to access this data. Almost all the data
we use in AP_HAL benefits from this
- There's a minimal type checking because now we are using a method
that can only receive the type of the parent class
2015-09-23 09:01:29 +10:00
Michael Oborne
b861233677
AP_HAL_SITL: add file based gps
2015-09-03 19:43:31 +10:00
Lucas De Marchi
ffa37e6de2
AP_HAL_SITL: standardize inclusion of libaries headers
...
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-18 17:12:52 +10:00
Fredrik Hedberg
e2027a8414
SITL: Add HELI_DUAL_FRAME and HELI_COMPOUND_FRAME.
2015-08-13 18:23:30 +10:00
Gustavo Jose de Sousa
27b9d71e2c
AP_HAL_SITL: 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:28:43 +10:00
Michael du Breuil
c8c34f54cc
AP_HAL_SITL: Add hdop to ublox sitl sim (as well as vdop to be reported)
2015-08-08 13:22:02 +09:00
Tom Pittenger
d51e6d466b
AP_HAL_SITL: add support for airspeed failures
2015-07-23 14:38:06 +10:00
Lucas De Marchi
473415a3c2
AP_HAL_SITL: use ARRAY_SIZE macro
2015-07-21 14:25:03 +09:00
John Hsu
c34ddb7fb8
HAL_SITL: added gazebo SITL model support
2015-07-20 09:10:48 +10:00
Randy Mackay
2b4aaf2368
SITL: add vibe monitor and SIM_ACC2_RND to sitl
2015-07-12 16:50:30 +09:00
Julien BERAUD
7275e33e79
AP_HAL: add the possibility to have more than 1 i2c
...
Bebop drone has 3 i2c
2015-07-10 14:23:17 +10:00
Andrew Tridgell
88a90495b2
HAL_SITL: allow for more data before GPS pipe flush
2015-07-04 15:14:39 +10:00
tcr3dr
9d26bc6958
HAL_SITL: Adds polyfill for feenableexcept on OS X.
2015-07-01 11:32:01 +10:00
Andrew Tridgell
15efae5a48
HAL_SITL: use SITL_NUM_CHANNELS
2015-06-30 08:55:02 +10:00
Andrew Tridgell
92c9779d18
HAL_SITL: pass turbulence to simulators
2015-06-29 11:25:44 +10:00
Andrew Tridgell
a81590f7ac
HAL_SITL: prevent FPE on zero range with optflow
2015-06-25 10:08:53 +10:00
Andrew Tridgell
4677c189e0
HAL_SITL: support balloon model
2015-06-15 09:20:56 +10:00
Andrew Tridgell
c44ab01be8
AP_HAL: use noreturn attribute on panic
...
should reduce coverity warnings
2015-06-08 21:09:08 +10:00
Andrew Tridgell
d57eca9de8
HAL_SITL: enable simulated antenna tracker
2015-06-01 12:53:50 +10:00
Andrew Tridgell
249b339e6c
HAL_SITL: fixed a build warning
2015-05-30 22:16:37 +10:00
Lucas De Marchi
acdcdc35fa
AP_HAL_SITL: Do not compare delegate to NULL
...
Use the simpler "if (delegate_name)" since it allows simpler
implementation in the class, i.e. the bool operator rather than having
to compare to another object.
2015-05-26 13:46:48 +10:00
Andrew Tridgell
3daee9c8bc
HAL_SITL: added --autotest-dir option
2015-05-25 13:04:17 +10:00
Andrew Tridgell
e7abc07898
HAL_SITL: enable --gimbal option
...
instantiates a MAVLink gimbal
2015-05-25 12:20:26 +10:00
Andrew Tridgell
8dce5e11d6
HAL_SITL: removed earth-frame rates
2015-05-25 09:03:10 +10:00
Andrew Tridgell
e7f3716e8c
HAL_SITL: pass in wind speed to C++ simulators
2015-05-23 11:04:13 +10:00
Andrew Tridgell
6cbd291dd2
HAL_SITL: make model name case insensitive
2015-05-22 16:07:44 +10:00
Andrew Tridgell
4e117bc90f
HAL_SITL: support last_letter simulator
2015-05-22 16:07:44 +10:00
Andrew Tridgell
cd66ce1c74
HAL_SITL: don't advance clock on garbage SIM input
2015-05-21 21:17:22 +10:00
Tom Pittenger
7b95241306
AP_HAL_SITL: float to double promotion via cos instead of cosf
2015-05-16 08:21:37 +10:00
Andrew Tridgell
3370ec62a1
HAL_SITL: fix for multi-compass SITL
2015-05-15 14:25:44 +10:00
Andrew Tridgell
2a47cc3c81
HAL_SITL: cleanup command line handling
2015-05-11 08:48:42 +10:00
Andrew Tridgell
5687adbdba
HAL_SITL: support JSBSim backend
2015-05-10 21:02:20 +10:00
Andrew Tridgell
8ec98a5ec9
SITL: make it possible to connect two SITL instances together
...
this adds --client to set uartC as a tcp client rather than a TCP
server
2015-05-10 15:36:18 +10:00
Tom Pittenger
1c8efb25a8
AP_HAL_SITL: replace fabs() with fabsf()
2015-05-09 09:57:26 +10:00
Andrew Tridgell
6a8da06d19
HAL_SITL: hook in CRRCSim backend
2015-05-05 21:42:46 +10:00
Andrew Tridgell
c81ad1d622
HAL_SITL: reformat HAL_SITL with astyle
2015-05-05 10:59:07 +10:00
Andrew Tridgell
d8791134f9
HAL_SITL: need to use fabs() for double checking
2015-05-05 09:45:59 +10:00
Andrew Tridgell
b9abf30785
HAL_SITL: removed unused cygwin code
2015-05-05 09:45:58 +10:00
Andrew Tridgell
5158f91263
HAL_SITL: converted command line code to getopt_cpp
2015-05-05 09:45:58 +10:00
Andrew Tridgell
b2b5c8cd18
HAL_SITL: fixed some build warnings
2015-05-05 09:45:58 +10:00
Andrew Tridgell
40e3b422b5
HAL_SITL: rename HAL_AVR_SITL to HAL_SITL
...
it is nothing to do with the original AVR emulation now
2015-05-05 09:45:54 +10:00