mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-27 17:10:00 +08:00
microRTPS: update RTPS message list naming from 'ids' to 'msgs'
This commit is contained in:
@@ -274,14 +274,14 @@ def generate_agent(out_dir):
|
||||
if gen_idl:
|
||||
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,
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_list)
|
||||
else:
|
||||
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, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_list)
|
||||
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, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_SRC_TEMPL_FILE)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_H_TEMPL_FILE)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_H_TEMPL_FILE)
|
||||
|
||||
if classifier.alias_msgs_to_send:
|
||||
for msg_file in classifier.alias_msgs_to_send:
|
||||
@@ -290,28 +290,28 @@ def generate_agent(out_dir):
|
||||
if gen_idl:
|
||||
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,
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_list)
|
||||
else:
|
||||
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, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_list)
|
||||
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, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_SRC_TEMPL_FILE)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_H_TEMPL_FILE)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, fastrtps_version, ros2_distro, uRTPS_PUBLISHER_H_TEMPL_FILE)
|
||||
|
||||
if classifier.msgs_to_receive:
|
||||
for msg_file in classifier.msgs_to_receive:
|
||||
if gen_idl:
|
||||
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,
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_list)
|
||||
else:
|
||||
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, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_list)
|
||||
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, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_SRC_TEMPL_FILE)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_H_TEMPL_FILE)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_H_TEMPL_FILE)
|
||||
|
||||
if classifier.alias_msgs_to_receive:
|
||||
for msg_file in classifier.alias_msgs_to_receive:
|
||||
@@ -320,28 +320,28 @@ def generate_agent(out_dir):
|
||||
if gen_idl:
|
||||
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,
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_list)
|
||||
else:
|
||||
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, fastrtps_version, ros2_distro, classifier.msg_id_map)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_version, ros2_distro, classifier.msg_list)
|
||||
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, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_SRC_TEMPL_FILE)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_SUBSCRIBER_H_TEMPL_FILE)
|
||||
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_AGENT_TEMPL_FILE)
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_TIMESYNC_CPP_TEMPL_FILE)
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_TIMESYNC_H_TEMPL_FILE)
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
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)
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, 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,
|
||||
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)
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, fastrtps_version, ros2_distro, uRTPS_AGENT_TOPICS_SRC_TEMPL_FILE)
|
||||
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, os.path.dirname(out_dir),
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_AGENT_CMAKELISTS_TEMPL_FILE)
|
||||
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, fastrtps_version, ros2_distro, uRTPS_AGENT_CMAKELISTS_TEMPL_FILE)
|
||||
|
||||
# Final steps to install agent
|
||||
mkdir_p(os.path.join(out_dir, "fastrtpsgen"))
|
||||
@@ -361,7 +361,7 @@ def generate_agent(out_dir):
|
||||
for idl_file in glob.glob(os.path.join(idl_dir, "*.idl")):
|
||||
# Only run the generator for the topics that are actually marked to be
|
||||
# used by the bridge
|
||||
if os.path.splitext(os.path.basename(idl_file))[0] in classifier.msg_id_map:
|
||||
if os.path.splitext(os.path.basename(idl_file))[0] in classifier.msg_list:
|
||||
idl_files.append(idl_file)
|
||||
|
||||
try:
|
||||
@@ -426,7 +426,7 @@ def generate_client(out_dir):
|
||||
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,
|
||||
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)
|
||||
out_dir, uorb_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_list, fastrtps_version, ros2_distro, uRTPS_CLIENT_TEMPL_FILE)
|
||||
|
||||
# Final steps to install client
|
||||
cp_wildcard(os.path.join(urtps_templates_dir,
|
||||
|
||||
@@ -177,7 +177,7 @@ def generate_output_from_file(format_idx, filename, outputdir, package, template
|
||||
return generate_by_template(output_file, template_file, em_globals)
|
||||
|
||||
|
||||
def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, package, includepath, fastrtps_version, ros2_distro, ids):
|
||||
def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, package, includepath, fastrtps_version, ros2_distro, msgs):
|
||||
"""
|
||||
Generates an .idl from .msg file
|
||||
"""
|
||||
@@ -185,11 +185,11 @@ def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, pack
|
||||
|
||||
if (alias != ""):
|
||||
em_globals = get_em_globals(
|
||||
msg, alias, package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||
msg, alias, package, includepath, msgs, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||
spec_short_name = alias
|
||||
else:
|
||||
em_globals = get_em_globals(
|
||||
msg, "", package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||
msg, "", package, includepath, msgs, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||
spec_short_name = em_globals["spec"].short_name
|
||||
|
||||
# Make sure output directory exists:
|
||||
@@ -208,7 +208,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,
|
||||
msg_dir, outputdir, templatedir, package, includepath, ids, fastrtps_version, ros2_distro, template_name):
|
||||
msg_dir, outputdir, templatedir, package, includepath, msgs, fastrtps_version, ros2_distro, template_name):
|
||||
"""
|
||||
Generates source file by msg content
|
||||
"""
|
||||
@@ -226,19 +226,19 @@ def generate_uRTPS_general(filename_send_msgs, filename_alias_send_msgs, filenam
|
||||
em_globals_list = []
|
||||
if send_msgs:
|
||||
em_globals_list.extend([get_em_globals(
|
||||
f, "", package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.SEND) for f in send_msgs])
|
||||
f, "", package, includepath, msgs, fastrtps_version, ros2_distro, MsgScope.SEND) for f in send_msgs])
|
||||
|
||||
if alias_send_msgs:
|
||||
em_globals_list.extend([get_em_globals(
|
||||
f[0], f[1], package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.SEND) for f in alias_send_msgs])
|
||||
f[0], f[1], package, includepath, msgs, fastrtps_version, ros2_distro, MsgScope.SEND) for f in alias_send_msgs])
|
||||
|
||||
if receive_msgs:
|
||||
em_globals_list.extend([get_em_globals(
|
||||
f, "", package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.RECEIVE) for f in receive_msgs])
|
||||
f, "", package, includepath, msgs, fastrtps_version, ros2_distro, MsgScope.RECEIVE) for f in receive_msgs])
|
||||
|
||||
if alias_receive_msgs:
|
||||
em_globals_list.extend([get_em_globals(
|
||||
f[0], f[1], package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.RECEIVE) for f in alias_receive_msgs])
|
||||
f[0], f[1], package, includepath, msgs, fastrtps_version, ros2_distro, MsgScope.RECEIVE) for f in alias_receive_msgs])
|
||||
|
||||
merged_em_globals = merge_em_globals_list(em_globals_list)
|
||||
|
||||
@@ -253,7 +253,7 @@ def generate_uRTPS_general(filename_send_msgs, filename_alias_send_msgs, filenam
|
||||
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, fastrtps_version, ros2_distro, template_name):
|
||||
def generate_topic_file(filename_msg, msg_dir, alias, outputdir, templatedir, package, includepath, msgs, fastrtps_version, ros2_distro, template_name):
|
||||
"""
|
||||
Generates a sources and headers from .msg file
|
||||
"""
|
||||
@@ -261,11 +261,11 @@ def generate_topic_file(filename_msg, msg_dir, alias, outputdir, templatedir, pa
|
||||
|
||||
if (alias):
|
||||
em_globals = get_em_globals(
|
||||
msg, alias, package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||
msg, alias, package, includepath, msgs, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||
spec_short_name = alias
|
||||
else:
|
||||
em_globals = get_em_globals(
|
||||
msg, "", package, includepath, ids, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||
msg, "", package, includepath, msgs, fastrtps_version, ros2_distro, MsgScope.NONE)
|
||||
spec_short_name = em_globals["spec"].short_name
|
||||
|
||||
# Make sure output directory exists:
|
||||
@@ -279,7 +279,7 @@ def generate_topic_file(filename_msg, msg_dir, alias, outputdir, templatedir, pa
|
||||
return generate_by_template(output_file, template_file, em_globals)
|
||||
|
||||
|
||||
def get_em_globals(filename_msg, alias, package, includepath, ids, fastrtps_version, ros2_distro, scope):
|
||||
def get_em_globals(filename_msg, alias, package, includepath, msgs, fastrtps_version, ros2_distro, scope):
|
||||
"""
|
||||
Generates em globals dictionary
|
||||
"""
|
||||
@@ -304,7 +304,7 @@ def get_em_globals(filename_msg, alias, package, includepath, ids, fastrtps_vers
|
||||
"msg_context": msg_context,
|
||||
"spec": spec,
|
||||
"topics": topics,
|
||||
"ids": ids,
|
||||
"msgs": msgs,
|
||||
"scope": scope,
|
||||
"package": package,
|
||||
"alias": alias,
|
||||
|
||||
@@ -54,7 +54,7 @@ class Classifier():
|
||||
self.msgs_to_receive: Dict[str, int] = dict()
|
||||
self.alias_msgs_to_send: List[Tuple[str, str]] = []
|
||||
self.alias_msgs_to_receive: List[Tuple[str, str]] = []
|
||||
self.msg_id_map: List[str] = []
|
||||
self.msg_list: List[str] = []
|
||||
|
||||
# Create message map
|
||||
self.setup_msg_map()
|
||||
@@ -77,7 +77,7 @@ class Classifier():
|
||||
(topic['msg'], topic['base']))
|
||||
else:
|
||||
self.msgs_to_receive.update({topic['msg']: 0})
|
||||
self.msg_id_map.append(topic['msg'])
|
||||
self.msg_list.append(topic['msg'])
|
||||
|
||||
def set_msg_files_send(self) -> list:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user