Browse Source

replay: update & add some comments

sbg
Beat Küng 8 years ago committed by Lorenz Meier
parent
commit
ca05e64a9f
  1. 3
      msg/ekf2_replay.msg
  2. 4
      msg/ekf2_timestamps.msg
  3. 2
      src/modules/replay/replay.hpp
  4. 1
      src/modules/replay/replay_main.cpp

3
msg/ekf2_replay.msg

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
# uint64 timestamp # ekf2 reference time. This is a timestamp passed to the
# estimator which it uses a absolute reference.
float32 gyro_integral_dt # gyro integration period in s
float32 accelerometer_integral_dt # accelerometer integration period in s
uint64 magnetometer_timestamp # timestamp of magnetometer measurement in us

4
msg/ekf2_timestamps.msg

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
# this message contains the (relative) timestamps of the sensor inputs used by
# ekf2. It can be used for reproducible replay.
# timestamp # ekf2 reference time. This matches the timestamp of the
# sensor_combined topic.
# the timestamp field (auto-generated) is the ekf2 reference time and matches
# the timestamp of the sensor_combined topic.
int16 RELATIVE_TIMESTAMP_INVALID = 32767 # (0x7fff) If one of the relative timestamps

2
src/modules/replay/replay.hpp

@ -231,6 +231,7 @@ protected: @@ -231,6 +231,7 @@ protected:
* handle ekf2 topic publication in ekf2 replay mode
* @param sub
* @param data
* @param replay_file file currently replayed (file seek position should be considered arbitrary after this call)
* @return true if published, false otherwise
*/
bool handleTopicUpdate(Subscription &sub, void *data, std::ifstream &replay_file) override;
@ -245,6 +246,7 @@ private: @@ -245,6 +246,7 @@ private:
* find the next message for a subscription that matches a given timestamp and publish it
* @param timestamp in 0.1 ms
* @param msg_id
* @param replay_file file currently replayed (file seek position should be considered arbitrary after this call)
* @return true if timestamp found and published
*/
bool findTimestampAndPublish(uint64_t timestamp, uint16_t msg_id, std::ifstream &replay_file);

1
src/modules/replay/replay_main.cpp

@ -885,6 +885,7 @@ bool ReplayEkf2::publishEkf2Topics(const ekf2_timestamps_s &ekf2_timestamps, std @@ -885,6 +885,7 @@ bool ReplayEkf2::publishEkf2Topics(const ekf2_timestamps_s &ekf2_timestamps, std
{
auto handle_sensor_publication = [&](int16_t timestamp_relative, uint16_t msg_id) {
if (timestamp_relative != ekf2_timestamps_s::RELATIVE_TIMESTAMP_INVALID) {
// timestamp_relative is already given in 0.1 ms
uint64_t t = timestamp_relative + ekf2_timestamps.timestamp / 100; // in 0.1 ms
findTimestampAndPublish(t, msg_id, replay_file);
}

Loading…
Cancel
Save