294 Commits

Author SHA1 Message Date
Daniel Agar
d5839e2dd5 optical flow sensor pipeline overhaul
- all sources of optical flow publish sensor_optical_flow
 - sensor_optical_flow is aggregated by the sensors module, aligned with integrated gyro, and published as vehicle_optical_flow

Co-authored-by: alexklimaj <alex@arkelectron.com>
2022-06-20 20:56:56 -04:00
Silvan Fuhrer
4dbe6f0a1c simulator_mavlink: fix MAV_TYPE_VTOL_TAILSITTER case
This type (23) doesn't specify a motor number, so it can't be properly handled.
There are duo (19) and quad (20) tailsitter types that still work in simulation.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-05-24 17:58:44 -04:00
Alessandro Simovic
4640f395d7 simulator_mavlink: Add ESC telemetry 2022-05-12 07:58:56 +02:00
Daniel Agar
f390f52058 drivers/differential_pressure: remove lib/drivers/airspeed dependency and cleanup
- split ms4525_airspeed into separate ms4515 and ms4525 drivers
2022-04-26 08:39:19 -04:00
Daniel Agar
d1d15a6f6d differential pressure remove filters from drivers and average in sensors/airspeed 2022-04-26 08:39:19 -04:00
Daniel Agar
98623f69a3 update mavlink submodule to latest
- update MAV_TYPE VTOL usage for current mavlink
2022-04-07 20:35:41 +02:00
RomanBapst
18074dec5a simulator: fix conversion from hPa to Pa
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-03-29 17:41:54 +03:00
Daniel Agar
0c31f63896 sensors: add baro calibration and cleanup
- sensor_baro.msg use SI (pressure in Pascals)
 - update all barometer drivers to publish directly and remove PX4Barometer helper
 - introduce baro cal (offset) mainly as a mechanism to adjust
relative priority
 - commander: add simple baro cal that sets baro offsets to align with
GPS altitude (if available)
 - create new sensors_status.msg to generalize sensor reporting
2022-03-26 16:08:41 -04:00
Beat Küng
9b629a9e95 hitl,sitl,sih: use separate actuator_outputs_sim for SYS_CTRL_ALLOC==1
- removes the need to do type-specific rescaling of pwm to normalized values
- allows to run physical output drivers alongside HIL/SIH
2022-02-25 08:30:58 +01:00
Daniel Agar
90358f078f add odometry reset counter (ekf2, mavlink, etc) 2022-01-31 09:19:36 -05:00
Beat Küng
a4ca298ee9 simulator_mavlink: handle MAV_TYPE_VTOL_RESERVED3 2021-12-10 09:03:08 -05:00
Matthias Grob
10ceea2fe6 geo: refactoring on comments and usage 2021-12-06 14:30:14 +01:00
Thomas Debrunner
8db7a6225b geo: Moved the map_projection_* functions and state into a self-contained C++ class 2021-12-06 14:30:14 +01:00
wangwwno1
7a1a4ea7a6 Format fix & Remove redundant lines 2021-11-20 16:13:46 +01:00
wangwwno1
51ce8306ee Remove redundant code out of hil_lpos 2021-11-20 16:13:46 +01:00
wangwwno1
b2c5919d29 Update src/modules/simulator/simulator_mavlink.cpp
Co-authored-by: JaeyoungLim <jalim@ethz.ch>
2021-11-20 16:13:46 +01:00
wangwwno1
160fec5f25 Update simulator_mavlink.cpp 2021-11-20 16:13:46 +01:00
wangwwno1
6e2060ddb6 Add accel to vehicle_local_position_groundtruth
Related Issue: #18527 
According to [this doc](92b1a43468/common/mavlink_msg_hil_state_quaternion.h (L102)), the *acc value are mili-Gee, so multiply the value with `CONSTANT_ONE_G/1000.0f` would get the acceleration in `m/s`.
2021-11-20 16:13:46 +01:00
Daniel Agar
883624d915 lib/geo: move from ecl 2021-07-15 10:38:24 -04:00
Daniel Agar
39c96a8884 gps add device_id 2021-04-08 08:27:07 +02:00
obicons
a7e920d276 Updated MavlinkReceiver::handle_message_landing_target to warn users when they provide a landing target with an unsupported coordinate frame.
Updated Simulator::handle_message_landing_target to warn users when they provide a landing target that is not relative to a captured image.
2021-04-06 16:02:54 -04:00
Daniel Agar
4189eb11f5 simulator: GPS populate all sensor_gps fields (alt_ellipsoid, etc) 2021-04-06 09:44:18 -04:00
Chris Lovett
292a66ce41
Add support for simulators running on a different host than the PX4 instance 2021-03-31 20:56:38 -04:00
Daniel Agar
263b00b65f
ekf2 support SET_GPS_GLOBAL_ORIGIN and remove globallocalconverter usage
- vehicle_command cmd extended from uint16 to support PX4 internal commands that don't map to mavlink
2021-03-05 18:25:14 -05:00
Daniel Agar
9d47f7ecda simulator: make first accel/gyro simulated FIFO 2021-02-26 18:40:37 -05:00
JacobCrabill
e49717513c simulator: Fix distance sensor device_id
Also add DRV_DIST_DEVTYPE_SIM
2021-01-27 17:02:20 -05:00
Daniel Duecker
f9e07337f8
fix submarine sitl: indicate motor channel range 0..1 or -1..1 in simulation_mavlink.cpp (#16637)
change motor_count variable to 'pos_thrust_motor_count'
This is more specific to what is actually happening in the code.
'pos_thrust_motors_count' indicates number of motor channels which are configured with 0..1 range (positive thrust) all other motors are configured for -1..1 range

submarine only have motors with -1..1 range.
Thus, pos_thrust_motor_count = 0

Co-authored-by: Thies Lennart Alff <33184858+lennartalff@users.noreply.github.com>
2021-01-25 14:17:24 +01:00
Muesli_Reep
fe7908feb0
Simulator: Added remote host option (#15443)
* Added an option to the Simulator module to connect to remote Gazebo servers.

This is usefull when the Gazebo simulation is running on a different host than the PX4 instance.
For example, we are running instances of PX4 with a companion application in multiple Dockers, for swarming simulations, which then connect to a remote Gazebo server.

A "-t" input argument has been added and can be called from the rcS startup script as: simulator start -t "192.168.178.122" $simulator_tcp_port

* _tcp_remote_ipaddr defaults to nullptr. This way testing against nullptr it can be determined if localhost or remote host is desired by the user.
* Documented the option in usage().

Signed-off-by: Peter Blom <peterblom.mail@gmail.com>
2021-01-10 18:37:37 +01:00
Lorenz Meier
a34e57a4cc Simulator: Increase stack, publication affinity
This commit increases the send thread stack size and changes the thread affinity of the lockstep clocking topic. It also improves verbosity in case error states occur.
2020-12-31 01:05:30 +01:00
BazookaJoe1900
bd09be43c0
simulator mavlink actuator limits (#15861)
using unified way to decide which output should be scale as rotor
fixed case that actuator that wasn't set (value 0 "PWM") results output of -3
make default actuator mode to set all actuator to range of -1 to +1
cleanups
2020-11-26 14:42:31 +01:00
Thies Lennart Alff
82988b1912
airframes: added BlueROV2 (heavy configuration) airframe (#16004) 2020-10-28 11:07:31 +01:00
Daniel Agar
0f411d6820
Multi-EKF support (ekf2)
- ekf2 can now run in multi-instance mode (currently up to 9 instances)
    - in multi mode all estimates are published to alternate topics (eg estimator_attitude instead of vehicle_attitude)
 - new ekf2 selector runs in multi-instance mode to monitor and compare all instances, selecting a primary (eg N x estimator_attitude => vehicle_attitude)
 - sensors module accel & gyro inconsistency checks are now relative to the mean of all instances, rather than the current primary (when active ekf2 selector is responsible for choosing primary accel & gyro)
 - existing consumers of estimator_status must check estimator_selector_status to select current primary instance status
 - ekf2 single instance mode is still fully supported and the default

Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
2020-10-27 10:56:11 -04:00
JaeyoungLim
46d79d3050
Remove exception of actuator scaling for airships (#16011)
This removes the exception handling of airship type vehicles when scaling actuators for the simulator
2020-10-22 10:37:03 +02:00
Daniel Agar
0a985638e3 simulator: add inject failure messages for logging 2020-10-10 20:03:50 -04:00
Daniel Agar
378cb155d6
simulator: support accel/gyro instances and stuck failure
- expand simulator to 3 accels and gyros
 - PX4Accelerometer/PX4Gyroscope switch to old param usage due to copy constructor issues with ModuleParams
2020-10-07 13:20:13 -04:00
Daniel Agar
fe6a1ce882
simulator: fix airspeed temperature
- HIL_SENSOR temperature is only being sent with barometer data
2020-09-28 12:56:56 -04:00
Jacob Dahl
a24488328f
Move GPS blending from ekf2 to sensors module
- new sensors work item that subscribes to N x sensor_gps and publishes vehicle_gps_position
 - blending is now configurable with SENS_GPS_MASK and SENS_GPS_TAU

Co-authored-by: Jacob Crabill <jacob@volans-i.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2020-09-25 23:28:31 -04:00
Julian Oes
9ed07a7873 simulator: fix temperature setting after rebase 2020-09-16 12:51:56 -04:00
Julian Oes
a37b839e27 simulator: add missing timestamp 2020-09-16 12:51:56 -04:00
Julian Oes
4d76ed34f3 simulator: update temperature in sync with baro
This fixes the case where the baro was not rejected if stuck because the
temperature still varied.
2020-09-16 12:51:56 -04:00
Julian Oes
c31246e13a mavsdk_tests: add test for stuck mag 2020-09-16 12:51:56 -04:00
Julian Oes
afcfa2fbe0 mavsdk_tests: check for stuck baro 2020-09-16 12:51:56 -04:00
Julian Oes
a9c4f269bd simulator: use failure injection to block GPS
This uses the new failure injection system using vehicle_commands
instead of specific parameters. For now it implements GPS only.
2020-09-16 12:51:56 -04:00
Daniel Agar
5017a7e33a
simulator: publish 2 instances of accel/baro/gyro/mag 2020-09-02 10:42:02 -04:00
Daniel Agar
97fc1db768 vehicle_local_position: rename yaw -> heading and add reset logic
- vehicle_global_position yaw removed (redundant)
2020-08-10 11:42:03 +02:00
Daniel Leonard Robinson
fa4818e467
vehicles: add new vehicle type: Airship (#14862)
Co-authored-by: Anton Erasmus <anton@flycloudline.com>
Co-authored-by: Beat Küng <beat-kueng@gmx.net>
2020-08-10 08:52:51 +02:00
Daniel Agar
55808ed2f9
simulator: break out standalone battery simulator module
- this is a small step towards unifying SITL & HITL
2020-06-24 10:39:21 -04:00
Beat Küng
71dcf8d619 sitl: use lockstep components API
- avoids the need for ekf2_timestamp publications by q and lpe
- adds logger to the lockstep cycle and makes it poll on ekf2_timestamps
  or vehicle_attitude. This avoids dropped samples (required for replay).
2020-06-23 11:53:55 -04:00
TSC21
b3bbc351ca mavlink: DISTANCE_SENSOR: propagate signal_quality metric 2020-06-20 22:25:37 +01:00
Daniel Agar
b1e360e332 simulator: only use temperature if baro updated 2020-06-18 21:34:58 -04:00