409 Commits

Author SHA1 Message Date
Julian Oes
c4cb916afa Fix sdlog2/logger path/file name overflows. (#5138)
* logger: prevent logpath buffer overflows

The handling of the log path had the potential to cause buffer
overflows, especially on POSIX platforms where the paths are often much
longer than just 64 chars.

* sdlog2: prevent logpath buffer overflows

When the log folder path was created, this was done with the unsafe
sprintf function instead of snprintf. This caused buffer overflows in
SITL but the overflow was usually not detected until recent testing of
some work in progress.
2016-07-27 00:55:29 -07:00
Beat Küng
ee58f0d11d encoders.msg: remove this topic, it's never published (#5074) 2016-07-15 14:59:52 -07:00
Julian Oes
ddba274496 sdlog2: fix poll_counter that I broke earlier 2016-07-07 16:48:27 +02:00
Julian Oes
03dbcf5464 sdlog2: don't forget to copy after poll
The previous changes broke sdlog2 on NuttX because no orb_copy was
called after polling in the case when sdlog2 was not actually logging.
2016-07-07 16:48:27 +02:00
Julian Oes
772dc302b6 sdlog2: raise min write size back
Turns out in practice there was not really a difference, so there was
no reason to change it.
2016-07-07 16:48:27 +02:00
Julian Oes
fe91527604 sdlog2: poll for sensor and replay on Snappy
This brings better performance, so less missed updates on Snappy, as
well as a bit of a cleanup of the poll and orb_copy logic.
2016-07-07 16:48:27 +02:00
Julian Oes
5f18f9bbba sdlog2: select MIN < MAX bytes to write
Previously, the MAX and MIN were both 512 meaning that usually it would
start writing at > 512 bytes but only write 512 bytes which results in
a 512 bytes write shortly followed by a e.g. 30 bytes write.

Also, performance (measured in missed poll updates) seems slightly
better on Snapdragon with bigger chunks.
2016-07-07 16:48:27 +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
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
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
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
James Goppert
00dfc99e08 LPE Variance Dependent Publication (#4914)
* Use variance to control publishing for LPE.

* Don't stop publishing if we have gps/ baro.

* LPE tuning and cleanup.

* Added bias saturation to LPE.

* Added vector enabled low pass filter block.

* Added rk4 integration and pub lowpass to LPE.

* Fix std::abs issue on mac/ reset lowpass on state reset.

* Don't estimate gyro bias when rotating at high speed  att_est_q.

* Lowered low pass on position to 5 Hz for LPE.

* Streamline state space update for LPE.

* Added health flags to est2 log.

* Revert to old tuning, more conservative, less faults.

* Formatting.

* Fix for fault message on LPE.

* Added subscription throttling to LPE.

* Formatting.
2016-07-01 11:43:09 -04:00
Julian Oes
f4f0892b25 sdlog2: no new sessXXX folder on every arm (#4775)
Previously, if no time was set, sdlog2 created a folder like sess001,
sess002 for every logfile. The logfiles would then always be named
log001.px4log and their numbering would not actually increase.

This is now fixed and a new folder is only created per boot.
2016-06-10 08:48:37 +02:00
CarlOlsson
9c170f7fae added parameter which defines threshold for airspeed given to the filter
remove unnecessary replay fields
2016-06-08 17:11:10 +02:00
Julian Oes
4827f0d931 sdlog2: removed a printf 2016-06-07 22:10:56 +02:00
Paul Riseborough
2e127a4737 sdlog2: Add external vision data to ekf2 replay
Put struct definitions in enum order
Fix duplicate enum value
Add ekf2 replay message for external vision data
2016-05-28 14:54:14 +02:00
Julian Oes
af06737e7e sdlog2: fix Segfault on Eagle (#4638)
Since orb_exist doesn't work on the Snapdragon Linux side, we need to do
an additional orb_check after the orb_subscribe_multi, otherwise we copy
garbage.

The segfault was triggered by a count/length information about ESC
packets which lead to access outside the struct in the garbage case.
2016-05-25 21:50:23 +02:00
Sebastian Verling
c1cdef7e63 fixed multi subscribing and publishing
removed debugging message

changed to orb_publish_auto
2016-05-22 12:19:47 +02:00
Andreas Bircher
556851a511 applying dual gps patch
resolve transfer errors

reformatting

implementing multi-topics
2016-05-22 12:19:47 +02:00
CarlOlsson
ee33f21303 added airspeed to ekf2 replay 2016-05-14 11:32:11 +02:00
Daniel Agar
76387b1693 uorb autogeneration 2016-05-14 11:27:07 +02:00
Daniel Agar
0042c8ed12 sdlog2.c param metadata 2016-05-13 21:03:40 -04:00
Julian Oes
30b6f9ff6c sdlog2: more merge conflict resolving 2016-05-12 08:16:36 +02:00
Julian Oes
b965554bdd sdlog2: move main state, fix formatting, fix bug
Since the vehicle_status topic has been split up, we can't publish it
together with the the split cpuload and commander_state topics.

Therefore, the log field STAT.MainState will change to COMM.MainState
because it is only the internal commander state. Important to the
outside is STAT.NavState.

Likewise, the log field STAT.Load becomes LOAD.CPU.
2016-05-12 08:16:36 +02:00
Jonathan Challinger
01305da7e7 sdlog2: subscribe to and use cpuload message instead of vehicle_status 2016-05-12 08:16:36 +02:00
Julian Oes
f6845df21f sdlog2: don't log an empty sensor_combined topic 2016-05-11 21:30:03 +02:00
Julian Oes
c8d888cdc1 sdlog2: fix wrong if (facepalm!) 2016-05-11 21:30:03 +02:00
Julian Oes
e00101e5ab sdlog2: remove duplicate orb_copy 2016-05-11 21:30:03 +02:00
Julian Oes
871c112699 sdlog2: log normal data and replay on Snapdragon
In SITL and on Snapdragon, the logging performance is high enough, so we
can log both: the usual topics, as well as the ekf2 replay fields.

Note that the ekf2 replay still needs to be enabled via param.
2016-05-11 21:30:03 +02:00
Paul Riseborough
4b8c7201b7 sdlog2: add logging of ekf2 internal fault message 2016-05-11 14:53:55 +02:00
Lorenz Meier
d017514d59 sdlog2: Start / stop logging on arming even if enabled already during boot 2016-05-11 14:46:23 +02:00
sander
9a09c5af5c Add low pass filtered current draw 2016-05-10 21:34:11 +02:00
CarlOlsson
6b5e77250f ekf2: Added airspeed to rpl logging 2016-05-10 21:32:55 +02:00
Julian Oes
ef6892a885 sdlog2 bugfix of vehicle_status conflicting with commander_state (#4402)
* sdlog2: move from STAT.MainState to COMM.MainState

This fixes a bug where vehicle_system_status and the commander internal
state were conflicting.

This will need adaptations in logging tools.

* sdlog2: don't bother changing STAT.MainState

For compatibility reasons, let's stick to the used log field (but still
fix the bug where the buffer (union) was overwrittern.
2016-04-29 17:16:45 +02:00
Lorenz Meier
d67ff7564f Fix sdlog2 race between copy and store 2016-04-28 12:20:16 +02:00
Lorenz Meier
e42b1dc948 Revert "fix bug in the logging app:"
This reverts commit 29c5c25f4712a85cad9d9eecb880ac0708f20d61.
2016-04-28 12:14:29 +02:00
Roman
29c5c25f47 fix bug in the logging app:
- either sensor combined or the replay topic where copied into
the union buffer but at times the memory was overwritten by other
topics which updated below
- this change makes sure that the two topics are copied into the union
buffer at the correct location in the code
2016-04-27 21:40:07 +02:00
Paul Riseborough
771d753419 sdlog2: log ekf2 GPS and control status flags 2016-04-20 21:47:29 +02:00
Lorenz Meier
b90f6dc157 Fix text print to logfile 2016-04-18 17:06:12 +02:00
Julian Oes
015d7431a7 sdlog2: comment fix 2016-04-12 13:13:50 +02:00
Julian Oes
1aa45cede8 sdlog2: workaround for Snapdragon
This fixes an issue where topics where not subscribed to on the Linux
side on Snapdragon. It's a hack until there is a proper fix for the
orb_exists() call.
2016-04-12 13:13:50 +02:00
Julian Oes
32f2b89252 sdlog2: comment fix 2016-04-11 18:01:49 +02:00
Julian Oes
3b806235ac sdlog2: compile fixes after rebase 2016-04-11 18:01:49 +02:00
Julian Oes
5ca5af5fcd commander: take main_state out of vehicle_status
This state is only commander internal. Therefore it doesn't need to be
in vehicle_status. Instead it is now in the commander_state message.
2016-04-11 18:01:48 +02:00
Julian Oes
1f44fb1efd commander: internalize system status bools
Most condition bools in the commander are not used anywhere but in the
commander. It therefore makes sense to move them to a different internal
struct and remove them from the vehicle_status message.

Also, the land_detected should be used by all the modules instead of
getting it through the commander and system_status.
2016-04-11 18:01:47 +02:00
Julian Oes
32c3135788 commander: move battery calculations to systemlib
The commander used to consume the battery_status topic and write the
contents after some calculations into the system state. Instead, the
calculations now happen in library calls in systemlib/battery.

This moves the battery fields out of the vehicle_status message into the
battery_status topic.

This brought quite some changes in all modules that need battery
information. The current state is compiling but untested.
2016-04-11 18:01:47 +02:00
Beat Küng
7ff80463be fix completely wrong file permissions for log files & mavlink ftp (new mode 666) 2016-04-11 11:23:01 +02:00
Julian Oes
2b95b3dff1 sdlog2: fixed wrong memset 2016-04-04 13:02:36 +02:00
Lorenz Meier
0d94800b50 VTOL: Add missing fields to log. Fixes #4080 2016-04-02 21:39:03 +01:00