Refs #3366. Errors fix

This commit is contained in:
Javier Moreno
2018-09-14 11:34:55 +02:00
parent c54a384b4c
commit becb074a2f
4 changed files with 17 additions and 67 deletions
+1 -1
View File
@@ -68,6 +68,6 @@ install(
)
install(
DIRECTORY cmake resource
DIRECTORY cmake
DESTINATION share/${PROJECT_NAME}
)
-51
View File
@@ -1,51 +0,0 @@
#!/usr/bin/env python3
import argparse
import os
import sys
from rosidl_cmake import read_generator_arguments
from rosidl_parser import UnknownMessageType
from micro_ros_agent import generate_typesupport_micrortps_c
def is_valid_file(parser, file_name):
if not os.path.exists(file_name):
parser.error("File does not exist: '{0}'".format(file_name))
file_name_abs = os.path.abspath(file_name)
if not os.path.isfile(file_name_abs):
parser.error("Path exists but is not a file: '{0}'".format(file_name_abs))
return file_name
def main(argv=sys.argv[1:]):
print "-------------------------B-------------"
return 0
parser = argparse.ArgumentParser(
description='Generate the C interfaces for Micro RTPS.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'--generator-arguments-file',
required=True,
help='The location of the file containing the generator arguments')
args = parser.parse_args(argv)
generator_args = read_generator_arguments(args.generator_arguments_file)
try:
rc = generate_typesupport_micrortps_c(generator_args)
return 0
except UnknownMessageType as e:
print(str(e), file=sys.stderr)
return 1
if rc:
return rc
return 0
if __name__ == '__main__':
print "-------------------------C-------------"
sys.exit(main())
+9 -2
View File
@@ -25,7 +25,7 @@ endforeach()
# Set output dir
set(_output_path "${CMAKE_CURRENT_BINARY_DIR}/micro_ros_agent/${PROJECT_NAME}")
set(_output_path "${CMAKE_CURRENT_BINARY_DIR}/../micro_ros_agent/xml_gen")
# check if all templates exits
@@ -49,7 +49,7 @@ rosidl_write_generator_arguments(
ROS_INTERFACE_FILES "${rosidl_generate_interfaces_IDL_FILES}"
ROS_INTERFACE_DEPENDENCIES "${_dependencies}"
OUTPUT_DIR "${_output_path}"
TEMPLATE_DIR "${micro_ros_agent_TEMPLATE_DIR}"
TEMPLATE_DIR "NONE"
TARGET_DEPENDENCIES ${target_dependencies}
ADDITIONAL_FILES ${_dds_idl_files}
)
@@ -60,3 +60,10 @@ execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${micro_ros_agent_BIN}
--generator-arguments-file "${generator_arguments_file}"
)
#Install
install(
DIRECTORY "${_output_path}/"
DESTINATION "../micrortps_agent/bin"
)
+6 -12
View File
@@ -55,7 +55,7 @@ def generate_micro_ros_agent_xml_support(args):
os.makedirs(args['output_dir'])
# Check if publixher exists
pub_file_path = "/root/install/publisher.xml"
pub_file_path = os.path.join(args['output_dir'], 'publisher.xml')
pub_file = Path(pub_file_path)
if not pub_file.is_file():
publ = open(pub_file_path, 'a')
@@ -66,10 +66,11 @@ def generate_micro_ros_agent_xml_support(args):
publ.close()
publ = open(pub_file_path,'w')
publ.writelines([item for item in lines[:-1]])
#publ = open(pub_file_path, "w")
#publ.seek(publ.seek(-1,2) - len("</profiles>\n"))
#publ = open(os.path.join(args['output_dir'], 'publisher.xml'), 'w+')
#publ = open('/root/install/publisher.xml', 'a')
publ.write(" <publisher profile_name=\"default_xrce_publisher_profile\">\n")
publ.write(" <topic>\n")
publ.write(" <kind>NO_KEY</kind>\n")
@@ -90,7 +91,7 @@ def generate_micro_ros_agent_xml_support(args):
# Check if subcriber exists
subs_file_path = "/root/install/subscriber.xml"
subs_file_path = os.path.join(args['output_dir'], 'subscriber.xml')
subs_file = Path(subs_file_path)
if not subs_file.is_file():
subs = open(subs_file_path, 'a')
@@ -103,9 +104,6 @@ def generate_micro_ros_agent_xml_support(args):
subs.writelines([item for item in lines[:-1]])
#subs = open(os.path.join(args['output_dir'], 'subscriber.xml'), 'w+')
#subs = open('/root/install/subscriber.xml', 'a')
#subs.write("<profiles>\n")
subs.write(" <subscriber profile_name=\"default_xrce_subscriber_profile\">\n")
subs.write(" <topic>\n")
subs.write(" <kind>NO_KEY</kind>\n")
@@ -125,7 +123,7 @@ def generate_micro_ros_agent_xml_support(args):
# Check if topic exists
topi_file_path = "/root/install/topic.xml"
topi_file_path = os.path.join(args['output_dir'], 'topic.xml')
topi_file = Path(topi_file_path)
if not topi_file.is_file():
topi = open(topi_file_path, 'a')
@@ -137,10 +135,6 @@ def generate_micro_ros_agent_xml_support(args):
topi = open(topi_file_path,'w')
topi.writelines([item for item in lines[:-1]])
#topi = open(os.path.join(args['output_dir'], 'topic.xml'), 'w+')
#topi = open('/root/install/topic.xml', 'a')
#topi.write("<dds>\n")
topi.write(" <topic>\n")
topi.write(" <name>%sPubSubTopic</name>\n" % (spec.msg_name))
topi.write(" <dataType>%s::%s::dds_::%s_</dataType>\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name))