172 Commits

Author SHA1 Message Date
Julian
3e87013936 simulator: fix TCP on Cygwin-Windows
It turns out that `sendto` does not work for TCP on Cygwin-Windows,
instead we need to use `send`. This required some refactoring since we
need to have the internet protocol and the port stored as a member
variable.

This should fix that lockstep SITL simulation was not working on
Windows.
2018-12-27 07:49:12 +01:00
Julian Oes
a1fc44d1f0 simulator: fix noise in airspeed
It turns out the noise of the airspeed depends on the least significant
bit of time which is now always 0 because time is quite regular with
lockstep. Therefore, we need a better source for the randomness. I chose
to use the sign of the y-gyro and it seems to work.
2018-12-22 10:32:18 +01:00
Julian Oes
1b685de70d simulator: raise timeout
This is not suposed to ever trigger anyway.
2018-12-22 10:32:18 +01:00
Julian Oes
8b2c47523f simulator: set socket options after opening socket 2018-12-22 10:32:18 +01:00
Julian Oes
e4af97b11b simulator: fix printf format 2018-12-22 10:32:18 +01:00
Julian Oes
564cae86b5 simulator: remove doubled tcgetattr call 2018-12-22 10:32:18 +01:00
Julian Oes
8a5e0558e4 simulator: improve a couple of error messages 2018-12-22 10:32:18 +01:00
Julian Oes
f36f85010c simulator: fix casting warning on Windows 2018-12-22 10:32:18 +01:00
Julian Oes
22b584b3b4 simulator: fix TCP connection init on macOS
When `connect()` fails, the state of the socket is unspecified and we
need to close the it and create it again.

It turns out retrying connect worked on Linux but it didn't on macOS.
2018-12-22 10:32:18 +01:00
Julian Oes
107606e757 simulator: set device_ids when publishing directly
Without setting the device_id, the preflight checks fail because the
calibration is not found.
2018-12-22 10:32:18 +01:00
Julian Oes
6d7fb232dd simulator: added TCP, general cleanup, lockstep
This adds the option to connect over UDP or TCP for mavlink to the
SITL simulator.

Also, this includes a bunch of general cleanup and refactoring of the
simulator interface code. For instance sending of mavlink messages was
put into separate functions and unneccessary comments were removed.

Also, this now sets the timestamp sent by the SITL simulator in the
HIL_SENSOR message in order to enable lockstep.
2018-12-22 10:32:18 +01:00
Julian Oes
a7e93bc2da simulator: removed leftover (wrong) comment 2018-12-22 10:32:18 +01:00
Julian Oes
3e6e1f5c2b POSIX: use lockstep_scheduler to fake time
This integrates the lockstep_scheduler, so that the system time is set
by the mavlink HIL_SENSOR message.

This means that the speed factor is removed and the speed is entirely
given by the simulator.
2018-12-22 10:32:18 +01:00
Julian Oes
5b9dea5604 Replacing usleep with px4_usleep
This is a step towards isolating time from the system.
2018-12-22 10:32:18 +01:00
Daniel Agar
571364c617 delete baro_report (alias for sensor_baro_s) 2018-11-06 07:43:43 +08:00
Daniel Agar
acc24da0c2 delete gyro_report (alias for sensor_gyro_s) 2018-11-06 07:43:43 +08:00
Daniel Agar
2a83a40491 delete accel_report (alias for sensor_accel_s) 2018-11-06 07:43:43 +08:00
MaEtUgR
4f0e090e88 drv_rc_input: replace useless rc_input_values define 2018-09-21 16:26:27 +02:00
TSC21
095cdeb4b0 add a local frame of reference field to vehicle_odometry 2018-09-18 09:52:33 +02:00
TSC21
cc73f214d1 add covariance matrices index aliases 2018-09-18 09:52:33 +02:00
TSC21
6329f1a38a small fix on cov passing loop 2018-09-18 09:52:33 +02:00
TSC21
746250d86d use static_assert over covariance matrices URT array size 2018-09-18 09:52:33 +02:00
TSC21
7db57bedb7 assert over the covariance matrices URT size matching 2018-09-18 09:52:33 +02:00
TSC21
8325724079 general fixes on VIO data access 2018-09-18 09:52:33 +02:00
TSC21
04dc6bc04a simulator: add ODOMETRY Mavlink msg handler 2018-09-18 09:52:33 +02:00
TSC21
183a63cce9 purge vehicle_vision_position alias 2018-09-18 09:52:33 +02:00
Roman Bapst
2d59ead1bf simulator: add MAV_TYPE to module parameters (#10476)
- this ensures that the MAV_TYPE parameter is always updated
- previously it could happen that the simulator module was using a wrong
MAV_TYPE value because it only read the parameter value at initialisation

Signed-off-by: Roman <bapstroman@gmail.com>
2018-09-13 21:56:21 -04:00
Beat Küng
e6b9806ee1 SITL: add multi-vehicle support to rcS
This also removes the HIGHRES_IMU mavlink stream to the GCS. I don't see
why it's needed and it adds noticeable CPU load.
2018-08-13 21:50:14 -04:00
Beat Küng
4b42cfaa6c
simulator_mavlink: improve error output 2018-07-31 11:51:15 +02:00
Philipp Oettershagen
da2fbf60b5 distance sensors: Improve variable naming / description 2018-07-16 21:59:04 +10:00
Philipp Oettershagen
35bde5c9fc LL40LS: Implement driver-specific filtering based on the datasheet and experiments 2018-07-16 21:59:04 +10:00
Daniel Agar
1b33445c7b simulator mavlink set lpos ground truth limits to infinity 2018-06-09 17:24:35 -04:00
Mohammed Kabir
31aa1cbf01 simulator : publish optical flow limits over uORB 2018-06-09 13:38:04 +02:00
Daniel Agar
d75fd72c02 stop manually defining physical constants 2018-04-19 07:24:58 +02:00
Daniel Agar
3b5b12e1d1 move baro and magnetometer data out of sensor_combined 2018-04-11 23:26:58 -04:00
Paul Riseborough
3e6ba1d541 simulator: Use baro pressure direct from simulator 2018-04-11 23:26:58 -04:00
Daniel Agar
5dc23def2a move pressure altitude from baros to sensors module 2018-04-11 23:26:58 -04:00
Daniel Agar
29b3950747 move geo and geo_lookup to PX4/ecl 2018-03-26 23:16:55 -04:00
Roman
2549b702f0 pwm_out_sim, simulator_mavlink: fixed code style
Signed-off-by: Roman <bapstroman@gmail.com>
2018-02-22 15:10:22 -05:00
Roman
ddb2dd89db simulator mavlink: support for quad tiltrotor mav type
Signed-off-by: Roman <bapstroman@gmail.com>
2018-02-22 15:10:22 -05:00
Paul Riseborough
64551607bc simulator: update local_position publication
Ensure all data is set.
2018-01-29 22:30:34 +01:00
ChristophTobler
3a52e7ee5d simulator mavlink: set vision pos/val valid 2018-01-15 11:11:56 +01:00
Nicolas de Palezieux
f600cfbb9f Add support for testing precision landing in SITL simulation 2018-01-15 10:27:23 +01:00
Matthias Grob
385212f2c1 Simulator: virtual battery drain stops by default at 50% to avoid failing preflight checks to take off again
also added comments and removed throttle compensation because there is no real battery emulation with load drop
2018-01-11 08:36:03 +01:00
Matthias Grob
bc15fdf267 Simulator: virtual battery drain simplified and stops when battery is exactly empty
it's a lot more readable and battery draining stops exactly at the empty battery voltage which makes debuging easier because it's directly predicatable
2018-01-11 08:36:03 +01:00
stmoon
3e0b8b7016 remove unnecessary codes and follow code style 2018-01-06 15:21:17 +01:00
stmoon
447aa134db change mavlink version (1.0->2.0) for simulation 2018-01-06 15:21:17 +01:00
Daniel Agar
202c29154a simulator optimize GPS and battery
- GPS and battery were publishing at > 800Hz
2018-01-02 01:35:57 +01:00
Beat Küng
07d7b29729 simulator_mavlink: fix type passed to param_get() 2017-10-27 10:43:15 +02:00
Daniel Agar
b4755297ec delete control_state and cleanup vehicle_attitude (#7882) 2017-09-21 16:24:53 -04:00