Commit Graph

145 Commits

Author SHA1 Message Date
Peter Barker fdb9fb2f62 AP_HAL_SITL: add support for simulated serial rangefinders
AP_HAL_SITL: add Benewake rangefinder simulator

AP_HAL_SITL: add support for simulated LightWareSerial rangefinder

AP_HAL_SITL: add support for simulated Lanbao rangefinder

AP_HAL_SITL: add support for simulated BLping rangefinder

AP_HAL_SITL: add support for simulated LeddarOne rangefinder

AP_HAL_SITL: add support for simulated uLanding rangefinders

AP_HAL_SITL: add support for simulated MaxsonarSerialLV rangefinders

AP_HAL_SITL: add support for simulated Wasp rangefinders

AP_HAL_SITL: add support for simulated NMEA rangefinders
2019-11-08 20:12:28 +11:00
Peter Barker 9da0e480f2 AP_HAL_SITL: add support for bi-directional simulated serial devices 2019-11-08 20:12:28 +11:00
Peter Hall 58d2c9669e AP_HAL_SITL: pass ADSB home location not string 2019-11-05 11:46:59 +11:00
Peter Barker b0f3c89939 AP_HAL_SITL: correct format string 2019-11-05 11:29:08 +11:00
Peter Barker 111c17d0b4 AP_HAL_SITL: add a simulated buzzer 2019-10-16 16:00:35 +11:00
Andrew Tridgell f86a7d347d Revert "AP_HAL_SITL: set initial PWM values to a flag value"
This reverts commit 1735563bb7.

This commit broke RC input on high channels with sim_vehicle.py, plane
getc RC failsafe immediately
2019-09-15 18:26:50 +10:00
Peter Barker 1735563bb7 AP_HAL_SITL: set initial PWM values to a flag value
These should never be used.  Setting them to a flag value may give a
hint to someone trying to debug a problem in the future.
2019-09-13 08:58:43 +10:00
Peter Barker 15308af230 AP_HAL_SITL: avoid lockstep scheduling issue with semaphores
If there is another thread holding a lock that the main thread wants to
take while pretending to be the IO thread, we will wait forever as we do
not move SITL time forward while pretending to be the IO thread.

This patch simply allows time to move forward if we've failed to take a
semaphore immediately and need to wait.
2019-09-10 21:01:37 +10:00
Peter Barker 94d2ce13d2 AP_HAL_SITL: allow starting location to come from parameters 2019-08-15 18:00:35 +10:00
Grant Morphett fdcdbddecc AP_HAL_SITL: Send NMEA GPHDT sentence if enabled.
and add VTG message
2019-07-13 11:05:57 +10:00
Peter Barker be5478902c AP_HAL_SITL: add precland object 2019-03-01 20:28:22 +11:00
Peter Barker 80e8f9cdd8 AP_HAL_SITL: read all available SITL RC input packets
MAVProxy runs on its own clock.  While our clock is stopped for whatever
reason MAVProxy will continue to send RC input.  This patch always gives
us the most recent RC input from MAVProxy.

Also add sanity check on packet received
2019-02-26 14:17:21 +11:00
Peter Barker 17589ae3b9 AP_HAL_SITL: allow testing of throttle-goes-to-low-fixed-value rc failsafes 2019-02-14 11:49:59 +11:00
Tom Pittenger 81df9aaeb4 AP_HAL_SITL: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
Peter Barker 9253e9b381 AP_HAL_SITL: add simulated parachute 2019-01-09 13:16:03 +11:00
Peter Barker 3d08d02a66 AP_HAL_SITL: reorder setting SO_REUSEADDR and binding rc in port
This stops things failing on cygwin, and may explain rebind failures we
see in SITL.
2018-12-19 16:03:08 +00:00
Pierre Kancir a5e5ee73eb AP_HAL_SITL: correct battery setup for rover 2018-12-18 14:36:32 +09:00
Peter Barker e420f62b62 AP_HAL_SITL: check to see if setting socket and fd options worked 2018-12-18 08:51:01 +11:00
Kristian Klausen d7f529d3c6 AP_HAL_SITL: Use double point precision when converting langitudes and longitudes from degrees to radians.
See #9536
2018-11-15 11:22:56 +11:00
Andrew Tridgell 5480479e73 HAL_SITL: fixed SITL example progs 2018-11-07 07:35:45 +11:00
Peter Barker d968e27b45 AP_HAL_SITL: eliminate float-equals issues 2018-08-28 09:54:47 +10:00
Patrick José Pereira fb7c46bda0 AP_HAL_SITL: Remove unused check
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-08-27 23:35:34 +01:00
Pierre Kancir 96c54550e5 AP_HAL_SITL: rearrange Grippers and Sprayers in SITL
Adds parameters to configure and disable
2018-07-31 23:34:43 +10:00
Andrew Tridgell 3fc6968700 HAL_SITL: allow delay from other than main thread 2018-07-09 19:41:18 +10:00
Patrick José Pereira cd5c59773b AP_HAL_SITL: Use SITL, baro, INS and compass singletons
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-06-26 00:02:01 +01:00
Patrick José Pereira a4d8ed4b75 AP_HAL_SITL: Use reinterpret_cast with AP_Param::find_object
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-06-26 00:02:01 +01:00
Francisco Ferreira 06c41bc768
AP_HAL_SITL: re-use unused FDM address option for FG view IP address 2018-06-20 16:38:52 +01:00
Francisco Ferreira 46868409ec
AP_HAL_SITL: remove unused code 2018-06-20 16:38:52 +01:00
Peter Barker f2a842e415 AP_HAL_SITL: set_cloexec on SITL's RCIN port 2018-06-19 09:14:28 +10:00
Eugene Shamaev 5d4579a086 AP_HAL_SITL: add wind type parameters 2018-05-02 07:32:25 -07:00
Michael du Breuil 5bd4091976 AP_HAL_SITL: Protect against nullpointer dereference 2018-03-31 16:15:48 +09:00
Michael du Breuil 8dd55a85cd SITL: Create a second voltage to monitor for battery voltages 2018-03-27 22:12:21 +01:00
Peter Barker 85b41a8abb AP_HAL_SITL: add vicon-over-mavlink support 2018-03-27 20:28:51 +09:00
Peter Barker 1151d76345 AP_HAL_SITL: sim: namespace for specifying SITL devices from cmdline 2018-03-27 20:28:50 +09:00
Andrew Tridgell 403ba0c325 HAL_SITL: cope with cygwin64 2018-03-02 17:11:31 +11:00
Nicholas Engle 8b08e9388d AP_HAL_SITL: Add SIM_WIND_DIR_Z parameter for SITL
This controls the vertical pitch of the 3d wind vector, allowing futher control of the wind
using systems like dronekit. This change directly effects the calcuation of the wind vector
2018-02-05 16:38:53 -08:00
khancyr 4413ebab7b AP_HAL_SITL: suppress output until initialization is finished 2017-11-13 10:52:38 +11:00
Jacob Walser 07fa65a88c AP_HAL_SITL: Add current and voltage monitoring implementation for Sub 2017-11-13 10:50:27 +11:00
Miguel Arroyo 86b9942d51 AP_HAL_SITL: move SITL Compass to standard sensor backend model 2017-06-29 09:22:08 +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 599e3d7b83 SITL: make range finder a standalone sitl plugin 2017-06-07 20:28:25 +10:00
Andrew Tridgell ac82d1a65d HAL_SITL: moved SITL baro to AP_Baro_SITL 2017-05-03 20:12:04 +10:00
Pierre Kancir f0f7ca2386 SITL: State constrain rover motor input between 1000 and 2000 2017-04-26 10:38:01 +10:00
Andrew Tridgell 961da9deb8 HAL_SITL: use quaterion instead of eulers 2017-04-16 14:01:36 +10:00
Andrew Tridgell 3236090d71 HAL_SITL: allow plane and rover to use SIM_ENGINE_FAIL 2017-04-09 16:45:19 +10:00
Guilherme Sousa 584890a864 AP_HAL_SITL: Fail motors with SIM_ENGINE_FAIL 2017-03-29 22:43:14 +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
Andrew Tridgell def6e014cf HAL_SITL: removed old optflow simulation 2016-11-28 08:26:56 +11:00
Pierre Kancir 86c8145bd9 SITL: Change Flighgear port with instance number 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
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
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
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
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
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 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 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 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 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
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
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 655f57ad01 HAL_SITL: cleanup class names
remove SITL prefix
2016-01-10 17:43:01 +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 d0896a1fb2 HAL_SITL: fixed init of channel 8 out in plane and rover
should be low
2016-01-01 14:35:15 +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
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 85d12efbef AP_HAL_SITL: use millis/micros/panic functions 2015-11-20 12:31:20 +09:00
Andrew Tridgell 95ca0b39a8 HAL_SITL: moved virtual INS sensor to AP_InertialSensor_SITL 2015-11-16 17:57:35 +11:00
Caio Marcelo de Oliveira Filho 49a42dc985 SITL: use a SITL namespace 2015-10-22 11:04:42 -02: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 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
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
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 e7abc07898 HAL_SITL: enable --gimbal option
instantiates a MAVLink gimbal
2015-05-25 12:20:26 +10:00
Andrew Tridgell e7f3716e8c HAL_SITL: pass in wind speed to C++ simulators 2015-05-23 11:04:13 +10:00
Andrew Tridgell cd66ce1c74 HAL_SITL: don't advance clock on garbage SIM input 2015-05-21 21:17:22 +10:00
Andrew Tridgell 2a47cc3c81 HAL_SITL: cleanup command line handling 2015-05-11 08:48:42 +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 5158f91263 HAL_SITL: converted command line code to getopt_cpp 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