Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Barry Xu <barry.xu@sony.com>
  • Loading branch information
Barry-Xu-2018 committed May 21, 2021
1 parent 4495ef3 commit 3f655d4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 5 additions & 3 deletions rmw_fastrtps_shared_cpp/src/qos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ bool fill_entity_qos_from_profile(
}

if (!is_rmw_duration_unspecified(qos_policies.lifespan)) {
entity_qos.lifespan().duration = rmw_time_to_fastrtps(qos_policies.lifespan);
entity_qos.lifespan().duration =
rmw_fastrtps_shared_cpp::rmw_time_to_fastrtps(qos_policies.lifespan);
}

if (!is_rmw_duration_unspecified(qos_policies.deadline)) {
entity_qos.deadline().period = rmw_time_to_fastrtps(qos_policies.deadline);
entity_qos.deadline().period =
rmw_fastrtps_shared_cpp::rmw_time_to_fastrtps(qos_policies.deadline);
}

switch (qos_policies.liveliness) {
Expand All @@ -127,7 +129,7 @@ bool fill_entity_qos_from_profile(
}
if (!is_rmw_duration_unspecified(qos_policies.liveliness_lease_duration)) {
entity_qos.liveliness().lease_duration =
rmw_time_to_fastrtps(qos_policies.liveliness_lease_duration);
rmw_fastrtps_shared_cpp::rmw_time_to_fastrtps(qos_policies.liveliness_lease_duration);

// Docs suggest setting no higher than 0.7 * lease_duration, choosing 2/3 to give safe buffer.
// See doc at https://github.com/eProsima/Fast-RTPS/blob/
Expand Down
6 changes: 3 additions & 3 deletions rmw_fastrtps_shared_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ __rmw_publisher_wait_for_all_acked(
eprosima::fastrtps::Duration_t timeout = rmw_time_to_fastrtps(wait_timeout);

ReturnCode_t ret = info->data_writer_->wait_for_acknowledgments(timeout);
if (ret == ReturnCode_t::RETCODE_OK) {
if (ReturnCode_t::RETCODE_OK == ret) {
return RMW_RET_OK;
} else {
return RMW_RET_TIMEOUT;
}

return RMW_RET_TIMEOUT;
}

rmw_ret_t
Expand Down
5 changes: 5 additions & 0 deletions rmw_fastrtps_shared_cpp/src/time_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

#include "time_utils.hpp"

namespace rmw_fastrtps_shared_cpp
{

eprosima::fastrtps::Duration_t
rmw_time_to_fastrtps(const rmw_time_t & time)
{
Expand All @@ -28,3 +31,5 @@ rmw_time_to_fastrtps(const rmw_time_t & time)
static_cast<int32_t>(clamped_time.sec),
static_cast<uint32_t>(clamped_time.nsec));
}

} // namespace rmw_fastrtps_shared_cpp
5 changes: 5 additions & 0 deletions rmw_fastrtps_shared_cpp/src/time_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

#include "fastdds/rtps/common/Time_t.h"

namespace rmw_fastrtps_shared_cpp
{

eprosima::fastrtps::Duration_t rmw_time_to_fastrtps(const rmw_time_t & time);

} // namespace rmw_fastrtps_shared_cpp

#endif // TIME_UTILS_HPP_

0 comments on commit 3f655d4

Please sign in to comment.