Commit Graph

91 Commits

Author SHA1 Message Date
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