Compare commits

..
11 Commits
Author SHA1 Message Date
Guillaume Beuzeboc e0d3e01909 Fix/snap version (#162)
* fix(snap): grade and version should be from the part

* CI(snap): need git history for latest git tag

* ci(snap): use new action-publish crendential system

* ignore snap
2023-01-20 07:29:25 +01:00
Pablo Garrido e2d5e6699e 1.5.4 2022-09-28 15:58:10 +02:00
Pablo Garrido 5c23d99726 Changelog 2022-09-28 15:58:07 +02:00
mergify[bot]andPablo Garrido 2857b2e620 Fix Datawriter destruction (#169) (#171)
Signed-off-by: Pablo Garrido <pablogs9@gmail.com>

Signed-off-by: Pablo Garrido <pablogs9@gmail.com>
(cherry picked from commit 4f686e8dc1)

Co-authored-by: Pablo Garrido <pablogs9@gmail.com>
2022-08-23 13:08:41 +02:00
mergify[bot]andcmraaron cb0e5e4ec9 Synchronise predicate (#160) (#167)
* ensure synchronised access to our predicate

Signed-off-by: Aaron <aaron.lipinski@cm-robotics.com>

* release lock before signalling

Signed-off-by: Aaron <aaron.lipinski@cm-robotics.com>

Signed-off-by: Aaron <aaron.lipinski@cm-robotics.com>
(cherry picked from commit d4be840332)

Co-authored-by: cmraaron <102722879+cmraaron@users.noreply.github.com>
2022-08-19 09:28:19 +02:00
Antonio Cuadros 096d54a5e9 Restore Snap publish (#154) 2022-06-13 15:09:07 +02:00
Antonio Cuadros 70f9cf7ddb Fix snap arch build (#151)
* Update snapcraft CI

* Update args

* Disable destructive mode

* Disable arm64 snap arch

* Restore experimental flag

* Remove publish job
2022-06-13 08:29:21 +02:00
Pablo Garrido ccc177d276 1.5.3 2022-06-13 07:46:55 +02:00
Pablo Garrido 648081f77f Changelog
Signed-off-by: Pablo Garrido <pablogs9@gmail.com>
2022-06-13 07:46:49 +02:00
Guillaume Beuzeboc b317a906dc Fix/snap (#141)
* fix(snap): build snap using explicitly pulled dependency

* ci(snap): add snap workflow

* feat(CI): snap publication channel depending on tags

* fix(CI): push tagged snap to candidate instead of stable

* fix(snap): use MICROROSAGENT_SUPERBUILD
2022-06-08 16:23:20 +02:00
mergify[bot]andPablo Garrido 200f750a76 Fix memory leak in graph manager (#147) (#149)
Signed-off-by: Pablo Garrido <pablogs9@gmail.com>
(cherry picked from commit c89776e1fd)

Co-authored-by: Pablo Garrido <pablogs9@gmail.com>
2022-06-08 14:21:17 +02:00
11 changed files with 134 additions and 56 deletions
+54
View File
@@ -0,0 +1,54 @@
name: snap
on:
push:
tags:
- '*'
branches:
- foxy
pull_request:
branches:
- foxy
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
outputs:
snap-file: ${{ steps.build-snap.outputs.snap }}
steps:
- uses: actions/checkout@v2
with:
# full history for latest tag name
fetch-depth: 0
- uses: snapcore/action-build@v1
id: build-snap
with:
snapcraft-args: '--enable-experimental-extensions'
# Make sure the snap is installable
- run: |
sudo snap install --dangerous ${{ steps.build-snap.outputs.snap }}
# @todo Do some testing with the snap
- run: |
micro-ros-agent udp4
- uses: actions/upload-artifact@v3
with:
name: micro-ros-agent-snap
path: ${{ steps.build-snap.outputs.snap }}
publish:
if: github.ref == 'refs/heads/foxy' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v3
with:
name: micro-ros-agent-snap
path: .
- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{needs.build.outputs.snap-file}}
release: ${{ startsWith(github.ref, 'refs/tags/') && 'candidate' || 'edge'}}
+4
View File
@@ -33,3 +33,7 @@
# End of https://www.gitignore.io/api/qtcreator # End of https://www.gitignore.io/api/qtcreator
CMakeLists.txt.user CMakeLists.txt.user
# snaps
*.snap
+1 -1
View File
@@ -55,4 +55,4 @@ see the file [3rd-party-licenses.txt](3rd-party-licenses.txt).
Please notice the following issues/limitations: Please notice the following issues/limitations:
* There is an unknown issue when dealing with serial ports shared with the micro-ROS agent running inside a Docker. Sometimes it works with a remarkable packet loss. * There is an unknown issue when dealing with serial ports shared with the micro-ROS agent running inside a Docker. Sometimes it works with a remarkable packet loss.
* There is an known issues with serial port communication on micro-ros-agent snap version. It is recommended to use the dockerized version or build it from source.
+9
View File
@@ -2,6 +2,15 @@
Changelog for package micro-ros_agent Changelog for package micro-ros_agent
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.5.4 (2022-09-28)
------------------
* Fix Datawriter destruction (`#169 <https://github.com/micro-ROS/micro-ROS-Agent/issues/169>`_) (`#171 <https://github.com/micro-ROS/micro-ROS-Agent/issues/171>`_)
* Synchronise predicate (`#160 <https://github.com/micro-ROS/micro-ROS-Agent/issues/160>`_) (`#167 <https://github.com/micro-ROS/micro-ROS-Agent/issues/167>`_)
1.5.3 (2022-06-13)
------------------
* Fix memory leak in graph manager (`#147 <https://github.com/micro-ROS/micro-ROS-Agent/issues/147>`_) (`#149 <https://github.com/micro-ROS/micro-ROS-Agent/issues/149>`_)
1.5.2 (2022-05-25) 1.5.2 (2022-05-25)
------------------ ------------------
@@ -111,6 +111,12 @@ public:
const eprosima::fastdds::dds::DomainParticipant* participant, const eprosima::fastdds::dds::DomainParticipant* participant,
bool from_microros = true); bool from_microros = true);
/**
* @brief Getter for the graph cache.
* @return Reference to inner graph cache
*/
rmw_dds_common::GraphCache& get_graph_cache() { return graphCache_; }
/** /**
* @brief Adds a DDS datawriter to the graph tree. * @brief Adds a DDS datawriter to the graph tree.
* @param datawriter_guid rtps::GUID_t of the datawriter to be added. * @param datawriter_guid rtps::GUID_t of the datawriter to be added.
@@ -329,7 +335,7 @@ private:
// Store a auxiliary publishers and datawriter for each participant created in micro-ROS // Store a auxiliary publishers and datawriter for each participant created in micro-ROS
std::map< std::map<
const eprosima::fastdds::dds::DomainParticipant*, const eprosima::fastdds::dds::DomainParticipant*,
std::unique_ptr<eprosima::fastdds::dds::DataWriter> eprosima::fastdds::dds::DataWriter*
> micro_ros_graph_datawriters_; > micro_ros_graph_datawriters_;
}; };
+1 -1
View File
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3"> <package format="3">
<name>micro_ros_agent</name> <name>micro_ros_agent</name>
<version>1.5.2</version> <version>1.5.4</version>
<description>micro-ROS Agent package</description> <description>micro-ROS Agent package</description>
<maintainer email="pablogarrido@eprosima.com">Pablo Garrido</maintainer> <maintainer email="pablogarrido@eprosima.com">Pablo Garrido</maintainer>
<maintainer email="antoniocuadros@eprosima.com">Antonio Cuadros</maintainer> <maintainer email="antoniocuadros@eprosima.com">Antonio Cuadros</maintainer>
@@ -125,9 +125,11 @@ GraphManager::GraphManager(eprosima::fastdds::dds::DomainId_t domain_id)
// Set graph cache on change callback function // Set graph cache on change callback function
graphCache_.set_on_change_callback([this]() graphCache_.set_on_change_callback([this]()
{
{ {
std::unique_lock<std::mutex> lock(this->mtx_); std::unique_lock<std::mutex> lock(this->mtx_);
this->graph_changed_ = true; this->graph_changed_ = true;
}
this->cv_.notify_one(); this->cv_.notify_one();
}); });
@@ -144,6 +146,7 @@ inline void GraphManager::publish_microros_graph()
{ {
return this->graph_changed_; return this->graph_changed_;
}); });
graph_changed_ = false;
} }
if (display_on_change_) if (display_on_change_)
@@ -151,7 +154,6 @@ inline void GraphManager::publish_microros_graph()
std::cout << "Updated uros Graph: graph changed" << std::endl; std::cout << "Updated uros Graph: graph changed" << std::endl;
std::cout << graphCache_ << std::endl; std::cout << graphCache_ << std::endl;
} }
graph_changed_ = false;
micro_ros_msgs::msg::Graph graph_message; micro_ros_msgs::msg::Graph graph_message;
@@ -320,11 +322,10 @@ void GraphManager::add_participant(
if (it == micro_ros_graph_datawriters_.end()) if (it == micro_ros_graph_datawriters_.end())
{ {
// Create datawriter // Create datawriter
std::unique_ptr<eprosima::fastdds::dds::DataWriter> datawriter; eprosima::fastdds::dds::DataWriter * datawriter = publisher_->create_datawriter(ros_discovery_topic_.get(), datawriter_qos_);
datawriter.reset(publisher_->create_datawriter(ros_discovery_topic_.get(), datawriter_qos_));
it = micro_ros_graph_datawriters_.insert( it = micro_ros_graph_datawriters_.insert(
std::make_pair(participant, std::move(datawriter))).first; std::make_pair(participant, datawriter)).first;
} }
it->second->write(static_cast<void *>(&info)); it->second->write(static_cast<void *>(&info));
@@ -344,9 +345,10 @@ void GraphManager::remove_participant(
rmw_dds_common::convert_gid_to_msg(&gid, &info.gid); rmw_dds_common::convert_gid_to_msg(&gid, &info.gid);
auto it = micro_ros_graph_datawriters_.find(participant); auto it = micro_ros_graph_datawriters_.find(participant);
it->second->write(static_cast<void *>(&info)); it->second->write(static_cast<void *>(&info));
} publisher_->delete_datawriter(it->second);
micro_ros_graph_datawriters_.erase(participant); micro_ros_graph_datawriters_.erase(participant);
} }
}
void GraphManager::add_datawriter( void GraphManager::add_datawriter(
const eprosima::fastrtps::rtps::GUID_t& datawriter_guid, const eprosima::fastrtps::rtps::GUID_t& datawriter_guid,
@@ -633,7 +635,7 @@ GraphManager::ParticipantListener::ParticipantListener(
} }
void GraphManager::ParticipantListener::on_participant_discovery( void GraphManager::ParticipantListener::on_participant_discovery(
eprosima::fastdds::dds::DomainParticipant* participant, eprosima::fastdds::dds::DomainParticipant* /* participant */,
eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info) eprosima::fastrtps::rtps::ParticipantDiscoveryInfo&& info)
{ {
switch (info.status) switch (info.status)
@@ -650,13 +652,15 @@ void GraphManager::ParticipantListener::on_participant_discovery(
const std::string enclave = const std::string enclave =
std::string(name_found->second.begin(), name_found->second.end()); std::string(name_found->second.begin(), name_found->second.end());
graphManager_from_->add_participant(participant, false, enclave); const rmw_gid_t gid = rmw_fastrtps_shared_cpp::create_rmw_gid("rmw_fastrtps_cpp", info.info.m_guid);
graphManager_from_->get_graph_cache().add_participant(gid, enclave);
break; break;
} }
case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT: case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT:
case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT: case eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT:
{ {
graphManager_from_->remove_participant(participant, false); const rmw_gid_t gid = rmw_fastrtps_shared_cpp::create_rmw_gid("rmw_fastrtps_cpp", info.info.m_guid);
graphManager_from_->get_graph_cache().remove_participant(gid);
break; break;
} }
default: default:
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
<transport_descriptors>
<transport_descriptor>
<transport_id>CustomUdpTransport</transport_id>
<type>UDPv4</type>
</transport_descriptor>
</transport_descriptors>
<participant profile_name="participant_profile" is_default_profile="true">
<rtps>
<userTransports>
<transport_id>CustomUdpTransport</transport_id>
</userTransports>
<useBuiltinTransports>false</useBuiltinTransports>
</rtps>
</participant>
</profiles>
+1 -1
View File
@@ -24,4 +24,4 @@ if [ -n "$p2p_port" ]; then
set -- --p2p "$p2p_port" "$@" set -- --p2p "$p2p_port" "$@"
fi fi
exec "$SNAP/lib/micro_ros_agent/micro_ros_agent" "$transport" "$@" exec "$SNAP/opt/ros/snap/lib/micro_ros_agent/micro_ros_agent" "$transport" "$@"
+23 -41
View File
@@ -1,12 +1,10 @@
name: micro-ros-agent name: micro-ros-agent
adopt-info: uros-agent # parse metadata from the uros-agent part
base: core20 base: core20
version: git
summary: Bridge between Micro ROS client applications and ROS 2 summary: Bridge between Micro ROS client applications and ROS 2
description: | description: |
Micro-ROS, whose default implementation is based on eProsima's Micro-ROS, whose default implementation is based on eProsima's
Micro XRCE-DDS middleware, is composed of client applications Micro XRCE-DDS middleware, is composed of client applications which interact with the ROS 2 world by means of an Agent. This agent keeps tracks of the entities created by means of
which interact with the ROS 2 world by means of an Agent.
This agent keeps tracks of the entities created by means of
requests performed on the microcontroller side, and uses them requests performed on the microcontroller side, and uses them
to communicate with the ROS 2 dataspace. to communicate with the ROS 2 dataspace.
@@ -71,16 +69,6 @@ description: |
$ snap set micro-ros-agent device="device path" $ snap set micro-ros-agent device="device path"
If connecting the micro-ROS Agent using an IP based connection mode,
that is, `udp4`, `udp6`, `tcp4` or `tcp6`, care must be taken to
connect first the `micro-ros-agent-shm-netplug` plug.
This is due to the fact that ROS 2 Foxy is using Fast-DDS as the
default DDS middleware, and Fast-DDS comes with *shared memory transport*.
Thus, this plugin must be enabled, in order to gain access to the
`/dev/shm` folder from the snap image, prior to running it:
$ sudo snap connect micro-ros-agent:micro-ros-agent-shm-netplug
When using the snap with a serial device, some steps need to be taken When using the snap with a serial device, some steps need to be taken
in order to establish a successful connection: in order to establish a successful connection:
@@ -111,7 +99,6 @@ description: |
After this, you can execute your snap as usual, After this, you can execute your snap as usual,
using `sudo micro-ros-agent serial -d <serial-dev>`. using `sudo micro-ros-agent serial -d <serial-dev>`.
grade: stable
confinement: strict confinement: strict
architectures: architectures:
@@ -121,48 +108,43 @@ architectures:
- build-on: ppc64el - build-on: ppc64el
parts: parts:
uros-agent: uros-agent:
plugin: colcon plugin: colcon
source: . source: .
override-build: | colcon-cmake-args:
set +u - -DMICROROSAGENT_SUPERBUILD=ON
git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git -b $ROS_DISTRO - --cmake-force-configure
git clone https://github.com/eProsima/Micro-CDR.git -b $ROS_DISTRO override-pull: |
git clone https://github.com/micro-ROS/micro_ros_msgs.git -b $ROS_DISTRO snapcraftctl pull
git clone https://github.com/micro-ROS/rosidl_typesupport_microxrcedds.git -b $ROS_DISTRO
git clone https://github.com/micro-ROS/rmw-microxrcedds.git -b $ROS_DISTRO version="$(git describe --always --tags| sed -e 's/^v//;s/-/+git/;y/-/./')"
git clone https://github.com/micro-ROS/micro-ROS-Agent.git -b $ROS_DISTRO [ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
. /opt/ros/$ROS_DISTRO/setup.sh snapcraftctl set-version "$version"
colcon build --merge-install --install-base $SNAPCRAFT_PRIME --cmake-args "-DUAGENT_BUILD_EXECUTABLE=OFF -DUAGENT_USE_SYSTEM_FASTDDS=ON" --packages-up-to micro_ros_agent snapcraftctl set-grade "$grade"
set -u
build-packages: [make, gcc, g++] build-packages: [make, gcc, g++, git]
stage-packages: [ros-foxy-ros2launch] stage-packages: [ros-foxy-ros2launch]
runner: runner:
plugin: dump plugin: dump
source: snap/local/ source: snap/local/
organize: organize:
'*': usr/bin/ 'micro-ros-agent-daemon': usr/bin/
'fastdds_no_shared_memory.xml': usr/share/
plugs:
micro-ros-agent-shm-netplug:
interface: system-files
allow-auto-connection: true
write:
- /dev/shm
apps: apps:
micro-ros-agent: micro-ros-agent:
command: lib/micro_ros_agent/micro_ros_agent command: opt/ros/snap/lib/micro_ros_agent/micro_ros_agent
environment: environment:
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/lib" FASTRTPS_DEFAULT_PROFILES_FILE: ${SNAP}/usr/share/fastdds_no_shared_memory.xml
plugs: [network, network-bind, serial-port, micro-ros-agent-shm-netplug] plugs: [network, network-bind, serial-port]
extensions: [ros2-foxy] extensions: [ros2-foxy]
daemon: daemon:
command: usr/bin/micro-ros-agent-daemon command: usr/bin/micro-ros-agent-daemon
environment: environment:
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/lib" FASTRTPS_DEFAULT_PROFILES_FILE: ${SNAP}/usr/share/fastdds_no_shared_memory.xml
daemon: simple daemon: simple
plugs: [network, network-bind, serial-port, micro-ros-agent-shm-netplug] plugs: [network, network-bind, serial-port]
extensions: [ros2-foxy]