Fill in message_info timestamps (#163)

* Fill in message_info timestamps

Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com>

* Report error when timestamp cannot be obtained.

Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com>

* return 0 for received timestamp to signify lack of support

Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com>
This commit is contained in:
Ingo Lütkebohle 2020-04-23 23:29:39 +02:00 committed by GitHub
parent 0fc4a3f289
commit 27bc8194e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2137,6 +2137,7 @@ static rmw_ret_t rmw_take_int(
dds_sample_info_t info; dds_sample_info_t info;
while (dds_take(sub->enth, &ros_message, &info, 1, 1) == 1) { while (dds_take(sub->enth, &ros_message, &info, 1, 1) == 1) {
if (info.valid_data) { if (info.valid_data) {
*taken = true;
if (message_info) { if (message_info) {
message_info->publisher_gid.implementation_identifier = eclipse_cyclonedds_identifier; message_info->publisher_gid.implementation_identifier = eclipse_cyclonedds_identifier;
memset(message_info->publisher_gid.data, 0, sizeof(message_info->publisher_gid.data)); memset(message_info->publisher_gid.data, 0, sizeof(message_info->publisher_gid.data));
@ -2144,6 +2145,9 @@ static rmw_ret_t rmw_take_int(
memcpy( memcpy(
message_info->publisher_gid.data, &info.publication_handle, message_info->publisher_gid.data, &info.publication_handle,
sizeof(info.publication_handle)); sizeof(info.publication_handle));
message_info->source_timestamp = info.source_timestamp;
// TODO(iluetkeb) add received timestamp, when implemented by Cyclone
message_info->received_timestamp = 0;
} }
#if REPORT_LATE_MESSAGES > 0 #if REPORT_LATE_MESSAGES > 0
dds_time_t tnow = dds_time(); dds_time_t tnow = dds_time();
@ -2152,7 +2156,6 @@ static rmw_ret_t rmw_take_int(
fprintf(stderr, "** sample in history for %.fms\n", static_cast<double>(dt) / 1e6); fprintf(stderr, "** sample in history for %.fms\n", static_cast<double>(dt) / 1e6);
} }
#endif #endif
*taken = true;
return RMW_RET_OK; return RMW_RET_OK;
} }
} }