diff --git a/msg/att_pos_mocap.msg b/msg/att_pos_mocap.msg index 52bc04b5aa..6c007a6393 100644 --- a/msg/att_pos_mocap.msg +++ b/msg/att_pos_mocap.msg @@ -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 diff --git a/src/modules/local_position_estimator/sensors/mocap.cpp b/src/modules/local_position_estimator/sensors/mocap.cpp index 8319fc403f..c629b3f17b 100644 --- a/src/modules/local_position_estimator/sensors/mocap.cpp +++ b/src/modules/local_position_estimator/sensors/mocap.cpp @@ -47,7 +47,7 @@ int BlockLocalPositionEstimator::mocapMeasure(Vector &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; } diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index b366c9940e..aca7f71077 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -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]; diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index b9c7690a7e..81f123ef03 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -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];