Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,31 @@

ROS 2 package using Micro XRCE-DDS 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 and TCP over IPv4 and IPv6.
- Serial Port transports.

All available configurations are supported directly by the Micro XRCE-DDS agent.
12 changes: 6 additions & 6 deletions micro_ros_agent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ project(micro_ros_agent LANGUAGES CXX)

find_package(ament_cmake REQUIRED)
find_package(microxrcedds_agent REQUIRED)
find_package(rosidl_cmake REQUIRED)

add_executable(${PROJECT_NAME} src/main.cpp)

Expand Down Expand Up @@ -79,12 +80,11 @@ if(UROSAGENT_GENERATE_PROFILE)
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
"
"import os
import sys
sys.path.append('${_OUTPUT_PATH}')
from ${_PYTHON_PKG_TOOL} import *
"
)

file(
Expand Down
15 changes: 7 additions & 8 deletions micro_ros_agent/micro_ros_agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,38 +164,37 @@ def generate_XML(args):
# 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 = " <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"
file_content += " </dds>\n"


# Data reader
#file_content += " <dds>\n"
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"
file_content += " </dds>\n"


# Topic
#file_content += " <dds>\n"
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"
file_content += " </dds>\n"


# Write file content
Expand Down
1 change: 1 addition & 0 deletions micro_ros_agent/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<buildtool_export_depend>ament_cmake</buildtool_export_depend>

<depend>microxrcedds_agent</depend>
<depend>rosidl_cmake</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down