|
|
@ -187,6 +187,8 @@ parser.add_argument("-f", "--fastrtpsgen-dir", dest='fastrtpsgen', type=str, nar |
|
|
|
help="fastrtpsgen installation dir, only needed if fastrtpsgen is not in PATH, by default empty", default="") |
|
|
|
help="fastrtpsgen installation dir, only needed if fastrtpsgen is not in PATH, by default empty", default="") |
|
|
|
parser.add_argument("-g", "--fastrtpsgen-include", dest='fastrtpsgen_include', type=str, |
|
|
|
parser.add_argument("-g", "--fastrtpsgen-include", dest='fastrtpsgen_include', type=str, |
|
|
|
help="directory(ies) to add to preprocessor include paths of fastrtpsgen, by default empty", default="") |
|
|
|
help="directory(ies) to add to preprocessor include paths of fastrtpsgen, by default empty", default="") |
|
|
|
|
|
|
|
parser.add_argument("-r", "--ros2-distro", dest='ros2_distro', type=str, nargs='?', |
|
|
|
|
|
|
|
help="ROS2 distro, only required if generating the agent for usage with ROS2 nodes, by default empty", default="") |
|
|
|
parser.add_argument("--delete-tree", dest='del_tree', |
|
|
|
parser.add_argument("--delete-tree", dest='del_tree', |
|
|
|
action="store_true", help="Delete dir tree output dir(s)") |
|
|
|
action="store_true", help="Delete dir tree output dir(s)") |
|
|
|
|
|
|
|
|
|
|
@ -236,6 +238,8 @@ if fastrtpsgen_include is not None and fastrtpsgen_include != '': |
|
|
|
os.path.abspath( |
|
|
|
os.path.abspath( |
|
|
|
args.fastrtpsgen_include) + " " |
|
|
|
args.fastrtpsgen_include) + " " |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ros2_distro = "" if args.ros2_distro == None else args.ros2_distro |
|
|
|
|
|
|
|
|
|
|
|
# If nothing specified it's generated both |
|
|
|
# If nothing specified it's generated both |
|
|
|
if agent == False and client == False: |
|
|
|
if agent == False and client == False: |
|
|
|
agent = True |
|
|
|
agent = True |
|
|
@ -293,19 +297,30 @@ uRTPS_SUBSCRIBER_H_TEMPL_FILE = 'Subscriber.h.em' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_agent(out_dir): |
|
|
|
def generate_agent(out_dir): |
|
|
|
|
|
|
|
# get FastRTPSGen version |
|
|
|
|
|
|
|
if(os.path.exists(fastrtpsgen_path)): |
|
|
|
|
|
|
|
fastrtps_vers = subprocess.check_output( |
|
|
|
|
|
|
|
[fastrtpsgen_path, "-version"]).strip()[-5:-2] |
|
|
|
|
|
|
|
if not fastrtps_vers: |
|
|
|
|
|
|
|
raise Exception( |
|
|
|
|
|
|
|
"FastRTPSGen failed with code error %s" % fastrtps_vers) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
raise Exception( |
|
|
|
|
|
|
|
"FastRTPSGen not found. Specify the location of fastrtpsgen with the -f flag") |
|
|
|
|
|
|
|
|
|
|
|
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, classifier.msg_id_map) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_vers, 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, classifier.msg_id_map) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, ros2_distro, fastrtps_vers, 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, uRTPS_PUBLISHER_SRC_TEMPL_FILE) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, uRTPS_PUBLISHER_H_TEMPL_FILE) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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: |
|
|
@ -317,28 +332,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, classifier.msg_id_map) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_vers, 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, classifier.msg_id_map) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_vers, 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, uRTPS_PUBLISHER_SRC_TEMPL_FILE) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, uRTPS_PUBLISHER_H_TEMPL_FILE) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, classifier.msg_id_map) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_vers, 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, classifier.msg_id_map) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_vers, 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, uRTPS_SUBSCRIBER_SRC_TEMPL_FILE) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, uRTPS_SUBSCRIBER_H_TEMPL_FILE) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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: |
|
|
@ -350,24 +365,24 @@ 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, classifier.msg_id_map) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_vers, 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, classifier.msg_id_map) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, fastrtps_vers, 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, uRTPS_SUBSCRIBER_SRC_TEMPL_FILE) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, uRTPS_SUBSCRIBER_H_TEMPL_FILE) |
|
|
|
package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, uRTPS_AGENT_TEMPL_FILE) |
|
|
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, uRTPS_AGENT_TOPICS_H_TEMPL_FILE) |
|
|
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, uRTPS_AGENT_TOPICS_SRC_TEMPL_FILE) |
|
|
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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, uRTPS_AGENT_CMAKELISTS_TEMPL_FILE) |
|
|
|
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_vers, 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")) |
|
|
@ -375,16 +390,12 @@ def generate_agent(out_dir): |
|
|
|
os.chdir(os.path.join(out_dir, "fastrtpsgen")) |
|
|
|
os.chdir(os.path.join(out_dir, "fastrtpsgen")) |
|
|
|
if not glob.glob(os.path.join(idl_dir, "*.idl")): |
|
|
|
if not glob.glob(os.path.join(idl_dir, "*.idl")): |
|
|
|
raise Exception("No IDL files found in %s" % idl_dir) |
|
|
|
raise Exception("No IDL files found in %s" % idl_dir) |
|
|
|
if(os.path.exists(fastrtpsgen_path)): |
|
|
|
for idl_file in glob.glob(os.path.join(idl_dir, "*.idl")): |
|
|
|
for idl_file in glob.glob(os.path.join(idl_dir, "*.idl")): |
|
|
|
ret = subprocess.call(fastrtpsgen_path + " -d " + out_dir + |
|
|
|
ret = subprocess.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) |
|
|
|
if ret: |
|
|
|
if ret: |
|
|
|
raise Exception( |
|
|
|
raise Exception( |
|
|
|
"FastRTPSGen failed with code error %s" % ret) |
|
|
|
"fastrtpsgen failed with code error %s" % ret) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
raise Exception( |
|
|
|
|
|
|
|
"fastrtpsgen not found. Specify the location of fastrtpsgen with the -f flag") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rm_wildcard(os.path.join(out_dir, "fastrtpsgen/*PubSubMain*")) |
|
|
|
rm_wildcard(os.path.join(out_dir, "fastrtpsgen/*PubSubMain*")) |
|
|
|
rm_wildcard(os.path.join(out_dir, "fastrtpsgen/makefile*")) |
|
|
|
rm_wildcard(os.path.join(out_dir, "fastrtpsgen/makefile*")) |
|
|
|