mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 10:17:45 +08:00
microRTPS: use FastRTPS version instead of FastRTPSGen version to generate conditional code
This commit is contained in:
@@ -69,7 +69,7 @@ except AttributeError:
|
|||||||
|
|
||||||
#include <fastrtps/Domain.h>
|
#include <fastrtps/Domain.h>
|
||||||
|
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
#include <fastrtps/utils/eClock.h>
|
#include <fastrtps/utils/eClock.h>
|
||||||
@[end if]@
|
@[end if]@
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ bool @(topic)_Publisher::init()
|
|||||||
// Create RTPSParticipant
|
// Create RTPSParticipant
|
||||||
ParticipantAttributes PParam;
|
ParticipantAttributes PParam;
|
||||||
PParam.rtps.builtin.domainId = 0;
|
PParam.rtps.builtin.domainId = 0;
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7 or ros2_distro == "ardent" or ros2_distro == "bouncy" or ros2_distro == "crystal" or ros2_distro == "dashing"]@
|
@[if fastrtps_version <= 1.8]@
|
||||||
PParam.rtps.builtin.leaseDuration = c_TimeInfinite;
|
PParam.rtps.builtin.leaseDuration = c_TimeInfinite;
|
||||||
@[else]@
|
@[else]@
|
||||||
PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
|
PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
|
||||||
@@ -149,7 +149,7 @@ void @(topic)_Publisher::PubListener::onPublicationMatched(Publisher* pub, Match
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
void @(topic)_Publisher::publish(@(package)::msg::dds_::@(topic)_* st)
|
void @(topic)_Publisher::publish(@(package)::msg::dds_::@(topic)_* st)
|
||||||
@[ else]@
|
@[ else]@
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ except AttributeError:
|
|||||||
#include <fastrtps/fastrtps_fwd.h>
|
#include <fastrtps/fastrtps_fwd.h>
|
||||||
#include <fastrtps/publisher/PublisherListener.h>
|
#include <fastrtps/publisher/PublisherListener.h>
|
||||||
|
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
#include "@(topic)_PubSubTypes.h"
|
#include "@(topic)_PubSubTypes.h"
|
||||||
@[else]@
|
@[else]@
|
||||||
#include "@(topic)PubSubTypes.h"
|
#include "@(topic)PubSubTypes.h"
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
virtual ~@(topic)_Publisher();
|
virtual ~@(topic)_Publisher();
|
||||||
bool init();
|
bool init();
|
||||||
void run();
|
void run();
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
void publish(@(package)::msg::dds_::@(topic)_* st);
|
void publish(@(package)::msg::dds_::@(topic)_* st);
|
||||||
@[ else]@
|
@[ else]@
|
||||||
@@ -109,7 +109,7 @@ private:
|
|||||||
void onPublicationMatched(Publisher* pub, MatchingInfo& info);
|
void onPublicationMatched(Publisher* pub, MatchingInfo& info);
|
||||||
int n_matched;
|
int n_matched;
|
||||||
} m_listener;
|
} m_listener;
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
@(package)::msg::dds_::@(topic)_PubSubType @(topic)DataType;
|
@(package)::msg::dds_::@(topic)_PubSubType @(topic)DataType;
|
||||||
@[ else]@
|
@[ else]@
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from px_generate_uorb_topic_files import MsgScope # this is in Tools/
|
|||||||
send_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumerate(spec) if scope[idx] == MsgScope.SEND]
|
send_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumerate(spec) if scope[idx] == MsgScope.SEND]
|
||||||
recv_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumerate(spec) if scope[idx] == MsgScope.RECEIVE]
|
recv_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumerate(spec) if scope[idx] == MsgScope.RECEIVE]
|
||||||
package = package[0]
|
package = package[0]
|
||||||
fastrtpsgen_version = fastrtpsgen_version[0]
|
fastrtps_version = fastrtps_version[0]
|
||||||
try:
|
try:
|
||||||
ros2_distro = ros2_distro[0].decode("utf-8")
|
ros2_distro = ros2_distro[0].decode("utf-8")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
@@ -74,7 +74,7 @@ except AttributeError:
|
|||||||
|
|
||||||
|
|
||||||
@[for topic in recv_topics]@
|
@[for topic in recv_topics]@
|
||||||
@[ if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[ if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
using @(topic)_msg_t = @(package)::msg::dds_::@(topic)_;
|
using @(topic)_msg_t = @(package)::msg::dds_::@(topic)_;
|
||||||
@[ else]@
|
@[ else]@
|
||||||
@@ -89,7 +89,7 @@ using @(topic)_msg_t = @(topic);
|
|||||||
@[ end if]@
|
@[ end if]@
|
||||||
@[end for]@
|
@[end for]@
|
||||||
@[for topic in send_topics]@
|
@[for topic in send_topics]@
|
||||||
@[ if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[ if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
using @(topic)_msg_t = @(package)::msg::dds_::@(topic)_;
|
using @(topic)_msg_t = @(package)::msg::dds_::@(topic)_;
|
||||||
@[ else]@
|
@[ else]@
|
||||||
@@ -131,7 +131,7 @@ private:
|
|||||||
@[end for]@
|
@[end for]@
|
||||||
@[end if]@
|
@[end if]@
|
||||||
|
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7 or not ros2_distro]@
|
@[if fastrtps_version <= 1.7 or not ros2_distro]@
|
||||||
template <class T>
|
template <class T>
|
||||||
uint8_t getMsgSysID(T* msg) { return msg->sys_id_(); }
|
uint8_t getMsgSysID(T* msg) { return msg->sys_id_(); }
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ bool @(topic)_Subscriber::init(uint8_t topic_ID, std::condition_variable* t_send
|
|||||||
// Create RTPSParticipant
|
// Create RTPSParticipant
|
||||||
ParticipantAttributes PParam;
|
ParticipantAttributes PParam;
|
||||||
PParam.rtps.builtin.domainId = 0; // MUST BE THE SAME AS IN THE PUBLISHER
|
PParam.rtps.builtin.domainId = 0; // MUST BE THE SAME AS IN THE PUBLISHER
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7 or ros2_distro == "ardent" or ros2_distro == "bouncy" or ros2_distro == "crystal" or ros2_distro == "dashing"]@
|
@[if fastrtps_version <= 1.8]@
|
||||||
PParam.rtps.builtin.leaseDuration = c_TimeInfinite;
|
PParam.rtps.builtin.leaseDuration = c_TimeInfinite;
|
||||||
@[else]@
|
@[else]@
|
||||||
PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
|
PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
|
||||||
@@ -199,7 +199,7 @@ bool @(topic)_Subscriber::hasMsg()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
@(package)::msg::dds_::@(topic)_ @(topic)_Subscriber::getMsg()
|
@(package)::msg::dds_::@(topic)_ @(topic)_Subscriber::getMsg()
|
||||||
@[ else]@
|
@[ else]@
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ except AttributeError:
|
|||||||
#include <fastrtps/fastrtps_fwd.h>
|
#include <fastrtps/fastrtps_fwd.h>
|
||||||
#include <fastrtps/subscriber/SubscriberListener.h>
|
#include <fastrtps/subscriber/SubscriberListener.h>
|
||||||
#include <fastrtps/subscriber/SampleInfo.h>
|
#include <fastrtps/subscriber/SampleInfo.h>
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
#include "@(topic)_PubSubTypes.h"
|
#include "@(topic)_PubSubTypes.h"
|
||||||
@[else]@
|
@[else]@
|
||||||
#include "@(topic)PubSubTypes.h"
|
#include "@(topic)PubSubTypes.h"
|
||||||
@@ -89,7 +89,7 @@ public:
|
|||||||
bool init(uint8_t topic_ID, std::condition_variable* t_send_queue_cv, std::mutex* t_send_queue_mutex, std::queue<uint8_t>* t_send_queue);
|
bool init(uint8_t topic_ID, std::condition_variable* t_send_queue_cv, std::mutex* t_send_queue_mutex, std::queue<uint8_t>* t_send_queue);
|
||||||
void run();
|
void run();
|
||||||
bool hasMsg();
|
bool hasMsg();
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
@(package)::msg::dds_::@(topic)_ getMsg();
|
@(package)::msg::dds_::@(topic)_ getMsg();
|
||||||
@[ else]@
|
@[ else]@
|
||||||
@@ -118,7 +118,7 @@ private:
|
|||||||
SampleInfo_t m_info;
|
SampleInfo_t m_info;
|
||||||
int n_matched;
|
int n_matched;
|
||||||
int n_msg;
|
int n_msg;
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
@(package)::msg::dds_::@(topic)_ msg;
|
@(package)::msg::dds_::@(topic)_ msg;
|
||||||
@[ else]@
|
@[ else]@
|
||||||
@@ -140,7 +140,7 @@ private:
|
|||||||
std::mutex has_msg_mutex;
|
std::mutex has_msg_mutex;
|
||||||
|
|
||||||
} m_listener;
|
} m_listener;
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
@(package)::msg::dds_::@(topic)_PubSubType @(topic)DataType;
|
@(package)::msg::dds_::@(topic)_PubSubType @(topic)DataType;
|
||||||
@[ else]@
|
@[ else]@
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from px_generate_uorb_topic_helper import * # this is in Tools/
|
|||||||
from px_generate_uorb_topic_files import MsgScope # this is in Tools/
|
from px_generate_uorb_topic_files import MsgScope # this is in Tools/
|
||||||
|
|
||||||
package = package[0]
|
package = package[0]
|
||||||
fastrtpsgen_version = fastrtpsgen_version[0]
|
fastrtps_version = fastrtps_version[0]
|
||||||
try:
|
try:
|
||||||
ros2_distro = ros2_distro[0].decode("utf-8")
|
ros2_distro = ros2_distro[0].decode("utf-8")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from px_generate_uorb_topic_helper import * # this is in Tools/
|
|||||||
from px_generate_uorb_topic_files import MsgScope # this is in Tools/
|
from px_generate_uorb_topic_files import MsgScope # this is in Tools/
|
||||||
|
|
||||||
package = package[0]
|
package = package[0]
|
||||||
fastrtpsgen_version = fastrtpsgen_version[0]
|
fastrtps_version = fastrtps_version[0]
|
||||||
try:
|
try:
|
||||||
ros2_distro = ros2_distro[0].decode("utf-8")
|
ros2_distro = ros2_distro[0].decode("utf-8")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
@@ -86,7 +86,7 @@ static constexpr int64_t TRIGGER_RESET_THRESHOLD_NS = 100ll * 1000ll * 1000ll;
|
|||||||
static constexpr int REQUEST_RESET_COUNTER_THRESHOLD = 5;
|
static constexpr int REQUEST_RESET_COUNTER_THRESHOLD = 5;
|
||||||
|
|
||||||
@# Sets the timesync DDS type according to the FastRTPS and ROS2 version
|
@# Sets the timesync DDS type according to the FastRTPS and ROS2 version
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
@[ if ros2_distro]@
|
@[ if ros2_distro]@
|
||||||
using timesync_msg_t = @(package)::msg::dds_::Timesync_;
|
using timesync_msg_t = @(package)::msg::dds_::Timesync_;
|
||||||
@[ else]@
|
@[ else]@
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ def get_include_directives(spec):
|
|||||||
if genmsg.msgs.is_valid_constant_type(genmsg.msgs.bare_msg_type(field.type)):
|
if genmsg.msgs.is_valid_constant_type(genmsg.msgs.bare_msg_type(field.type)):
|
||||||
continue
|
continue
|
||||||
builtin_type = str(field.base_type).replace('px4/', '')
|
builtin_type = str(field.base_type).replace('px4/', '')
|
||||||
if 1.5 <= fastrtpsgen_version <= 1.7:
|
if fastrtps_version <= 1.7:
|
||||||
include_directive = '#include "%s_.idl"' % builtin_type
|
include_directive = '#include "%s_.idl"' % builtin_type
|
||||||
else:
|
else:
|
||||||
include_directive = '#include "%s.idl"' % builtin_type
|
include_directive = '#include "%s.idl"' % builtin_type
|
||||||
@@ -77,12 +77,12 @@ def get_idl_type_name(field_type):
|
|||||||
def add_msg_field(field):
|
def add_msg_field(field):
|
||||||
if (not field.is_header):
|
if (not field.is_header):
|
||||||
if field.is_array:
|
if field.is_array:
|
||||||
if 1.5 <= fastrtpsgen_version <= 1.7:
|
if fastrtps_version <= 1.7:
|
||||||
print(' {0}__{1}_array_{2} {3}_;'.format(topic, str(get_idl_type_name(field.base_type)).replace(" ", "_"), str(field.array_len), field.name))
|
print(' {0}__{1}_array_{2} {3}_;'.format(topic, str(get_idl_type_name(field.base_type)).replace(" ", "_"), str(field.array_len), field.name))
|
||||||
else:
|
else:
|
||||||
print(' {0}__{1}_array_{2} {3};'.format(topic, str(get_idl_type_name(field.base_type)).replace(" ", "_"), str(field.array_len), field.name))
|
print(' {0}__{1}_array_{2} {3};'.format(topic, str(get_idl_type_name(field.base_type)).replace(" ", "_"), str(field.array_len), field.name))
|
||||||
else:
|
else:
|
||||||
if 1.5 <= fastrtpsgen_version <= 1.7:
|
if fastrtps_version <= 1.7:
|
||||||
base_type = get_idl_type_name(field.base_type) + "_" if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type)
|
base_type = get_idl_type_name(field.base_type) + "_" if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type)
|
||||||
else:
|
else:
|
||||||
base_type = get_idl_type_name(field.base_type) if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type)
|
base_type = get_idl_type_name(field.base_type) if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type)
|
||||||
@@ -96,7 +96,7 @@ def add_msg_fields():
|
|||||||
def add_array_typedefs():
|
def add_array_typedefs():
|
||||||
for field in spec.parsed_fields():
|
for field in spec.parsed_fields():
|
||||||
if not field.is_header and field.is_array:
|
if not field.is_header and field.is_array:
|
||||||
if 1.5 <= fastrtpsgen_version <= 1.7:
|
if fastrtps_version <= 1.7:
|
||||||
base_type = get_idl_type_name(field.base_type) + "_" if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type)
|
base_type = get_idl_type_name(field.base_type) + "_" if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type)
|
||||||
else:
|
else:
|
||||||
base_type = get_idl_type_name(field.base_type) if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type)
|
base_type = get_idl_type_name(field.base_type) if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type)
|
||||||
@@ -127,14 +127,14 @@ def add_msg_constants():
|
|||||||
@add_msg_constants()
|
@add_msg_constants()
|
||||||
@# Array types
|
@# Array types
|
||||||
@add_array_typedefs()
|
@add_array_typedefs()
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
struct @(topic)_
|
struct @(topic)_
|
||||||
@[else]@
|
@[else]@
|
||||||
struct @(topic)
|
struct @(topic)
|
||||||
@[end if]@
|
@[end if]@
|
||||||
{
|
{
|
||||||
@add_msg_fields()
|
@add_msg_fields()
|
||||||
@[if 1.5 <= fastrtpsgen_version <= 1.7]@
|
@[if fastrtps_version <= 1.7]@
|
||||||
}; // struct @(topic)_
|
}; // struct @(topic)_
|
||||||
|
|
||||||
#pragma keylist @(topic)_
|
#pragma keylist @(topic)_
|
||||||
|
|||||||
@@ -209,16 +209,16 @@ else:
|
|||||||
if args.fastrtpsgen is None or args.fastrtpsgen == '':
|
if args.fastrtpsgen is None or args.fastrtpsgen == '':
|
||||||
# Assume fastrtpsgen is in PATH
|
# Assume fastrtpsgen is in PATH
|
||||||
fastrtpsgen_path = 'fastrtpsgen'
|
fastrtpsgen_path = 'fastrtpsgen'
|
||||||
for dirname in os.environ['PATH'].split(':') :
|
for dirname in os.environ['PATH'].split(':'):
|
||||||
candidate = os.path.join(dirname, 'fastrtpsgen')
|
candidate = os.path.join(dirname, 'fastrtpsgen')
|
||||||
if os.path.isfile(candidate) :
|
if os.path.isfile(candidate):
|
||||||
fastrtpsgen_path = candidate
|
fastrtpsgen_path = candidate
|
||||||
else:
|
else:
|
||||||
# Path to fastrtpsgen is explicitly specified
|
# Path to fastrtpsgen is explicitly specified
|
||||||
if os.path.isdir(args.fastrtpsgen) :
|
if os.path.isdir(args.fastrtpsgen):
|
||||||
fastrtpsgen_path = os.path.join(
|
fastrtpsgen_path = os.path.join(
|
||||||
os.path.abspath(args.fastrtpsgen), 'fastrtpsgen')
|
os.path.abspath(args.fastrtpsgen), 'fastrtpsgen')
|
||||||
else :
|
else:
|
||||||
fastrtpsgen_path = args.fastrtpsgen
|
fastrtpsgen_path = args.fastrtpsgen
|
||||||
|
|
||||||
fastrtpsgen_include = args.fastrtpsgen_include
|
fastrtpsgen_include = args.fastrtpsgen_include
|
||||||
@@ -227,27 +227,13 @@ if fastrtpsgen_include is not None and fastrtpsgen_include != '':
|
|||||||
os.path.abspath(
|
os.path.abspath(
|
||||||
args.fastrtpsgen_include) + " "
|
args.fastrtpsgen_include) + " "
|
||||||
|
|
||||||
# get FastRTPSGen version
|
# get FastRTPS version (major.minor, since patch is not relevant at this stage)
|
||||||
# Note: since Fast-RTPS 1.8.x release, FastRTPSGen is now a separated
|
fastrtps_version = ""
|
||||||
# repository and not included in the Fast-RTPS project.
|
try:
|
||||||
# The starting version since this separation is 1.0.0, which doesn't
|
fastrtps_version = float(subprocess.check_output(
|
||||||
# follow the Fast-RTPS version convention
|
"ldconfig -v | grep libfastrtps | tail -c 6", shell=True).decode("utf-8").strip()[-5:-2])
|
||||||
fastrtpsgen_version = 0.0
|
except ValueError:
|
||||||
if(os.path.exists(fastrtpsgen_path)):
|
print("No valid version found to FasRTPS. Make sure it is installed.")
|
||||||
try:
|
|
||||||
fastrtpsgen_version_out = subprocess.check_output(
|
|
||||||
[fastrtpsgen_path, "-version"]).strip()[-5:-2]
|
|
||||||
except OSError:
|
|
||||||
raise
|
|
||||||
|
|
||||||
try:
|
|
||||||
fastrtpsgen_version = float(fastrtpsgen_version_out)
|
|
||||||
except ValueError:
|
|
||||||
print("'fastrtpsgen -version' returned None. Hardsetting version to 1.0")
|
|
||||||
fastrtpsgen_version = 1.0
|
|
||||||
else:
|
|
||||||
raise Exception(
|
|
||||||
"FastRTPSGen not found. Specify the location of fastrtpsgen with the -f flag")
|
|
||||||
|
|
||||||
# get ROS 2 version, if exists
|
# get ROS 2 version, if exists
|
||||||
ros2_distro = ""
|
ros2_distro = ""
|
||||||
@@ -322,21 +308,21 @@ uRTPS_SUBSCRIBER_H_TEMPL_FILE = 'Subscriber.h.em'
|
|||||||
|
|
||||||
|
|
||||||
def generate_agent(out_dir):
|
def generate_agent(out_dir):
|
||||||
global fastrtpsgen_version
|
global fastrtps_version
|
||||||
|
|
||||||
if classifier.msgs_to_send:
|
if classifier.msgs_to_send:
|
||||||
for msg_file in classifier.msgs_to_send:
|
for msg_file in classifier.msgs_to_send:
|
||||||
if gen_idl:
|
if gen_idl:
|
||||||
if out_dir != agent_out_dir:
|
if out_dir != agent_out_dir:
|
||||||
px_generate_uorb_topic_files.generate_idl_file(msg_file, msg_dir, "", os.path.join(out_dir, "/idl"), urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_idl_file(msg_file, msg_dir, "", os.path.join(out_dir, "/idl"), urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtpsgen_version, ros2_distro, classifier.msg_id_map)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||||
else:
|
else:
|
||||||
px_generate_uorb_topic_files.generate_idl_file(msg_file, msg_dir, "", idl_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_idl_file(msg_file, msg_dir, "", idl_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtpsgen_version, ros2_distro, classifier.msg_id_map)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||||
px_generate_uorb_topic_files.generate_topic_file(msg_file, msg_dir, "", out_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_topic_file(msg_file, msg_dir, "", out_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_PUBLISHER_SRC_TEMPL_FILE)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_SRC_TEMPL_FILE)
|
||||||
px_generate_uorb_topic_files.generate_topic_file(msg_file, msg_dir, "", out_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_topic_file(msg_file, msg_dir, "", out_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_PUBLISHER_H_TEMPL_FILE)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_H_TEMPL_FILE)
|
||||||
|
|
||||||
if classifier.alias_msgs_to_send:
|
if classifier.alias_msgs_to_send:
|
||||||
for msg_file in classifier.alias_msgs_to_send:
|
for msg_file in classifier.alias_msgs_to_send:
|
||||||
@@ -345,28 +331,28 @@ def generate_agent(out_dir):
|
|||||||
if gen_idl:
|
if gen_idl:
|
||||||
if out_dir != agent_out_dir:
|
if out_dir != agent_out_dir:
|
||||||
px_generate_uorb_topic_files.generate_idl_file(msg_name, msg_dir, msg_alias, os.path.join(out_dir, "/idl"), urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_idl_file(msg_name, msg_dir, msg_alias, os.path.join(out_dir, "/idl"), urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtpsgen_version, ros2_distro, classifier.msg_id_map)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||||
else:
|
else:
|
||||||
px_generate_uorb_topic_files.generate_idl_file(msg_name, msg_dir, msg_alias, idl_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_idl_file(msg_name, msg_dir, msg_alias, idl_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtpsgen_version, ros2_distro, classifier.msg_id_map)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||||
px_generate_uorb_topic_files.generate_topic_file(msg_name, msg_dir, msg_alias, out_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_topic_file(msg_name, msg_dir, msg_alias, out_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_PUBLISHER_SRC_TEMPL_FILE)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_SRC_TEMPL_FILE)
|
||||||
px_generate_uorb_topic_files.generate_topic_file(msg_name, msg_dir, msg_alias, out_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_topic_file(msg_name, msg_dir, msg_alias, out_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_PUBLISHER_H_TEMPL_FILE)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_H_TEMPL_FILE)
|
||||||
|
|
||||||
if classifier.msgs_to_receive:
|
if classifier.msgs_to_receive:
|
||||||
for msg_file in classifier.msgs_to_receive:
|
for msg_file in classifier.msgs_to_receive:
|
||||||
if gen_idl:
|
if gen_idl:
|
||||||
if out_dir != agent_out_dir:
|
if out_dir != agent_out_dir:
|
||||||
px_generate_uorb_topic_files.generate_idl_file(msg_file, msg_dir, "", os.path.join(out_dir, "/idl"), urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_idl_file(msg_file, msg_dir, "", os.path.join(out_dir, "/idl"), urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtpsgen_version, ros2_distro, classifier.msg_id_map)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||||
else:
|
else:
|
||||||
px_generate_uorb_topic_files.generate_idl_file(msg_file, msg_dir, "", idl_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_idl_file(msg_file, msg_dir, "", idl_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtpsgen_version, ros2_distro, classifier.msg_id_map)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||||
px_generate_uorb_topic_files.generate_topic_file(msg_file, msg_dir, "", out_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_topic_file(msg_file, msg_dir, "", out_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_SUBSCRIBER_SRC_TEMPL_FILE)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_SRC_TEMPL_FILE)
|
||||||
px_generate_uorb_topic_files.generate_topic_file(msg_file, msg_dir, "", out_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_topic_file(msg_file, msg_dir, "", out_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_SUBSCRIBER_H_TEMPL_FILE)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_H_TEMPL_FILE)
|
||||||
|
|
||||||
if classifier.alias_msgs_to_receive:
|
if classifier.alias_msgs_to_receive:
|
||||||
for msg_file in classifier.alias_msgs_to_receive:
|
for msg_file in classifier.alias_msgs_to_receive:
|
||||||
@@ -375,28 +361,28 @@ def generate_agent(out_dir):
|
|||||||
if gen_idl:
|
if gen_idl:
|
||||||
if out_dir != agent_out_dir:
|
if out_dir != agent_out_dir:
|
||||||
px_generate_uorb_topic_files.generate_idl_file(msg_name, msg_dir, msg_alias, os.path.join(out_dir, "/idl"), urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_idl_file(msg_name, msg_dir, msg_alias, os.path.join(out_dir, "/idl"), urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtpsgen_version, ros2_distro, classifier.msg_id_map)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||||
else:
|
else:
|
||||||
px_generate_uorb_topic_files.generate_idl_file(msg_name, msg_dir, msg_alias, idl_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_idl_file(msg_name, msg_dir, msg_alias, idl_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtpsgen_version, ros2_distro, classifier.msg_id_map)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||||
px_generate_uorb_topic_files.generate_topic_file(msg_name, msg_dir, msg_alias, out_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_topic_file(msg_name, msg_dir, msg_alias, out_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_SUBSCRIBER_SRC_TEMPL_FILE)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_SRC_TEMPL_FILE)
|
||||||
px_generate_uorb_topic_files.generate_topic_file(msg_name, msg_dir, msg_alias, out_dir, urtps_templates_dir,
|
px_generate_uorb_topic_files.generate_topic_file(msg_name, msg_dir, msg_alias, out_dir, urtps_templates_dir,
|
||||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_SUBSCRIBER_H_TEMPL_FILE)
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_H_TEMPL_FILE)
|
||||||
|
|
||||||
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
||||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_AGENT_TEMPL_FILE)
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_AGENT_TEMPL_FILE)
|
||||||
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
||||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_TIMESYNC_CPP_TEMPL_FILE)
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_TIMESYNC_CPP_TEMPL_FILE)
|
||||||
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
||||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_TIMESYNC_H_TEMPL_FILE)
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_TIMESYNC_H_TEMPL_FILE)
|
||||||
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
||||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_AGENT_TOPICS_H_TEMPL_FILE)
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_AGENT_TOPICS_H_TEMPL_FILE)
|
||||||
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
||||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_AGENT_TOPICS_SRC_TEMPL_FILE)
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_AGENT_TOPICS_SRC_TEMPL_FILE)
|
||||||
if cmakelists:
|
if cmakelists:
|
||||||
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
|
||||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_AGENT_CMAKELISTS_TEMPL_FILE)
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_AGENT_CMAKELISTS_TEMPL_FILE)
|
||||||
|
|
||||||
# Final steps to install agent
|
# Final steps to install agent
|
||||||
mkdir_p(os.path.join(out_dir, "fastrtpsgen"))
|
mkdir_p(os.path.join(out_dir, "fastrtpsgen"))
|
||||||
@@ -407,7 +393,7 @@ def generate_agent(out_dir):
|
|||||||
for idl_file in glob.glob(os.path.join(idl_dir, "*.idl")):
|
for idl_file in glob.glob(os.path.join(idl_dir, "*.idl")):
|
||||||
try:
|
try:
|
||||||
ret = subprocess.check_call(fastrtpsgen_path + " -d " + out_dir +
|
ret = subprocess.check_call(fastrtpsgen_path + " -d " + out_dir +
|
||||||
"/fastrtpsgen -example x64Linux2.6gcc " + fastrtpsgen_include + idl_file, shell=True)
|
"/fastrtpsgen -example x64Linux2.6gcc " + fastrtpsgen_include + idl_file, shell=True)
|
||||||
except OSError:
|
except OSError:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@@ -452,7 +438,7 @@ def mkdir_p(dirpath):
|
|||||||
|
|
||||||
|
|
||||||
def generate_client(out_dir):
|
def generate_client(out_dir):
|
||||||
global fastrtpsgen_version
|
global fastrtps_version
|
||||||
|
|
||||||
# Rename work in the default path
|
# Rename work in the default path
|
||||||
if default_client_out != out_dir:
|
if default_client_out != out_dir:
|
||||||
@@ -467,7 +453,7 @@ def generate_client(out_dir):
|
|||||||
os.rename(def_file, def_file.replace(".h", ".h_"))
|
os.rename(def_file, def_file.replace(".h", ".h_"))
|
||||||
|
|
||||||
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir,
|
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir,
|
||||||
out_dir, uorb_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtpsgen_version, ros2_distro, uRTPS_CLIENT_TEMPL_FILE)
|
out_dir, uorb_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_CLIENT_TEMPL_FILE)
|
||||||
|
|
||||||
# Final steps to install client
|
# Final steps to install client
|
||||||
cp_wildcard(os.path.join(urtps_templates_dir,
|
cp_wildcard(os.path.join(urtps_templates_dir,
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ def generate_output_from_file(format_idx, filename, outputdir, package, template
|
|||||||
return generate_by_template(output_file, template_file, em_globals)
|
return generate_by_template(output_file, template_file, em_globals)
|
||||||
|
|
||||||
|
|
||||||
def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, package, includepath, fastrtpsgen_version, ros2_distro, ids):
|
def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, package, includepath, fastrtps_version, ros2_distro, ids):
|
||||||
"""
|
"""
|
||||||
Generates an .idl from .msg file
|
Generates an .idl from .msg file
|
||||||
"""
|
"""
|
||||||
@@ -175,11 +175,11 @@ def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, pack
|
|||||||
|
|
||||||
if (alias != ""):
|
if (alias != ""):
|
||||||
em_globals = get_em_globals(
|
em_globals = get_em_globals(
|
||||||
msg, alias, package, includepath, ids, fastrtpsgen_version, ros2_distro, MsgScope.NONE)
|
msg, alias, package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||||
spec_short_name = alias
|
spec_short_name = alias
|
||||||
else:
|
else:
|
||||||
em_globals = get_em_globals(
|
em_globals = get_em_globals(
|
||||||
msg, "", package, includepath, ids, fastrtpsgen_version, ros2_distro, MsgScope.NONE)
|
msg, "", package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||||
spec_short_name = em_globals["spec"].short_name
|
spec_short_name = em_globals["spec"].short_name
|
||||||
|
|
||||||
# Make sure output directory exists:
|
# Make sure output directory exists:
|
||||||
@@ -187,7 +187,7 @@ def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, pack
|
|||||||
os.makedirs(outputdir)
|
os.makedirs(outputdir)
|
||||||
|
|
||||||
template_file = os.path.join(templatedir, IDL_TEMPLATE_FILE)
|
template_file = os.path.join(templatedir, IDL_TEMPLATE_FILE)
|
||||||
if 1.5 <= fastrtpsgen_version <= 1.7:
|
if 1.5 <= fastrtps_version <= 1.7:
|
||||||
output_file = os.path.join(outputdir, IDL_TEMPLATE_FILE.replace(
|
output_file = os.path.join(outputdir, IDL_TEMPLATE_FILE.replace(
|
||||||
"msg.idl.em", str(spec_short_name + "_.idl")))
|
"msg.idl.em", str(spec_short_name + "_.idl")))
|
||||||
else:
|
else:
|
||||||
@@ -198,7 +198,7 @@ def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, pack
|
|||||||
|
|
||||||
|
|
||||||
def generate_uRTPS_general(filename_send_msgs, filename_alias_send_msgs, filename_receive_msgs, filename_alias_receive_msgs,
|
def generate_uRTPS_general(filename_send_msgs, filename_alias_send_msgs, filename_receive_msgs, filename_alias_receive_msgs,
|
||||||
msg_dir, outputdir, templatedir, package, includepath, ids, fastrtpsgen_version, ros2_distro, template_name):
|
msg_dir, outputdir, templatedir, package, includepath, ids, fastrtps_version, ros2_distro, template_name):
|
||||||
"""
|
"""
|
||||||
Generates source file by msg content
|
Generates source file by msg content
|
||||||
"""
|
"""
|
||||||
@@ -216,19 +216,19 @@ def generate_uRTPS_general(filename_send_msgs, filename_alias_send_msgs, filenam
|
|||||||
em_globals_list = []
|
em_globals_list = []
|
||||||
if send_msgs:
|
if send_msgs:
|
||||||
em_globals_list.extend([get_em_globals(
|
em_globals_list.extend([get_em_globals(
|
||||||
f, "", package, includepath, ids, fastrtpsgen_version, ros2_distro, MsgScope.SEND) for f in send_msgs])
|
f, "", package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.SEND) for f in send_msgs])
|
||||||
|
|
||||||
if alias_send_msgs:
|
if alias_send_msgs:
|
||||||
em_globals_list.extend([get_em_globals(
|
em_globals_list.extend([get_em_globals(
|
||||||
f[0], f[1], package, includepath, ids, fastrtpsgen_version, ros2_distro, MsgScope.SEND) for f in alias_send_msgs])
|
f[0], f[1], package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.SEND) for f in alias_send_msgs])
|
||||||
|
|
||||||
if receive_msgs:
|
if receive_msgs:
|
||||||
em_globals_list.extend([get_em_globals(
|
em_globals_list.extend([get_em_globals(
|
||||||
f, "", package, includepath, ids, fastrtpsgen_version, ros2_distro, MsgScope.RECEIVE) for f in receive_msgs])
|
f, "", package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.RECEIVE) for f in receive_msgs])
|
||||||
|
|
||||||
if alias_receive_msgs:
|
if alias_receive_msgs:
|
||||||
em_globals_list.extend([get_em_globals(
|
em_globals_list.extend([get_em_globals(
|
||||||
f[0], f[1], package, includepath, ids, fastrtpsgen_version, ros2_distro, MsgScope.RECEIVE) for f in alias_receive_msgs])
|
f[0], f[1], package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.RECEIVE) for f in alias_receive_msgs])
|
||||||
|
|
||||||
merged_em_globals = merge_em_globals_list(em_globals_list)
|
merged_em_globals = merge_em_globals_list(em_globals_list)
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ def generate_uRTPS_general(filename_send_msgs, filename_alias_send_msgs, filenam
|
|||||||
return generate_by_template(output_file, template_file, merged_em_globals)
|
return generate_by_template(output_file, template_file, merged_em_globals)
|
||||||
|
|
||||||
|
|
||||||
def generate_topic_file(filename_msg, msg_dir, alias, outputdir, templatedir, package, includepath, ids, fastrtpsgen_version, ros2_distro, template_name):
|
def generate_topic_file(filename_msg, msg_dir, alias, outputdir, templatedir, package, includepath, ids, fastrtps_version, ros2_distro, template_name):
|
||||||
"""
|
"""
|
||||||
Generates a sources and headers from .msg file
|
Generates a sources and headers from .msg file
|
||||||
"""
|
"""
|
||||||
@@ -251,11 +251,11 @@ def generate_topic_file(filename_msg, msg_dir, alias, outputdir, templatedir, pa
|
|||||||
|
|
||||||
if (alias):
|
if (alias):
|
||||||
em_globals = get_em_globals(
|
em_globals = get_em_globals(
|
||||||
msg, alias, package, includepath, ids, fastrtpsgen_version, ros2_distro, MsgScope.NONE)
|
msg, alias, package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||||
spec_short_name = alias
|
spec_short_name = alias
|
||||||
else:
|
else:
|
||||||
em_globals = get_em_globals(
|
em_globals = get_em_globals(
|
||||||
msg, "", package, includepath, ids, fastrtpsgen_version, ros2_distro, MsgScope.NONE)
|
msg, "", package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||||
spec_short_name = em_globals["spec"].short_name
|
spec_short_name = em_globals["spec"].short_name
|
||||||
|
|
||||||
# Make sure output directory exists:
|
# Make sure output directory exists:
|
||||||
@@ -269,7 +269,7 @@ def generate_topic_file(filename_msg, msg_dir, alias, outputdir, templatedir, pa
|
|||||||
return generate_by_template(output_file, template_file, em_globals)
|
return generate_by_template(output_file, template_file, em_globals)
|
||||||
|
|
||||||
|
|
||||||
def get_em_globals(filename_msg, alias, package, includepath, ids, fastrtpsgen_version, ros2_distro, scope):
|
def get_em_globals(filename_msg, alias, package, includepath, ids, fastrtps_version, ros2_distro, scope):
|
||||||
"""
|
"""
|
||||||
Generates em globals dictionary
|
Generates em globals dictionary
|
||||||
"""
|
"""
|
||||||
@@ -298,7 +298,7 @@ def get_em_globals(filename_msg, alias, package, includepath, ids, fastrtpsgen_v
|
|||||||
"scope": scope,
|
"scope": scope,
|
||||||
"package": package,
|
"package": package,
|
||||||
"alias": alias,
|
"alias": alias,
|
||||||
"fastrtpsgen_version": fastrtpsgen_version,
|
"fastrtps_version": fastrtps_version,
|
||||||
"ros2_distro": ros2_distro
|
"ros2_distro": ros2_distro
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user