Compare commits

..
Author SHA1 Message Date
Pablo Garrido 40c5ea4d45 Removed termios and pseudoterminal on VxWorks 2020-09-23 11:03:36 +02:00
Julián Bermúdez Ortega f0effec782 Refactor CMakeLists.txt. (#28) 2020-04-28 09:47:03 +02:00
Julián Bermúdez Ortega 85ec50d441 Update main.cpp according to Micro XRCE-DDS Agent API changes. (#27) 2020-04-14 16:59:32 +02:00
Borja OutereloandJulián Bermúdez Ortega f377b7a727 Dashing migration. (#15)
* Addapt to Dashing Diademata rosidl generation.

* Use new Micro XRCE-DDS agent library API.

* main.cpp update (#22)

* Update main.cpp according to the new version of Micro-XRCE-DDS-Agent.

* Apply suggestions from code review

Co-Authored-By: Borja Outerelo <borjaouterelo@gmail.com>

Co-authored-by: Borja Outerelo <borjaouterelo@gmail.com>

Co-authored-by: Julián Bermúdez Ortega <julianbermudez@eprosima.com>
2020-01-28 11:06:29 +01:00
Borja Outerelo b47de612e6 Remove not needed package. 2019-07-12 12:26:34 +02:00
Borja Outerelo d604a15708 Add CMakeLists.txt.user to gitignore and remove it from repo. (#13) 2019-04-26 13:51:51 +02:00
Borja Outerelo f7f4bf405e Rename package. (#12) 2019-04-24 18:23:13 +02:00
Borja Outerelo 1ef5e1b177 Update README.md 2019-04-24 16:09:52 +02:00
Borja Outerelo 5301589a90 Update micro-xrce-dds-agent package name. 2019-04-24 15:39:57 +02:00
Borja Outerelo e3fa817083 Fix package file. 2019-04-24 08:46:25 +02:00
Borja Outerelo 93621c8d67 Merge pull request #11 from micro-ROS/develop
Feature/pack (#10)
2019-04-24 08:32:40 +02:00
Borja Outerelo 6cdb2c2e5c Feature/pack (#10)
* Change name.

* Add changelog.
2019-04-24 08:31:13 +02:00
Borja Outerelo 8c65e094f2 Merge pull request #8 from microROS/develop
Update master
2018-11-30 10:30:39 +01:00
Borja Outerelo b820033df7 Update README.md 2018-11-30 10:23:24 +01:00
Borja Outerelo 16ef5db11c Create README.md 2018-11-30 10:22:28 +01:00
Borja Outerelo 9eaf57d2eb Update README.md 2018-11-29 20:51:43 +01:00
Borja Outerelo 2dd00a29b6 Create LICENSE 2018-11-29 20:51:12 +01:00
Borja Outerelo eb8f02b322 Merge branch 'master' into develop 2018-11-20 09:09:53 +01:00
Javier Moreno d1c08622ce Uncrustify lint format fix. (#7) 2018-11-19 16:17:04 +01:00
Borja Outerelo 8cb1bfe91a v0.0.1-alpha (#6)
* Issue with windows paths solved.

* Fixed issue when --merge-install is activated (Windows issue)

* Updated to last version of Micoxrcedds Agent. (#3)

* Restored removed code by accident (#4)

* Refs #3842. Removes agent node.
2018-11-17 22:06:58 +01:00
Javier Moreno 162117d9a2 Merge pull request #5 from microROS/feature/agentnode
Refs #3842. Removes agent node.
2018-11-17 13:05:01 +01:00
Borja Outerelo efaf219a63 Refs #3842. Removes agent node. 2018-11-16 10:34:08 +01:00
Javier Moreno 4a3a8a3b52 Restored removed code by accident (#4) 2018-11-15 16:23:35 +01:00
Javier Moreno 53555aa991 Updated to last version of Micoxrcedds Agent. (#3) 2018-11-15 15:00:37 +01:00
Borja Outerelo 735babba37 Merge pull request #2 from microROS/feature/WindowsFix
Feature/windows fix
2018-11-15 14:39:06 +01:00
Javier Moreno 9b615a4174 Fixed issue when --merge-install is activated (Windows issue) 2018-11-14 13:17:15 +01:00
Javier Moreno 70757b4144 Issue with windows paths solved. 2018-11-14 00:01:02 +01:00
Borja Outerelo 6b093d8417 Merge pull request #1 from microROS/develop
Develop
2018-11-06 17:58:02 +01:00
Javier Moreno 27203c273e XML fix 2018-11-02 11:57:07 +01:00
Javier JM. Moreno b483e7e007 Feature/u ros agent node 2018-10-31 15:49:30 +01:00
Javier JM. Moreno d66fa96f30 Refs #3552 - Adapt to new XML profiles 2018-10-31 15:09:09 +01:00
Javier Moreno bb1fe9561c Refs #3561 - Generate uROS_Agent module 2018-10-19 10:45:56 +02:00
Borja Outerelo 45c4a698c3 Refs #3486. Adds some wording improvements. 2018-10-19 10:14:12 +02:00
Javier Moreno c5cc980824 logo size ajusted. 2018-10-16 15:04:02 +02:00
Javier Moreno fa6e94898b Review needed. Links are missing until migration to external networks. 2018-10-16 15:04:02 +02:00
Javier Moreno e8621a76e6 Refs #3486 - Create Readme.md for uROS agent 2018-10-16 15:04:02 +02:00
Borja Outerelo a77c0f7547 Refs #3499. Uses new middleware name, Micro XRCE-DDS. 2018-10-16 11:48:51 +02:00
Javier Moreno ffc3c372be Refs #3459. 2018-10-04 09:14:22 +02:00
Borja Outerelo 1d106a8945 Merge branch 'developJ' into 'develop'
Develop j

See merge request eProsima/micro-ros-agent!1
2018-10-02 11:56:17 +02:00
19 changed files with 897 additions and 478 deletions
+35
View File
@@ -0,0 +1,35 @@
# Created by https://www.gitignore.io/api/qtcreator
# Edit at https://www.gitignore.io/?templates=qtcreator
### QtCreator ###
# gitignore for Qt Creator like IDE for pure C/C++ project without Qt
#
# Reference: http://doc.qt.io/qtcreator/creator-project-generic.html
# Qt Creator autogenerated files
# A listing of all the files included in the project
*.files
# Include directories
*.includes
# Project configuration settings like predefined Macros
*.config
# Qt Creator settings
*.creator
# User project settings
*.creator.user*
# Qt Creator backups
*.autosave
# End of https://www.gitignore.io/api/qtcreator
CMakeLists.txt.user
-60
View File
@@ -1,60 +0,0 @@
# Copyright 2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Set CMake version
cmake_minimum_required(VERSION 3.5)
# Set proyect name
project(micro_ros_agent)
# Find packages depencences
find_package(ament_cmake REQUIRED)
find_package(fastcdr REQUIRED CONFIG)
find_package(fastrtps REQUIRED CONFIG)
find_package(micrortps_agent REQUIRED CONFIG)
find_package(ament_cmake_python REQUIRED)
# Export dependencies to downstream packages
ament_export_dependencies(fastcdr)
ament_export_dependencies(fastrtps)
ament_export_dependencies(micrortps_agent)
# Install python files
ament_python_install_package(${PROJECT_NAME})
# Register package resource in order to be called when a new msg package is generated
ament_index_register_resource("rosidl_typesupport_c")
# Install the package.xml file, and generate code for ``find_package`` so that other packages can get information about this package.
ament_package(
CONFIG_EXTRAS "micro_ros_agent-extras.cmake.in"
)
install(
PROGRAMS bin/micro_ros_agent
DESTINATION lib/micro_ros_agent
)
install(
DIRECTORY cmake resource
DESTINATION share/${PROJECT_NAME}
)
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+6 -1
View File
@@ -1,2 +1,7 @@
# micro-ros-agent # micro-ROS-Agent
[![GitHub license](https://img.shields.io/github/license/microROS/micro-ROS-Agent.svg)](https://github.com/microROS/micro-ROS-Agent)
[![GitHub release](https://img.shields.io/github/release/microROS/micro-ROS-Agent.svg)](https://github.com/microROS/micro-ROS-Agent/releases)
ROS 2 package using Micro XRCE-DDS Agent.
-45
View File
@@ -1,45 +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_micro_ros_agent_xml_support
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:]):
parser = argparse.ArgumentParser(
description='Generate xml files for micrortps agent.',
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_micro_ros_agent_xml_support(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__':
sys.exit(main())
-69
View File
@@ -1,69 +0,0 @@
# Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# list msg files
set(_ros_idl_files "")
foreach(_idl_file ${rosidl_generate_interfaces_IDL_FILES})
get_filename_component(_extension "${_idl_file}" EXT)
# Skip .srv files
if(_extension STREQUAL ".msg")
list(APPEND _ros_idl_files "${_idl_file}")
endif()
endforeach()
# Set output dir
set(_output_path "${CMAKE_CURRENT_BINARY_DIR}/../micro_ros_agent/xml_gen")
# check if all templates exits
set(target_dependencies
"${micro_ros_agent_BIN}"
"${micro_ros_agent_GENERATOR_FILES}"
${rosidl_generate_interfaces_IDL_FILES}
${_dependency_files})
foreach(dep ${target_dependencies})
if(NOT EXISTS "${dep}")
message(FATAL_ERROR "Target dependency '${dep}' does not exist")
endif()
endforeach()
# generate script argument file
set(generator_arguments_file "${CMAKE_CURRENT_BINARY_DIR}/micro_ros_agent__arguments.json")
rosidl_write_generator_arguments(
"${generator_arguments_file}"
PACKAGE_NAME "${PROJECT_NAME}"
ROS_INTERFACE_FILES "${rosidl_generate_interfaces_IDL_FILES}"
ROS_INTERFACE_DEPENDENCIES "${_dependencies}"
OUTPUT_DIR "${_output_path}"
TEMPLATE_DIR "${micro_ros_agent_DEFAULT_PROFILES_DIR}"
TARGET_DEPENDENCIES ${target_dependencies}
ADDITIONAL_FILES ${_dds_idl_files}
)
# Execute python script
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${micro_ros_agent_BIN}
--generator-arguments-file "${generator_arguments_file}"
)
#Install
install(
DIRECTORY "${_output_path}/"
DESTINATION "../micrortps_agent/bin"
)
-14
View File
@@ -1,14 +0,0 @@
find_package(ament_cmake_core QUIET REQUIRED)
ament_register_extension(
"rosidl_generate_interfaces"
"micro_ros_agent"
"micrortps_agent_xml_generator.cmake")
set(micro_ros_agent_BIN "${micro_ros_agent_DIR}/../../../lib/micro_ros_agent/micro_ros_agent")
normalize_path(micro_ros_agent_BIN "${micro_ros_agent_BIN}")
set(micro_ros_agent_GENERATOR_FILES "${micro_ros_agent_DIR}/../../../@PYTHON_INSTALL_DIR@/micro_ros_agent/__init__.py")
normalize_path(micro_ros_agent_GENERATOR_FILES "${micro_ros_agent_GENERATOR_FILES}")
set(micro_ros_agent_DEFAULT_PROFILES_DIR "${micro_ros_agent_DIR}/../resource")
normalize_path(micro_ros_agent_DEFAULT_PROFILES_DIR "${micro_ros_agent_DEFAULT_PROFILES_DIR}")
+8
View File
@@ -0,0 +1,8 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package micro-ros_agent
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.0.1 (2019-04-24)
-----------------
* Initial release
+200
View File
@@ -0,0 +1,200 @@
# Copyright 2018-present Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.5)
option(UROSAGENT_GENERATE_PROFILE
"Generates agent.refs according to the .msgs provided in the .repos" OFF
)
set(CMAKE_C_CLANG_TIDY clang-tidy -checks=*)
project(micro_ros_agent LANGUAGES CXX)
find_package(ament_cmake REQUIRED)
find_package(microxrcedds_agent REQUIRED)
add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME}
PRIVATE
microxrcedds_agent
$<$<BOOL:$<PLATFORM_ID:Linux>>:rt>
$<$<BOOL:$<PLATFORM_ID:Linux>>:dl>
)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD
11
CXX_STANDARD_REQUIRED
YES
)
target_compile_options(${PROJECT_NAME}
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wall>
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wextra>
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wpedantic>
)
ament_export_dependencies(microxrcedds_agent)
ament_package()
install(
TARGETS
${PROJECT_NAME}
DESTINATION
lib/${PROJECT_NAME}
)
if(UROSAGENT_GENERATE_PROFILE)
set(_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/python")
set(_XML_INTERFACE_GEN_BIN "${_OUTPUT_PATH}/bin/Xml_interface_gen.py")
normalize_path(_XML_INTERFACE_GEN_BIN "${_XML_INTERFACE_GEN_BIN}")
set(_XML_DEFAULT_READ_BIN "${_OUTPUT_PATH}/bin/Xml_read_default_profiles.py")
normalize_path(_XML_DEFAULT_READ_BIN "${_XML_DEFAULT_READ_BIN}")
set(_PYTHON_PKG_TOOL ${PROJECT_NAME})
set(_RESOURCE_DIR "${_OUTPUT_PATH}/resource")
normalize_path(_RESOURCE_DIR "${_RESOURCE_DIR}")
set(_DEFAULT_FASTRTPS_PROFILES_PATH "${_OUTPUT_PATH}/gen/DEFAULT_FASTRTPS_PROFILES.xml")
normalize_path(_DEFAULT_FASTRTPS_PROFILES_PATH "${_DEFAULT_FASTRTPS_PROFILES_PATH}")
get_filename_component(_COLCON_CALL_DIR "${PROJECT_BINARY_DIR}" DIRECTORY)
get_filename_component(_COLCON_CALL_DIR "${_COLCON_CALL_DIR}" DIRECTORY)
set(_PYTHON_SCRIPT_HEAD
"
import os\n
import sys\n
sys.path.append('${_OUTPUT_PATH}')\n
from ${_PYTHON_PKG_TOOL} import *\n
"
)
file(
COPY
"bin" "${_PYTHON_PKG_TOOL}" "resource"
DESTINATION
"${CMAKE_CURRENT_BINARY_DIR}/python"
)
execute_process(
COMMAND
"${PYTHON_EXECUTABLE}"
"-c"
"${_PYTHON_SCRIPT_HEAD}for package in GetInterfacePackages(GetPackageList('${_COLCON_CALL_DIR}')): print ('%s,%s' % (package, GetPackageName(package)))"
OUTPUT_VARIABLE
_packages
RESULT_VARIABLE
_result
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT _result EQUAL 0)
message(FATAL_ERROR "Error finding XML packages")
endif()
string(REPLACE "\n" ";" _packages ${_packages})
set(ALL_MSG_FILES "")
foreach(package ${_packages})
string(REPLACE "," ";" package ${package})
list(GET package 0 package_file)
list(GET package 1 package)
execute_process(
COMMAND
"${PYTHON_EXECUTABLE}"
"-c"
"${_PYTHON_SCRIPT_HEAD}for msg in GetInterfacePackageMsgs('${package_file}'): print ('%s' % msg)"
OUTPUT_VARIABLE
${package}_MSG_FILES
RESULT_VARIABLE
_result
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT _result EQUAL 0)
message(FATAL_ERROR "Error finding .msg files")
endif()
if(${package}_MSG_FILES STREQUAL "")
continue()
endif()
string(REPLACE "\n" ";" ${package}_MSG_FILES ${${package}_MSG_FILES})
endforeach()
execute_process(
COMMAND
"${PYTHON_EXECUTABLE}" "${_XML_DEFAULT_READ_BIN}" "--default-xml-path" "${_RESOURCE_DIR}"
OUTPUT_VARIABLE
_XmlDoc
RESULT_VARIABLE
_result
)
if(NOT _result EQUAL 0)
message(FATAL_ERROR "Error in typesuppor generation")
endif()
foreach(package ${_packages})
string(REPLACE "," ";" package ${package})
list(GET package 0 package_file)
list(GET package 1 package)
if(${package}_MSG_FILES STREQUAL "")
continue()
endif()
set(generator_arguments_file "${_OUTPUT_PATH}/XML_ArgFiles/${package}_Args.json")
rosidl_write_generator_arguments(
"${generator_arguments_file}"
PACKAGE_NAME "${package}"
ROS_INTERFACE_FILES "${${package}_MSG_FILES}"
ROS_INTERFACE_DEPENDENCIES "NULL"
OUTPUT_DIR "NULL"
TEMPLATE_DIR "NULL"
TARGET_DEPENDENCIES "NULL"
ADDITIONAL_FILES ""
)
execute_process(
COMMAND
"${PYTHON_EXECUTABLE}" "${_XML_INTERFACE_GEN_BIN}" --generator-arguments-file "${generator_arguments_file}"
OUTPUT_VARIABLE
_XmlGen
RESULT_VARIABLE
_result
)
if(NOT _result EQUAL 0)
message(FATAL_ERROR "Error in typesuppor generation")
endif()
set(_XmlDoc "${_XmlDoc}${_XmlGen}")
endforeach()
set (_XmlDoc "<profiles>\n${_XmlDoc}</profiles>\n")
file(WRITE "${_DEFAULT_FASTRTPS_PROFILES_PATH}" "${_XmlDoc}")
endif()
+31
View File
@@ -0,0 +1,31 @@
# Micro ROS Agent
## Overview
This repository contains the Micro-ROS Agent package.
Micro-ROS Agent is a ROS 2 node that wraps the Micro XRCE-DDS Agent.
For further information about Micro XRCE-DDS Agent click [here](https://github.com/eProsima/Micro-XRCE-DDS-Agent)
This package is a part of the Micro-ROS project stack.
For more information about Micro-ROS project click [here](https://microros.github.io/micro-ROS/).
The node acts as a server between DDS Network and Micro-ROS nodes inside MCU.
It receives and send messages from Micro-ROS nodes, and keep track of the Micro-ROS nodes exposing them to the ROS 2 network.
The node interacts with DDS Global Data Space on behalf of the Micro-ROS nodes.
## Package features
### XML generation
During the build process, the package looks for all ROS 2 messages to generate an initial list of XML profiles.
These profiles can are referenced in the Agent-Client communication to avoid sending the full XML content.
This reference mechanism can be switched on and off from the Micro XRCE-DDS middleware layer.
### Agent-Client communication mechanism
Communication between the Micro-ROS Agent and the Micro-ROS nodes supports two types of transport:
- UDP.
- SerialPort.
All available configurations are supported directly by the Micro XRCE-DDS agent.
For further information on how to configure the agent click [here](TODO).
-241
View File
@@ -1,241 +0,0 @@
# Copyright 2016-2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import struct
import os
import sys
if os.name == 'nt':
import win32con
import win32file
import pywintypes
__overlapped = pywintypes.OVERLAPPED()
elif os.name == 'posix':
import fcntl
else:
raise RuntimeError('PortaLocker only defined for nt and posix platforms')
from rosidl_cmake import convert_camel_case_to_lower_case_underscore
from rosidl_cmake import expand_template
from rosidl_cmake import extract_message_types
from rosidl_cmake import get_newest_modification_time
from rosidl_parser import parse_message_file
from rosidl_parser import parse_service_file
from rosidl_parser import validate_field_types
from shutil import copyfile
from pathlib import Path
def generate_micro_ros_agent_xml_support(args):
pkg_name = args['package_name']
known_msg_types = extract_message_types(
pkg_name, args['ros_interface_files'], args.get('ros_interface_dependencies', []))
functions = {
'get_header_filename_from_msg_name': convert_camel_case_to_lower_case_underscore,
}
# Set file format
file_format = ".xml"
ros2_prefix = "rt/"
# Check destination dir
dest_dir = args['output_dir']
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
# Check source dir
srcs_dir = os.path.join(dest_dir, "srcs")
if not os.path.exists(srcs_dir):
os.makedirs(srcs_dir)
# Copy all included xml files
for filename in os.listdir(args['template_dir']):
if filename.endswith(file_format):
template_src_path = os.path.join(args['template_dir'], filename)
template_dest_path = os.path.join(srcs_dir, filename)
if not os.path.isfile(template_dest_path):
copyfile(template_src_path, template_dest_path)
# Iterate throw all msgs/srvs
for idl_file in args['ros_interface_files']:
extension = os.path.splitext(idl_file)[1]
if extension == '.msg':
spec = parse_message_file(pkg_name, idl_file)
validate_field_types(spec, known_msg_types)
subfolder = os.path.basename(os.path.dirname(idl_file))
data = {
'spec': spec,
'pkg': spec.base_type.pkg_name,
'msg': spec.msg_name,
'type': spec.base_type.type,
'subfolder': subfolder,
}
data.update(functions)
# Generate source file path
src_file = os.path.join(srcs_dir, "%s_%s_%s.xml" % (spec.base_type.pkg_name, subfolder, spec.msg_name))
# Publisher
file_content = " <publisher profile_name=\"%s_%s_%s_p\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <topic profile_name=\"%s_%s_%s_t\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <kind>NO_KEY</kind>\n"
file_content += " <name>%s%s_%s_%s</name>\n" % (ros2_prefix, spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <dataType>%s::%s::dds_::%s_</dataType>\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <historyQos>\n"
file_content += " <kind>KEEP_LAST</kind>\n"
file_content += " <depth>5</depth>\n"
file_content += " </historyQos>\n"
file_content += " <durability>\n"
file_content += " <kind>TRANSIENT_LOCAL</kind>\n"
file_content += " </durability>\n"
file_content += " </topic>\n"
file_content += " </publisher>\n"
# Subscriber
file_content += " <subscriber profile_name=\"%s_%s_%s_s\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <topic profile_name=\"%s_%s_%s_t\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <kind>NO_KEY</kind>\n"
file_content += " <name>%s%s_%s_%s</name>\n" % (ros2_prefix, spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <dataType>%s::%s::dds_::%s_</dataType>\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <historyQos>\n"
file_content += " <kind>KEEP_LAST</kind>\n"
file_content += " <depth>5</depth>\n"
file_content += " </historyQos>\n"
file_content += " <durability>\n"
file_content += " <kind>TRANSIENT_LOCAL</kind>\n"
file_content += " </durability>\n"
file_content += " </topic>\n"
file_content += " </subscriber>\n"
# Topic
file_content += " <topic profile_name=\"%s_%s_%s_t\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <name>%s%s_%s_%s</name>\n" % (ros2_prefix, spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <dataType>%s::%s::dds_::%s_</dataType>\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " </topic>\n"
# Write file content
fd1 = open(src_file, "w")
if os.name == 'nt':
# Lock
hfile1 = win32file._get_osfhandle(fd1.fileno())
win32file.LockFileEx(hfile1, win32con.LOCKFILE_EXCLUSIVE_LOCK, 0, -0x10000, __overlapped)
# Write
fd1.write(file_content)
# Unlock
win32file.UnlockFileEx(hfile1, 0, -0x10000, __overlapped)
elif os.name == 'posix':
# Lock
fcntl.flock(fd1.fileno(), fcntl.LOCK_EX)
# Write
fd1.write(file_content)
# Unlock
fcntl.flock(fd1.fileno(), fcntl.LOCK_UN)
fd1.close()
# Open collect file
collec_file = os.path.join(args['output_dir'], "DEFAULT_FASTRTPS_PROFILES.xml")
fd2 = open(collec_file, "w")
if os.name == 'nt':
# Lock
hfile2 = win32file._get_osfhandle(fd2.fileno())
win32file.LockFileEx(hfile2, win32con.LOCKFILE_EXCLUSIVE_LOCK, 0, -0x10000, __overlapped)
# Generate head
fd2.write("<profiles>\n")
# Append all files contents
for filename in os.listdir(srcs_dir):
if filename.endswith(".xml"):
# Open
fd3 = open(os.path.join(srcs_dir, filename), "r+")
# Lock
hfile3 = win32file._get_osfhandle(fd3.fileno())
win32file.LockFileEx(hfile3, win32con.LOCKFILE_EXCLUSIVE_LOCK, 0, -0x10000, __overlapped)
# Write
fd2.write(fd3.read())
# Unlock
win32file.UnlockFileEx(hfile3, 0, -0x10000, __overlapped)
fd3.close()
# Generate tail
fd2.write("</profiles>\n")
# UnLock
win32file.UnlockFileEx(hfile2, 0, -0x10000, __overlapped)
elif os.name == 'posix':
# Lock
fcntl.flock(fd2.fileno(), fcntl.LOCK_EX)
# Generate head
fd2.write("<profiles>\n")
# Append all files contents
for filename in os.listdir(srcs_dir):
if filename.endswith(".xml"):
# Open
fd3 = open(os.path.join(srcs_dir, filename), "r+")
# Lock
fcntl.flock(fd3, fcntl.LOCK_EX)
# Write
fd2.write(fd3.read())
# Unlock
fcntl.flock(fd3.fileno(), fcntl.LOCK_UN)
# Close
fd3.close()
# Generate tail
fd2.write("</profiles>\n")
# UnLock
fcntl.flock(fd2.fileno(), fcntl.LOCK_UN)
# Close file
fd2.close()
#elif extension == '.srv':
#data = {'spec': spec}
#data.update(functions)
#if not os.path.exists(args['output_dir']):
# os.makedirs(args['output_dir'])
#f = open(os.path.join(args['output_dir'], 'demofile.txt'), 'w+')
#f.write("%s\n" % spec)
#f.close()
return 0
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
import argparse
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),'..'))
from rosidl_cmake import read_generator_arguments
from rosidl_adapter.parser import UnknownMessageType
from micro_ros_agent import generate_XML
def main(argv=sys.argv[1:]):
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)
rc = generate_XML(generator_args)
return rc
if __name__ == '__main__':
sys.exit(main())
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
import os
import sys
import argparse
import xml.etree.ElementTree
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),'..'))
from micro_ros_agent import *
def main(argv=sys.argv[1:]):
parser = argparse.ArgumentParser(
description='Import default xml files',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'--default-xml-path',
required=True,
help='The location of the default profiles')
args = parser.parse_args(argv)
ReadDefaultXMLs(args.default_xml_path)
return 0
if __name__ == '__main__':
sys.exit(main())
+217
View File
@@ -0,0 +1,217 @@
# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import xml.etree.ElementTree
from rosidl_cmake import convert_camel_case_to_lower_case_underscore
from rosidl_cmake import expand_template
from rosidl_cmake import get_newest_modification_time
from rosidl_adapter.parser import parse_message_file
from rosidl_adapter.parser import parse_service_file
from rosidl_adapter.parser import validate_field_types
from rosidl_cmake import generate_files
def GetPackage(Dir):
# ignore?
for f in os.listdir(Dir):
full_path = os.path.join(Dir, f)
if os.path.isfile(full_path):
if f == "COLCON_IGNORE":
return "COLCON_IGNORE"
# found package
found_package_path = ""
for f in os.listdir(Dir):
if f == "package.xml":
found_package_path = os.path.join(Dir, f)
found_package_path = os.path.abspath(found_package_path)
break
return found_package_path.replace("\\", "/")
def GetPackageList(Dir):
package_list = []
package_path = GetPackage(Dir)
if package_path == "":
for f in os.listdir(Dir):
full_path = os.path.join(Dir, f)
if os.path.isdir(full_path):
for l in GetPackageList(full_path):
package_list.append(l)
elif package_path != "COLCON_IGNORE":
package_list.append(package_path)
return package_list
def GetInterfacePackages(packages_list):
package_interface_list = []
for package in packages_list:
xml_root = xml.etree.ElementTree.parse(package).getroot()
for element in xml_root.findall('member_of_group'):
if element.text == "rosidl_interface_packages":
package_interface_list.append(package)
return package_interface_list
def GetPackageName(package_path):
xml_root = xml.etree.ElementTree.parse(package_path).getroot()
xml_name_elements = xml_root.findall('name')
if len(xml_name_elements) != 1:
return ""
else:
return xml_name_elements[0].text
def GetInterfacePackageMsgs(package_path):
msg_list = []
package_dir = os.path.dirname(package_path)
for root, dirs, files in os.walk(package_dir):
for file in files:
if file.endswith(".msg"):
full_path = os.path.join(root, file)
msg_list.append(full_path.replace("\\", "/"))
return msg_list
def GetInterfacePackageSrvs(package_path):
msg_list = []
package_dir = os.path.dirname(package_path)
for root, dirs, files in os.walk(package_dir):
for file in files:
if file.endswith(".srv"):
full_path = os.path.join(root, file)
msg_list.append(full_path.replace("\\", "/"))
return msg_list
def ReadDefaultXMLs(Path):
for f in os.listdir(Path):
full_path = os.path.join(Path, f)
if os.path.isfile(full_path) and f.endswith(".xml"):
#xml_root = xml.etree.ElementTree.parse(full_path).getroot()
#if xml_root.iselement():
fd = open(full_path)
print ("%s" % fd.read())
fd.close()
def generate_XML(args):
pkg_name = args['package_name']
#known_msg_types = extract_message_types(
# pkg_name, args['ros_interface_files'], args.get('ros_interface_dependencies', []))
functions = {
'get_header_filename_from_msg_name': convert_camel_case_to_lower_case_underscore,
}
# Set file format
ros2_prefix = "rt/"
# Check destination dir
dest_dir = args['output_dir']
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
# Check source dir
srcs_dir = os.path.join(dest_dir, "srcs")
if not os.path.exists(srcs_dir):
os.makedirs(srcs_dir)
# Iterate throw all msgs/srvs
for idl_file in args['ros_interface_files']:
extension = os.path.splitext(idl_file)[1]
if extension == '.msg':
spec = parse_message_file(pkg_name, idl_file)
#validate_field_types(spec, known_msg_types)
subfolder = os.path.basename(os.path.dirname(idl_file))
data = {
'spec': spec,
'pkg': spec.base_type.pkg_name,
'msg': spec.msg_name,
'type': spec.base_type.type,
'subfolder': subfolder,
}
data.update(functions)
# Generate source file path
src_file = os.path.join(srcs_dir, "%s_%s_%s.xml" % (spec.base_type.pkg_name, subfolder, spec.msg_name))
# Data writer
#file_content = " <dds>\n"
file_content = " <data_writer profile_name=\"%s_%s_%s_p\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <topic profile_name=\"%s_%s_%s_t\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <kind>NO_KEY</kind>\n"
file_content += " <name>%s%s_%s_%s</name>\n" % (ros2_prefix, spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <dataType>%s::%s::dds_::%s_</dataType>\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " </topic>\n"
file_content += " </data_writer>\n"
#file_content += " </dds>\n"
# Data reader
#file_content += " <dds>\n"
file_content += " <data_reader profile_name=\"%s_%s_%s_s\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <topic profile_name=\"%s_%s_%s_t\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <kind>NO_KEY</kind>\n"
file_content += " <name>%s%s_%s_%s</name>\n" % (ros2_prefix, spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <dataType>%s::%s::dds_::%s_</dataType>\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " </topic>\n"
file_content += " </data_reader>\n"
#file_content += " </dds>\n"
# Topic
#file_content += " <dds>\n"
file_content += " <topic profile_name=\"%s_%s_%s_t\">\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <name>%s%s_%s_%s</name>\n" % (ros2_prefix, spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " <dataType>%s::%s::dds_::%s_</dataType>\n" % (spec.base_type.pkg_name, subfolder, spec.msg_name)
file_content += " </topic>\n"
#file_content += " </dds>\n"
# Write file content
print ("%s" % file_content)
#elif extension == '.srv':
#data = {'spec': spec}
#data.update(functions)
#if not os.path.exists(args['output_dir']):
# os.makedirs(args['output_dir'])
#f = open(os.path.join(args['output_dir'], 'demofile.txt'), 'w+')
#f.write("%s\n" % spec)
#f.close()
return 0
+2 -8
View File
@@ -4,23 +4,17 @@
<name>micro_ros_agent</name> <name>micro_ros_agent</name>
<version>0.0.1</version> <version>0.0.1</version>
<description>DDS-XCRE agent implementation </description> <description>DDS-XCRE agent implementation </description>
<maintainer email="javiermoreno@eprosima.com">Javier Moreno</maintainer> <maintainer email="borjaouterelo@eprosima.com">Borja Outerelo</maintainer>
<license>Apache License 2.0</license> <license>Apache License 2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend> <buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_export_depend>ament_cmake</buildtool_export_depend> <buildtool_export_depend>ament_cmake</buildtool_export_depend>
<exec_depend>rosidl_parser</exec_depend> <depend>microxrcedds_agent</depend>
<depend>fastcdr</depend>
<depend>fastrtps</depend>
<depend>micrortps_agent</depend>
<test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend> <test_depend>ament_lint_common</test_depend>
<member_of_group>rosidl_typesupport_c_packages</member_of_group>
<export> <export>
<build_type>ament_cmake</build_type> <build_type>ament_cmake</build_type>
</export> </export>
+24
View File
@@ -0,0 +1,24 @@
<participant profile_name="participant_profile">
<rtps>
<name>participant_profile</name>
</rtps>
</participant>
<data_writer profile_name="shapetype_data_writer">
<topic>
<kind>WITH_KEY</kind>
<name>Square</name>
<dataType>ShapeType</dataType>
</topic>
</data_writer>
<data_reader profile_name="shapetype_data_reader">
<topic>
<kind>WITH_KEY</kind>
<name>Square</name>
<dataType>ShapeType</dataType>
</topic>
</data_reader>
<topic profile_name="shapetype_topic">
<kind>WITH_KEY</kind>
<name>Square</name>
<dataType>ShapeType</dataType>
</topic>
+29
View File
@@ -0,0 +1,29 @@
<topic profile_name="parameter_events_t">
<name>rt/parameter_events</name>
<dataType>rcl_interfaces::msg::dds_::ParameterEvent_</dataType>
</topic>
<topic profile_name="clock_t">
<name>rt/clock</name>
<dataType>rosgraph_msgs::msg::dds_::Clock_</dataType>
</topic>
<data_writer profile_name="parameter_events_p">
<topic>
<kind>NO_KEY</kind>
<name>rt/parameter_events</name>
<dataType>rcl_interfaces::msg::dds_::ParameterEvent_</dataType>
</topic>
</data_writer>
<data_reader profile_name="clock_s">
<topic>
<kind>NO_KEY</kind>
<name>rt/clock</name>
<dataType>rosgraph_msgs::msg::dds_::Clock_</dataType>
</topic>
</data_reader>
<data_reader profile_name="parameter_events_s">
<topic>
<kind>NO_KEY</kind>
<name>rt/parameter_events</name>
<dataType>rcl_interfaces::msg::dds_::ParameterEvent_</dataType>
</topic>
</data_reader>
+87
View File
@@ -0,0 +1,87 @@
// Copyright 2017-present Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <uxr/agent/utils/CLI.hpp>
#include <csignal>
int main(int argc, char** argv)
{
#ifndef _WIN32
sigset_t signals;
sigemptyset(&signals);
if(sigaddset(&signals, SIGINT) && sigaddset(&signals, SIGTERM))
{
std::cerr << "Wrong signalset" << std::endl;
std::exit(EXIT_FAILURE);
}
sigprocmask( SIG_BLOCK, &signals, nullptr );
#endif
/* CLI application. */
CLI::App app("micro-ROS Agent");
app.require_subcommand(1, 1);
app.get_formatter()->column_width(42);
/* CLI subcommands. */
eprosima::uxr::cli::UDPv4Subcommand udpv4_subcommand(app);
eprosima::uxr::cli::UDPv6Subcommand udpv6_subcommand(app);
eprosima::uxr::cli::TCPv4Subcommand tcpv4_subcommand(app);
eprosima::uxr::cli::TCPv6Subcommand tcpv6_subcommand(app);
#if !defined(_WIN32) && !defined(__VXWORKS__)
eprosima::uxr::cli::TermiosSubcommand serial_subcommand(app);
eprosima::uxr::cli::PseudoTerminalSubcommand pseudo_serial_subcommand(app);
#endif
eprosima::uxr::cli::ExitSubcommand exit_subcommand(app);
/* CLI parse. */
std::string cli_input{};
for (int i = 1; i < argc; ++i)
{
cli_input.append(argv[i]);
cli_input.append(" ");
}
while (true)
{
try
{
app.parse(cli_input);
break;
}
catch (const CLI::ParseError& e)
{
app.exit(e);
std::cin.clear();
std::cout << std::endl;
std::cout << "Enter command: ";
std::getline(std::cin, cli_input);
}
}
#ifdef _WIN32
/* Waiting until exit. */
std::cin.clear();
char exit_flag = 0;
while ('q' != exit_flag)
{
std::cin >> exit_flag;
}
#else
/* Wait for SIGTERM/SIGINT instead, as reading from stdin may be redirected to /dev/null. */
int n_signal = 0;
sigwait(&signals, &n_signal);
#endif
return 0;
}
-39
View File
@@ -1,39 +0,0 @@
<participant profile_name="participant_profile">
<rtps>
<builtin>
<leaseDuration>
<durationbyname>INFINITE</durationbyname>
</leaseDuration>
<domainId>0</domainId>
</builtin>
<name>DataReader_participant_subscriber</name>
</rtps>
</participant>
<publisher profile_name="publisher_profile">
<topic>
<kind>WITH_KEY</kind>
<name>Square</name>
<dataType>ShapeType</dataType>
<historyQos>
<kind>KEEP_LAST</kind>
<depth>5</depth>
</historyQos>
<durability>
<kind>TRANSIENT_LOCAL</kind>
</durability>
</topic>
</publisher>
<subscriber profile_name="subscriber_profile">
<topic>
<kind>WITH_KEY</kind>
<name>Square</name>
<dataType>ShapeType</dataType>
<historyQos>
<kind>KEEP_LAST</kind>
<depth>5</depth>
</historyQos>
<durability>
<kind>TRANSIENT_LOCAL</kind>
</durability>
</topic>
</subscriber>