Browse Source

Mocap timestamp cleanup (#5021)

sbg
tommises 9 years ago committed by Lorenz Meier
parent
commit
4fa2c54485
  1. 3
      msg/att_pos_mocap.msg
  2. 2
      src/modules/local_position_estimator/sensors/mocap.cpp
  3. 2
      src/modules/mavlink/mavlink_messages.cpp
  4. 7
      src/modules/mavlink/mavlink_receiver.cpp

3
msg/att_pos_mocap.msg

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
uint32 id # ID of the estimator, commonly the component ID of the incoming message
uint64 timestamp_boot # time of this estimate, in microseconds since system start
uint64 timestamp_computer # timestamp provided by the companion computer, in us
uint64 timestamp_received # timestamp when the estimate was received
float32[4] q # Estimated attitude as quaternion

2
src/modules/local_position_estimator/sensors/mocap.cpp

@ -47,7 +47,7 @@ int BlockLocalPositionEstimator::mocapMeasure(Vector<float, n_y_mocap> &y) @@ -47,7 +47,7 @@ int BlockLocalPositionEstimator::mocapMeasure(Vector<float, n_y_mocap> &y)
y(Y_mocap_y) = _sub_mocap.get().y;
y(Y_mocap_z) = _sub_mocap.get().z;
_mocapStats.update(y);
_time_last_mocap = _sub_mocap.get().timestamp_boot;
_time_last_mocap = _sub_mocap.get().timestamp;
return OK;
}

2
src/modules/mavlink/mavlink_messages.cpp

@ -1741,7 +1741,7 @@ protected: @@ -1741,7 +1741,7 @@ protected:
if (_mocap_sub->update(&_mocap_time, &mocap)) {
mavlink_att_pos_mocap_t msg;
msg.time_usec = mocap.timestamp_boot;
msg.time_usec = mocap.timestamp;
msg.q[0] = mocap.q[0];
msg.q[1] = mocap.q[1];
msg.q[2] = mocap.q[2];

7
src/modules/mavlink/mavlink_receiver.cpp

@ -677,14 +677,13 @@ MavlinkReceiver::handle_message_att_pos_mocap(mavlink_message_t *msg) @@ -677,14 +677,13 @@ MavlinkReceiver::handle_message_att_pos_mocap(mavlink_message_t *msg)
mavlink_att_pos_mocap_t mocap;
mavlink_msg_att_pos_mocap_decode(msg, &mocap);
struct att_pos_mocap_s att_pos_mocap;
memset(&att_pos_mocap, 0, sizeof(att_pos_mocap));
struct att_pos_mocap_s att_pos_mocap = {};
// Use the component ID to identify the mocap system
att_pos_mocap.id = msg->compid;
att_pos_mocap.timestamp_boot = sync_stamp(mocap.time_usec);
att_pos_mocap.timestamp_computer = sync_stamp(mocap.time_usec); // Synced time
att_pos_mocap.timestamp = sync_stamp(mocap.time_usec);
att_pos_mocap.timestamp_received = hrt_absolute_time();
att_pos_mocap.q[0] = mocap.q[0];
att_pos_mocap.q[1] = mocap.q[1];

Loading…
Cancel
Save