Commit Graph

472 Commits

Author SHA1 Message Date
Beat Küng 399d4ef833 sensors: only poll on first gyro for now
This fixes a bug with following setup:
- two (or N > 1) connected gyros
- ekf2 enabled
In this case, sensors would publish with the combined rate of the gyros,
but with N following messages having the same gyro data & timestamp.
Apparently ekf2 cannot handle this, the other estimators can.

We may want to rethink what the proper solution is here.
2016-07-13 14:35:03 +02:00
Lorenz Meier a740d80a20 Mag voter: Be more forgiving on load changes 2016-07-11 15:16:35 +02:00
Beat Küng 9c73eae941 sensor_combined: replace accel & gyro integral with value, use float for dt
Reason: the value is easier to read & handle (for example plotting). In
most places the value is needed, not the integral.

Note that this breaks the replay format for sdlog2 replay
2016-07-07 11:35:50 +02:00
Beat Küng 8e136779ec stack sizes: reduce stack sizes for modules that use sensor_combined
The sensor_combined topic got reduced from ~780 bytes to 72 bytes.
2016-07-07 11:35:50 +02:00
Beat Küng c5ea4b43be sensor_combined.msg: make timestamps relative
This is needed for the new logger & saves some space as well.
2016-07-07 11:35:50 +02:00
Beat Küng c66f26245c sensor_combined.msg: use uint32 for integral_dt
There is no reason to make this 64 bit. The same should be done in
the sensor raw messages, together with further cleanup.
2016-07-07 11:35:50 +02:00
Beat Küng 30301187f0 cleanup sensors_init: remove the static const int ERROR and use PX4_ERROR 2016-07-07 11:35:50 +02:00
Beat Küng d846ad5dac sensors: move voting into sensors module
- voting is now at a central place instead of duplicated within the
  estimators
  -> this also means that estimators that did not do voting so far,
     now have voting, like ekf2
- estimators requiring more than that can still subscribe to the raw
  sensors
- allows sensors_combined to be 3 times smaller
  - reduces logger, memcpy (cache) & RAM overhead
- all modules requiring only 1 or 2 sensor values now automatically get
  the voted result
- this also adds voting to baro
2016-07-07 11:35:50 +02:00
Beat Küng c50d267bfb sensors: cleanup includes and logging (warnx -> PX4_WARN/ERR/INFO) 2016-07-07 11:35:50 +02:00
Beat Küng b4ecc5a8d9 sensor_combined cleanup: remove many unneeded fields
Decreases the message size from 780 to 280 bytes.
In particular, all modules using sensor_combined must use the integral now.
The sensor value can easily be reconstructed by dividing with dt.

Voters now need to be moved into sensors module, because error count and
priority is removed from the topic.

Any module that requires additional data from a sensor can subscribe to
the raw sensor topics.

At two places, values are set to zero instead of subscribing to the raw
sensors (with the assumption that no one reads them):
- mavlink mavlink_highres_imu_t::abs_pressure
- sdlog2: sensor temperatures
2016-07-07 11:35:50 +02:00
Beat Küng c407123a72 cleanup sensor_combined: remove adc & differential_pressure fields
These are not really used. differential_pressure is just copied from the
topic with the same name.

for sdlog2 we assume no one needs the diff pressure fields and set it to 0.
We plan to switch to the new logger soon anyway.
2016-07-07 11:35:50 +02:00
Beat Küng 2c2477a07d fix sensors leaks: unsubscribe topics when exiting 2016-07-07 11:35:50 +02:00
Beat Küng ac45c9001b sensors: cleanup syntax: replace &x[0] with x 2016-07-07 11:35:50 +02:00
Beat Küng 78b45c4778 sensors: remove duplicated initialization 2016-07-07 11:35:50 +02:00
Lorenz Meier d85e416680 Fix default handling for battery params 2016-07-02 12:59:49 +02:00
tumbili 7e282f579b sensors app: logic fixed and cleanup
- do not exit sensors app if sensor init failed
- do not spam console if we fail over first/second gyro

Signed-off-by: tumbili <roman@px4.io>
2016-07-01 23:11:38 +02:00
Daniel Agar cb320f6e8a param set default battery parameters (#4912) 2016-06-26 21:27:11 +02:00
Roman Bapst 571798c318 Pr external battery monitoring (#4881)
* mavlink receiver: added handling of battery status

handle incoming battery status messages in order to support external
battery monitoring

Signed-off-by: Roman <bapstr@ethz.ch>

* sensor params: added parameter for battery monitoring source

Signed-off-by: Roman <bapstr@ethz.ch>

* sensors: only publish battery status if we don't have external battery
monitoring activated

Signed-off-by: Roman <bapstr@ethz.ch>
2016-06-23 18:41:38 +02:00
Lorenz Meier 8ecada3f81 Sensors: Allow more headroom for stack 2016-06-10 21:28:05 +02:00
Andreas Antener 98eeb25e45 produce 0 voltage/current if no suitable default could be set 2016-06-07 22:27:08 +02:00
Lorenz Meier e1805dfe0c Sensors app: Use two parameters to convert battery current and voltage to make configuring custom frames easier 2016-06-07 22:27:08 +02:00
jwilson c6250657eb Added mag support to the DriverFramework mpu9250 driver. Shortened parameter names for legacy drivers. Added temporary ifdef's in the calibration code for Snapdragon Flight builds.
Signed-off-by: jwilson <jwilson@qti.qualcomm.com>
2016-05-31 16:43:12 +02:00
Lorenz Meier 0354ada5d3 Sensors: be more efficient 2016-05-29 16:27:39 +02:00
Lorenz Meier 0dc36d149e Sensors: Reinstate main stack 2016-05-27 23:12:07 +02:00
Lorenz Meier 24622131c9 Sensors: Reinstate boot stack 2016-05-27 23:11:51 +02:00
Lorenz Meier 761d02d433 Sensors: return stack handler to default stack size 2016-05-19 22:01:12 +02:00
Daniel Agar 1ecdb0f6fb adjust stack sizes 2016-05-19 21:49:34 +02:00
Daniel Agar 2487dbfc92 remove Wpacked and cleanup unused warning flags 2016-05-19 21:49:34 +02:00
Kabir Mohammed 1bd4dca266 Fix RPI2 defines 2016-05-19 15:41:50 +02:00
Daniel Agar 119fa8ed1b sensor_params.c param metadata 2016-05-13 21:15:34 -04:00
Lorenz Meier 0917a346e4 Mag cal: allow 6, 3 and 2 side calibrations (and anything in-between with bitfields) 2016-05-09 00:32:54 +02:00
Lorenz Meier ebaca071f6 Battery charge estimation: Factor in voltage drop for idle props 2016-05-06 18:14:34 +02:00
Lorenz Meier 5e099d8d16 sensors: Reduce perf counters 2016-05-05 20:09:09 +02:00
Lorenz Meier be467f606b Sensors: Use C++ init style 2016-05-01 16:25:25 +02:00
Lorenz Meier 088ee74591 Sensor params: Add two param handles that should have been there for a long time 2016-05-01 16:25:14 +02:00
Lorenz Meier bdd2070dd7 FMU driver: Report RSSI for RC
Move RSSI sampling into FMU driver from sensors
2016-05-01 15:48:50 +02:00
Lorenz Meier b5b4769d1f Enable RSSI sampling on Pixracer 2016-05-01 14:23:25 +02:00
Lorenz Meier d0dd52c0d6 Better param meta 2016-05-01 11:40:11 +02:00
Julian Oes eb1ab4011a sensors: the ifdef logic was inverted (#4401) 2016-04-29 16:21:52 +02:00
Julian Oes 234068989b sensors: treat RPi like QURT 2016-04-29 13:50:18 +02:00
Lorenz Meier 4a94835880 Fix formatting in sensors 2016-04-29 11:16:27 +02:00
Lorenz Meier 343b8fb50f Sensors app: Send proper throttle setting to battery charge level estimator 2016-04-29 11:02:51 +02:00
Julian Oes 08f88d006f sensors: use the empty sensor init for RPi as well
The RPi build is based on the same DriverFramework base like the QURT
build, therefore it should use the same empty sensor init function.
2016-04-29 10:02:53 +02:00
Lorenz Meier 4441b74020 sensors: Default battery to a 50% setting 2016-04-28 13:06:02 +02:00
Daniel Agar 41c1e56075 FW stabalized mode properly initialize att_sp 2016-04-23 15:50:43 +02:00
Lorenz Meier a49ba1a383 Sensors: Code style 2016-04-23 14:45:12 +02:00
Lorenz Meier 19f2a7bff0 Only publish battery if we can measure something, initialize battery topic in commander correctly 2016-04-23 14:29:25 +02:00
Lorenz Meier 7dae3abac9 Sensors: Adjust mode switch ranges 2016-04-18 18:29:21 +02:00
James Goppert 372de3fca9 Added LPE to testing, fix LPE logging, add SENS_EN_SF0X 2016-04-14 18:17:58 -04:00
James Goppert f73af95b38 Added SYS_MC_EST_GROUP to allow fine grained algorithm selection. 2016-04-14 15:22:25 -04:00