microRTPS bridge: fix templates for ROS2 usage

This commit is contained in:
TSC21
2019-10-14 16:37:17 +01:00
committed by Nuno Marques
parent 3007b0876c
commit 88a7e3df09
5 changed files with 101 additions and 5 deletions
+16
View File
@@ -93,9 +93,17 @@ void RtpsTopics::publish(uint8_t topic_ID, char data_buffer[], size_t len)
case @(rtps_message_id(ids, topic)): // @(topic)
{
@[ if 1.5 <= fastrtpsgen_version[0] <= 1.7]@
@[ if ros2_distro[0]]@
@(package[0])::msg::dds_::@(topic)_ st;
@[ else]@
@(topic)_ st;
@[ end if]@
@[ else]@
@[ if ros2_distro[0]]@
@(package[0])::msg::@(topic) st;
@[ else]@
@(topic) st;
@[ end if]@
@[ end if]@
eprosima::fastcdr::FastBuffer cdrbuffer(data_buffer, len);
eprosima::fastcdr::Cdr cdr_des(cdrbuffer);
@@ -150,9 +158,17 @@ bool RtpsTopics::getMsg(const uint8_t topic_ID, eprosima::fastcdr::Cdr &scdr)
if (_@(topic)_sub.hasMsg())
{
@[ if 1.5 <= fastrtpsgen_version[0] <= 1.7]@
@[ if ros2_distro[0]]@
@(package[0])::msg::dds_::@(topic)_ msg = _@(topic)_sub.getMsg();
@[ else]@
@(topic)_ msg = _@(topic)_sub.getMsg();
@[ end if]@
@[ else]@
@[ if ros2_distro[0]]@
@(package[0])::msg::@(topic) msg = _@(topic)_sub.getMsg();
@[ else]@
@(topic) msg = _@(topic)_sub.getMsg();
@[ end if]@
@[ end if]@
msg.serialize(scdr);
ret = true;