Skip to content

Commit

Permalink
Release v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogs9 authored Dec 2, 2021
2 parents 21a253d + aa62e32 commit df0cac4
Show file tree
Hide file tree
Showing 21 changed files with 1,563 additions and 370 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ install_manifest.txt
compile_commands.json
CTestTestfile.cmake
build
install

### Eclipse ###

Expand Down Expand Up @@ -139,10 +140,10 @@ local.properties
.worksheet

### Eclipse Patch ###
# Eclipse Core
# Eclipse Core
.project

# JDT-specific (Eclipse Java Development Tools)
# JDT-specific (Eclipse Java Development Tools)
.classpath

### Linux ###
Expand Down
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

project(microxrcedds VERSION "2.0.0")
project(microxrcedds VERSION "2.1.0")

set(_client_tag master)
set(_client_version 2.0.0)
set(_agent_tag master)
set(_client_tag v2.1.0)
set(_client_version 2.1.0)
set(_agent_tag v2.1.0)
set(_gen_tag master)

###############################################################################
Expand All @@ -40,6 +40,7 @@ set(_gen_tag master)
option(UXRCE_BUILD_EXAMPLES "Build and install examples." OFF)
option(UXRCE_ENABLE_CLIENT "Enable the building and installation of Micro XRCE-DDS Client." ON)
option(UXRCE_ENABLE_AGENT "Enable the building and installation of Micro XRCE-DDS Agent." ON)
option(UXRCE_BUILD_AGENT_EXECUTABLE "Enable the buildin Micro XRCE-DDS Agent executable." OFF)
option(UXRCE_ENABLE_GEN "Enable the building and installation of Micro XRCE-DDS Gen." OFF)
option(UXRCE_BUILD_TESTS "Build tests." OFF)
option(UXRCE_BUILD_PROFILING "Build profiling test executables.")
Expand Down Expand Up @@ -117,6 +118,7 @@ if(UXRCE_ENABLE_CLIENT)
-DUCLIENT_BUILD_TESTS:BOOL=${UXRCE_BUILD_TESTS}
-DUCLIENT_ISOLATED_INSTALL:BOOL=OFF
-DGTEST_INDIVIDUAL:BOOL=ON
-DUCLIENT_PROFILE_CAN:BOOL=ON
)
list(APPEND _deps client)
endif()
Expand Down Expand Up @@ -153,7 +155,7 @@ if(UXRCE_ENABLE_AGENT)
-DUAGENT_BUILD_TESTS:BOOL=${UXRCE_BUILD_TESTS}
-DUAGENT_P2P_CLIENT_TAG:STRING=${_client_tag}
-DUAGENT_P2P_CLIENT_VERSION:STRING=${_client_version}
-DUAGENT_BUILD_EXECUTABLE:BOOL=OFF
-DUAGENT_BUILD_EXECUTABLE:BOOL=${UXRCE_BUILD_AGENT_EXECUTABLE}
-DUAGENT_ISOLATED_INSTALL:BOOL=OFF
-DGTEST_INDIVIDUAL:BOOL=ON
DEPENDS
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN cd /uxrce/build && \
cmake \
-DCMAKE_INSTALL_PREFIX=../install \
-DUXRCE_BUILD_EXAMPLES=ON \
-DUXRCE_BUILD_AGENT_EXECUTABLE=ON \
.. &&\
make -j $(nproc) && make install

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*eProsima Micro XRCE-DDS* is a library implementing the [DDS-XRCE protocol](https://www.omg.org/spec/DDS-XRCE/About-DDS-XRCE/) as defined and maintained by the OMG, whose aim is to allow resource constrained devices such as microcontrollers to communicate with the [DDS](https://www.omg.org/spec/DDS/About-DDS/>) world as any other DDS actor would do.
It follows a client/server paradigm and is composed by two libraries, the *Micro XRCE-DDS Client* and the *Micro XRCE-DDS Agent*. The *Micro XRCE-DDS Clients* are lightweight entities meant to be compiled on e**X**tremely **R**esource **C**onstrained **E**nvironments, while the *Micro XRCE-DDS Agent* is a broker which bridges the *Clients* with the DDS world.

<p align="center"> <img src="docs/Concept.png" alt="Image" width="90%"/> </p>
<p align="center"> <img src="https://github.com/eProsima/Micro-XRCE-DDS/blob/master/docs/Concept.png?raw=true" alt="XRCE protocol" width="90%"/> </p>

The *Micro XRCE-DDS Clients* request operations to the *Agent* to publish and/or subscribe to topics in the DDS global dataspace. Remote procedure calls, as defined by the [DDS-RPC standard](https://www.omg.org/spec/DDS-RPC/About-DDS-RPC/), are also supported, allowing *Clients* to communicate in the DDS dataspace according to a request/reply paradigm.
The *Agents* process these requests and send back a response with the operation status result and with the requested data, in the case of subscribe/reply operations.
Expand All @@ -25,7 +25,7 @@ This is made possible by the creation of *DDS Entities* on the *Agent* as a resu

The communication between a *Micro XRCE-DDS Client* and a *Micro XRCE-DDS Agent* is achieved by means of several kinds of built-in transports: **UDPv4**, **UDPv6**, **TCPv4**, **TCPv6** and **Serial** communication. In addition, there is the possibility for the user to generate its own **Custom** transport.

<p align="center"> <img src="docs/General.png" alt="Image" width="70%"/> </p>
<p align="center"> <img src="https://github.com/eProsima/Micro-XRCE-DDS/blob/master/docs/General.png?raw=true" alt="General architecture" width="70%"/> </p>

This repository contains the totality of the *eProsima Micro XRCE-DDS* products:

Expand Down
11 changes: 9 additions & 2 deletions test/test/client_agent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DEFAULT_FASTRTPS_PROFILES.xml.in
@ONLY
)

add_executable(client-agent-test ClientAgentInteraction.cpp)
set(SRCS ClientAgentInteraction.cpp)

if(NOT WIN32)
list(APPEND SRCS ClientAgentSerial.cpp)
list(APPEND SRCS ClientAgentCan.cpp)
endif()

add_executable(client-agent-test ${SRCS})

add_gtest(client-agent-test
SOURCES
ClientAgentInteraction.cpp
${SRCS}
ENVIRONMENTS
$<$<PLATFORM_ID:Linux>:LD_LIBRARY_PATH=${CMAKE_PREFIX_PATH}/lib>
$<$<PLATFORM_ID:Windows>:PATH=${CMAKE_PREFIX_PATH}/bin>
Expand Down
15 changes: 15 additions & 0 deletions test/test/client_agent/ClientAgentCan.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <gtest/gtest.h>
#include <Client.hpp>
#include <thread>

#include "ClientAgentCan.hpp"

TEST_P(ClientAgentCan, PingFromClientToAgent)
{
ASSERT_NO_FATAL_FAILURE(client_can_.ping_agent());
}

INSTANTIATE_TEST_CASE_P(
CanTransports,
ClientAgentCan,
::testing::Values(MiddlewareKind::FASTDDS));
98 changes: 98 additions & 0 deletions test/test/client_agent/ClientAgentCan.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#ifndef IN_TEST_CLIENTCAN_INT_HPP
#define IN_TEST_CLIENTCAN_INT_HPP

#include <uxr/agent/transport/can/CanAgentLinux.hpp>
#include <ClientCan.hpp>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <net/if.h>

class AgentCan
{
public:
const char * dev = "vcan0";
const uint32_t can_id = 0x00000001; // TODO: test different can_id

AgentCan(MiddlewareKind middleware)
: middleware_{}
{
switch (middleware)
{
case MiddlewareKind::FASTDDS:
middleware_ = eprosima::uxr::Middleware::Kind::FASTDDS;
break;
case MiddlewareKind::FASTRTPS:
middleware_ = eprosima::uxr::Middleware::Kind::FASTRTPS;
break;
case MiddlewareKind::CED:
middleware_ = eprosima::uxr::Middleware::Kind::CED;
break;
}
}

~AgentCan()
{}

bool is_interface_up(const char * interface)
{
struct ifreq ifr;
int sock = socket(PF_CAN, SOCK_RAW, CAN_RAW);
memset(&ifr, 0, sizeof(ifr));
strcpy(ifr.ifr_name, interface);
ioctl(sock, SIOCGIFFLAGS, &ifr);
close(sock);
return !!(ifr.ifr_flags & IFF_UP);
}

void start()
{
if (!is_interface_up(dev))
{
ASSERT_TRUE(0 == system("ip link add dev vcan0 type vcan && ip link set vcan0 mtu 72 && ip link set dev vcan0 up"));
}

agent_can_.reset(new eprosima::uxr::CanAgent(dev, can_id, middleware_));
agent_can_->set_verbose_level(6);
ASSERT_TRUE(agent_can_->start());
}

void stop()
{
ASSERT_TRUE(agent_can_->stop());
}

private:
std::unique_ptr<eprosima::uxr::CanAgent> agent_can_;
eprosima::uxr::Middleware::Kind middleware_;
};

class ClientAgentCan : public ::testing::TestWithParam<MiddlewareKind>
{
public:
ClientAgentCan()
: client_can_(0.0f, 8)
, agent_(GetParam())
{}

~ClientAgentCan()
{}

void SetUp() override
{
agent_.start();
ASSERT_NO_FATAL_FAILURE(client_can_.init_transport(agent_.dev, agent_.can_id + 1));
}

void TearDown() override
{
ASSERT_NO_FATAL_FAILURE(client_can_.close_transport());
agent_.stop();
}

protected:
ClientCan client_can_;
AgentCan agent_;
};

#endif // ifndef IN_TEST_CLIENTCAN_INT_HPP
Loading

0 comments on commit df0cac4

Please sign in to comment.