Browse Source

Clamp RTPS -> uorb timestamps to system time

release/1.12
Julian Kent 4 years ago committed by Beat Küng
parent
commit
1011382098
  1. 6
      msg/templates/uorb_microcdr/microRTPS_client.cpp.em

6
msg/templates/uorb_microcdr/microRTPS_client.cpp.em

@ -218,6 +218,7 @@ void micrortps_start_topics(struct timespec &begin, uint64_t &total_read, uint64
while (0 < (read = transport_node->read(&topic_ID, data_buffer, BUFFER_SIZE))) while (0 < (read = transport_node->read(&topic_ID, data_buffer, BUFFER_SIZE)))
{ {
total_read += read; total_read += read;
uint64_t read_time = hrt_absolute_time();
switch (topic_ID) switch (topic_ID)
{ {
@[for idx, topic in enumerate(recv_topics)]@ @[for idx, topic in enumerate(recv_topics)]@
@ -225,6 +226,11 @@ void micrortps_start_topics(struct timespec &begin, uint64_t &total_read, uint64
{ {
@(receive_base_types[idx])_s @(topic)_data; @(receive_base_types[idx])_s @(topic)_data;
deserialize_@(receive_base_types[idx])(&reader, &@(topic)_data, data_buffer); deserialize_@(receive_base_types[idx])(&reader, &@(topic)_data, data_buffer);
if (@(topic)_data.timestamp > read_time)
{
// don't allow timestamps from the future
@(topic)_data.timestamp = read_time;
}
pubs->@(topic)_pub.publish(@(topic)_data); pubs->@(topic)_pub.publish(@(topic)_data);
++received; ++received;
} }

Loading…
Cancel
Save