240 Commits

Author SHA1 Message Date
TSC21
562d57fee8 mavlink: fix odometry frames of reference setup 2020-05-28 15:45:13 +01:00
Matthias Grob
7b41ce4711 simulator: rename parameter variable according to convention 2020-05-25 11:04:24 +02:00
Matthias Grob
88c21337fa Make all battery sensor drivers report their sample interval
To make use of the time abstraction in the leaky integrator.
2020-05-25 11:04:24 +02:00
kritz
3897030c6f
Support odometry velocity in body and local frame (#14703)
* Update submodule ECL

* increase lower bound on EVV param
2020-05-13 12:43:02 +02:00
Daniel Agar
7207301e56 simulator: temperature only updated with baro 2020-05-06 15:34:21 -04:00
kamilritz
960ad0693f fix format 2020-05-03 18:25:00 +01:00
kamilritz
9137813472 Received quaternion represents body to world 2020-05-03 18:25:00 +01:00
Mohammed Kabir
5ffe88672e vehicle_odometry: add timestamp_sample field for latency monitoring 2020-04-28 13:58:43 -04:00
Julian Oes
f650b91718 battery: check source param inside battery lib
This moves the handling of the BAT%d_SOURCE param inside of the battery
library. Users of the library now pass the source instead of the flag
whether to publish. The battery library then checks if the source is
selected using the param and publishes accordingly.

Since we removed the strange system_source flag, we now need to look at
all batteries in commander.
For current estimation - I think - it makes sense to sum them up.
2020-04-06 15:56:54 +02:00
Julian Oes
795e000c2b simulator: remove redundant semicolon 2020-03-18 17:57:41 +00:00
Daniel Agar
a89b69b0ea
vehicle_global_position: remove velocity fields (duplicates of local vx, vy, vz)
* attitude_estimator_q: get velocity from local position (if available)
2020-03-11 23:57:43 -04:00
TSC21
bcb6056a12 simulator: make sensor update rate dependent of the HIL_SENSOR bitmask 2020-02-28 10:59:50 +00:00
Martina Rivizzigno
abe33af5b3 map mavlink orientation enum to uorb distance_sensor orientation 2020-02-26 07:27:09 +01:00
Julian Oes
20276d4ff8 simulator: improve misleading TCP message
Proposed first by @lovettchris.
2020-02-20 12:10:43 +01:00
Julian Oes
e46635b1de simulator: remove strange disarmed PWM
Before that we would send -0.1 instead of just 0.0.

First proposed by @lovettchris.
2020-02-20 12:10:43 +01:00
Julian Oes
a006d82abf simulator: add flag to indicate lockstep
This depends on:
https://github.com/mavlink/mavlink/pull/1311

First proposed by @lovettchris.
2020-02-20 12:10:43 +01:00
Nuno Marques
7cafbc824e
simulator: add support for multi-distance_sensor instances (#14143)
* simulator: add support for multi-distance_sensor instances

* update submodule Tools/sitl_gazebo

* sitl_gazebo: add updated iris_obs_avoid; simulator: cleanup distance_sensor topic init

* update submodule Tools/sitl_gazebo

* simulator: delete _dist_pubs uORB::PublicationMulti<distance_sensor_s> in simulator destructor
2020-02-14 11:32:28 +01:00
Lorenz Meier
7e39ef8b8f MAVLink sim: Start faster
This reduces test times across the board.
2020-01-28 08:59:25 +01:00
Daniel Agar
4fef3dd7d5 simulated sensors minor cleanup
- mavlink receiver use PX4Accelerometer/PX4Gyroscope for hil_sensor and hil_state_quaternion
 - simulator module remove unnecessary fake scaling
 - sih module remove unnecessary fake scaling
2020-01-24 12:50:22 -05:00
Beat Küng
0542ac0e5f fix simulator_mavlink: orb_copy requires a valid data pointer
orb_copy() just returns if data==nullptr.

Fixes lockstep for ekf2. estimator_status.time_slip now stays constant
after startup, even with high speedup factor and high system load.
2020-01-24 12:04:47 +01:00
Julian Oes
30edcad752 Revert "Simulator: Remove EKF2 based wait"
This reverts commit 1834c156d280b7562945d61ac7a711c59eb3754b.
2020-01-24 12:04:47 +01:00
Daniel Agar
de4f594937 DriverFramework purge
The bulk of this change was tightly coupled and needed to be deleted in one pass. Some of the smaller changes were things that broke as a result of the initial purge and subsequently fixed by further eradicating unnecessary platform differences. Finally, I deleted any dead code I came across in the related files I touched while going through everything.

 - DriverFramework (src/lib/DriverFramework submodule) completely removed
 - added dspal submodule in qurt platform (was brought in via DriverFramework)
 - all df wrapper drivers removed
 - all boards using df wrapper drivers updated to use in tree equivalents
 - unused empty arch/board.h on posix and qurt removed
 - unused IOCTLs removed (pub block, priv, etc)
 - Integrator delete methods only used from df wrapper drivers
 - commander: sensor calibration use "NuttX version" everywhere for now
 - sensors: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
 - battery_status: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
 - cdev cleanup conflicting typedefs and names with actual OS (pollevent_t, etc)
 - load_mon and top remove from linux boards (unused)
 - delete unused PX4_MAIN_FUNCTION
 - delete unused getreg32 macro
 - delete unused SIOCDEVPRIVATE define
 - named each platform tasks consistently
 - posix list_devices and list_topics removed (list_files now shows all virtual files)
2020-01-13 14:07:03 -05:00
Daniel Agar
d32a80df3a
simulator: replace gpssim with simple orb publication
- this is one of the last pieces of the system that still depend on DriverFramework
 - add new SIM_GPS_NOISE_X parameter for optionally increasing the GPS noise multiplier (was previously a gpssim command line option)
 - add SIM_x_BLOCK parameters to block sensor publication
   - SIM_GPS_BLOCK
   - SIM_ACCEL_BLOCK
   - SIM_GYRO_BLOCK
   - SIM_MAG_BLOCK
   - SIM_BARO_BLOCK
   - SIM_DPRES_BLOCK
2020-01-09 10:30:20 -05:00
Lorenz Meier
1834c156d2 Simulator: Remove EKF2 based wait
This is cleaner and needs testing.
2019-12-26 10:16:58 +01:00
Julian Oes
3a228622b9 mavsdk_tests: fix verbose output 2019-12-26 10:16:58 +01:00
Julian Oes
8817f172ea simulator: cleanup and wait for startup
Unfortunately this commit contains two things:
1. Some cleanup and renaiming.
2. An additional wait until lockstep has been initialized.
   By waiting until HIL_SENSOR messages arrive including timestamps we
   stop the startup script and prevent other modules from running until
   time is set up. This should resolve some busy waiting by various
   modules and prevent races on initialization (e.g. the landing state
   being subscribed by mavlink before being published by the land
   detector).
2019-12-26 10:16:58 +01:00
Lorenz Meier
acd18adc18 Tests: Speed up boot
The previous boot configuration took at minimum one second to boot. This is in particular significant in tests when the system is often started and stopped
2019-12-23 23:08:05 +01:00
Daniel Agar
de9e4dda4c battery: delete unused armed 2019-12-12 09:48:45 -05:00
Timothy Scott
d7bb5d46bb Created new AnalogBattery class 2019-12-05 16:38:04 +01:00
Timothy Scott
bff1df7080 Refactored battery library for multiple instances 2019-12-05 16:38:04 +01:00
Daniel Agar
c04713f4a8 simulator update orb usage 2019-11-30 15:52:53 -05:00
Julian Oes
a6a8877463 simulator: don't reset battery when disarmed
Before this change, the battery percentage is reset to 100% as soon as
the drone is disarmed again. In my opinion it is more realistic if the
batteries don't magically fill up again but stay low.
2019-10-30 15:45:44 -04:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01:00
Patrick Servello
47e668eb86 simulator and dumpfile fix minor resource leaks
* Certain conditional branches returned before closing the file handler.
2019-09-09 13:24:07 -04:00
Daniel Agar
2ad12d7977
sensors: create vehicle_angular_velocity module (#12596)
* split out filtered sensor_gyro aggregation from mc_att_control and move to wq:rate_ctrl
2019-08-06 12:55:25 -04:00
Martina Rivizzigno
aff131774e simulator mavlink: add horizontal and vertical fov + quaterion orientation
to distance sensor
2019-07-15 10:58:00 +02:00
alessandro
fecb32f88d
Parameter for virtual battery in SITL (#12299)
* New parameter for virtual battery in SITL

* Update src/modules/simulator/simulator_mavlink.cpp

Co-Authored-By: Beat Küng <beat-kueng@gmx.net>

* Updated description for parameter SIM_BAT_MIN_PCT
2019-07-02 15:53:18 +02:00
rfauvet
755eccbe60 simulator: fixing missing declaration
The "len" variable was not defined and gave me an error, declaring it as "int" fixed it
2019-06-03 10:02:36 -04:00
Daniel Agar
43e3fc707d
simulator move to PX4Accelerometer, PX4Gyroscope, PX4Magnetometer, PX4Barometer helpers (#12081) 2019-05-30 21:07:26 -04:00
Julian Oes
4d7a1afd92 Revert "Revert "simulator: remove hack for diff_pressure noise""
This reverts commit 2142459027ffee7e9a18d466fcd4f8cd0a9613d2.
2019-05-29 08:56:33 -04:00
Daniel Agar
2142459027 Revert "simulator: remove hack for diff_pressure noise"
This reverts commit 4a71984f77249230787b7d263d866d6cfa78a7ac.
2019-04-29 10:46:38 -04:00
Julian Oes
4a71984f77 simulator: remove hack for diff_pressure noise
The noise for airspeed is now applied on the Gazebo side and we can
remove this hack.
2019-04-28 18:22:21 -04:00
Mark Sauder
74bc6870ed simulator: uorb and initialization cleanup (#11825)
* Cherry pick the vehicle_imu PR #9756 src/modules/simulator directory work to submit as standalone PR.

* Modify the accelsim init method mag_report usage to match usage in measure() and mag_measure() methods in the class.

* Incorporate review comments in the accelsim.cpp init() method and also make the same modifications in gyrosim.cpp.

* Delete unneeded mag_report initialization from accelsim init() method.

* Deprecate unneeded measure() call from accelsim.cpp init() and gyrosim.cpp init().
2019-04-16 08:29:53 +02:00
bresch
6c823903bc Parameter update - Rename variables in modules/simulator
using parameter_update.py script
2019-04-03 15:38:50 +02:00
mcsauder
a6315d4e6e Delete Simulator class subscription vars that are not used and add orb_unsubscribe() calls. 2019-03-18 10:00:39 +01:00
mcsauder
d12cec81ba Add const specifier to remaining methods utilizing mavlink_message_t and similar message pointer types. 2019-03-07 08:22:44 +01:00
mcsauder
278fddb585 Cut case MAVLINK_MSG_ID_ODOMETRY content and paste into handle_message_odometry() method. 2019-03-07 08:22:44 +01:00
mcsauder
3918d0ce0a Cut case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE content and paste into handle_message_vision_position_estimate() method. Add const specifier to publish_odometry_topic() method. 2019-03-07 08:22:44 +01:00
mcsauder
c3acd3bad3 Delete unnecessary curly braces in simulator_mavlink.cpp 2019-03-07 08:22:44 +01:00
mcsauder
e43a0bbf1d Cut case MAVLINK_MSG_ID_RC_CHANNELS content and paste into handle_message_rc_channels() method. 2019-03-07 08:22:44 +01:00