mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 11:06:04 +08:00
microRTPS: use package.version to compare FastRTPS lib versions
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
@# - ids (List) list of all RTPS msg ids
|
||||
@###############################################
|
||||
@{
|
||||
from packaging import version
|
||||
import genmsg.msgs
|
||||
|
||||
from px_generate_uorb_topic_helper import * # this is in Tools/
|
||||
@@ -86,7 +87,7 @@ static constexpr int64_t TRIGGER_RESET_THRESHOLD_NS = 100ll * 1000ll * 1000ll;
|
||||
static constexpr int REQUEST_RESET_COUNTER_THRESHOLD = 5;
|
||||
|
||||
@# Sets the timesync DDS type according to the FastRTPS and ROS2 version
|
||||
@[if fastrtps_version <= 1.7]@
|
||||
@[if version.parse(fastrtps_version) <= version.parse('1.7')]@
|
||||
@[ if ros2_distro]@
|
||||
using timesync_msg_t = @(package)::msg::dds_::Timesync_;
|
||||
@[ else]@
|
||||
@@ -213,7 +214,7 @@ private:
|
||||
inline void updateOffset(const uint64_t& offset) { _offset_ns.store(offset, std::memory_order_relaxed); }
|
||||
|
||||
/** Timesync msg Getters **/
|
||||
@[if fastrtps_version <= 1.7 or not ros2_distro]@
|
||||
@[if version.parse(fastrtps_version) <= version.parse('1.7') or not ros2_distro]@
|
||||
inline uint64_t getMsgTimestamp(const timesync_msg_t* msg) { return msg->timestamp_(); }
|
||||
inline uint8_t getMsgSysID(const timesync_msg_t* msg) { return msg->sys_id_(); }
|
||||
inline uint8_t getMsgSeq(const timesync_msg_t* msg) { return msg->seq_(); }
|
||||
@@ -228,7 +229,7 @@ private:
|
||||
@[end if]@
|
||||
|
||||
/** Timesync msg Setters **/
|
||||
@[if fastrtps_version <= 1.7 or not ros2_distro]@
|
||||
@[if version.parse(fastrtps_version) <= version.parse('1.7') or not ros2_distro]@
|
||||
inline uint64_t setMsgTimestamp(timesync_msg_t* msg, const uint64_t& timestamp) { msg->timestamp_() = timestamp; }
|
||||
inline uint8_t setMsgSysID(timesync_msg_t* msg, const uint8_t& sys_id) { msg->sys_id_() = sys_id; }
|
||||
inline uint8_t setMsgSeq(timesync_msg_t* msg, const uint8_t& seq) { msg->seq_() = seq; }
|
||||
|
||||
Reference in New Issue
Block a user