Coder Social home page Coder Social logo

eprosima / rpc Goto Github PK

View Code? Open in Web Editor NEW
60.0 22.0 32.0 59.08 MB

RPC over TCP/DDS/REST

License: Apache License 2.0

Python 0.29% Makefile 0.18% C++ 83.11% C 4.08% Java 5.06% Shell 1.26% Thrift 0.01% CMake 1.19% Batchfile 2.08% CSS 0.30% HTML 0.05% M4 0.75% Roff 1.62%

rpc's Introduction

Introduction

This repository contains a set of C++ libraries that provide different RPC communications.

  • eProsima Fast RPC provides a fast RPC communication using a modified CDR serialization over TCP.
  • eProsima RPC over DDS provides an RPC communication over an OMG DDS implementation. Currently it supports eProsima Fast DDS and RTI DDS implementations.
  • eProsima RPC over REST provides an RPC communication over RESTful paradigma.

Building from sources

This section provides the instructions for installing eProsima RPC from sources. The following packages will be installed:

  • boost_threadpool is a cross-platform C++ thread pool library.
  • foonathan_memory_vendor, an STL compatible C++ memory allocator library.
  • fastcdr, a C++ library that serializes according to the standard CDR serialization mechanism.
  • fastdds, the core library of eProsima Fast DDS library.

First of all, the software requirements and software dependencies detailed below need to be met. Afterwards, the user can choose whether to follow either the colcon installation or the CMake installation instructions.

Requirements

Windows requirements

The installation of eProsima RPC in a Windows environment from sources requires the following tools to be installed in the system:

Visual Studio

Visual Studio is required to have a C++ compiler in the system. For this purpose, make sure to check the Desktop development with C++ option during the Visual Studio installation process.

If Visual Studio is already installed but the Visual C++ Redistributable packages are not, open Visual Studio and go to Tools -> Get Tools and Features and in the Workloads tab enable Desktop development with C++. Finally, click Modify at the bottom right.

Chocolatey

Chocolatey is a Windows package manager. It is needed to install some of eProsima RPC's dependencies. Download and install it directly from the website.

CMake and other tools

These packages provide the tools required to install eProsima RPC and its dependencies from command line. Download and install CMake, pip3, wget and git by following the instructions detailed in the respective websites. Once installed, add the path to the executables to the PATH from the Edit the system environment variables control panel.

Dependencies

eProsima RPC has the following dependencies, when installed from sources in a Windows environment:

Asio and TinyXML2 libraries

Asio is a cross-platform C++ library for network and low-level I/O programming, which provides a consistent asynchronous model. TinyXML2 is a simple, small and efficient C++ XML parser.

Windows

On Windows, they can be downloaded directly from the links below:

After downloading these packages, open an administrative shell with PowerShell and execute the following command:

    choco install -y -s <PATH_TO_DOWNLOADS> asio tinyxml2

where <PATH_TO_DOWNLOADS> is the folder into which the packages have been downloaded.

Colcon installation

colcon is a command line tool based on CMake aimed at building sets of software packages. This section explains how to use it to compile eProsima RPC and its dependencies.

Note:

Run colcon within a Visual Studio prompt. To do so, launch a "Developer Command Prompt" from the
search engine.
  1. Install the ROS 2 development tools (colcon and vcstool) by executing the following command:

    pip3 install -U colcon-common-extensions vcstool

    and add the path to the vcs executable to the PATH from the Edit the system environment variables control panel.

    Note:

    If this fails due to an Environment Error, add the :code:`--user` flag to the :code:`pip3` installation command.
    
  2. Create a RPC directory and download the repos file that will be used to install eProsima RPC and its dependencies:

     mkdir ~\RPC
     cd ~\RPC
     wget https://raw.githubusercontent.com/eProsima/RPC/master/rpc.repos -output rpc.repos
     mkdir src
     vcs import src --input rpc.repos

    Finally, use colcon to compile all software:

    • Building eProsima RPC over DDS use next command:
      colcon build --cmake-args -DNO_TLS=ON -DRPCPROTO=rpcdds

Run an application

When running an instance of an application using eProsima RPC, the colcon overlay built in the dedicated RPC directory must be sourced. There are two possibilities:

  • Every time a new shell is opened, prepare the environment locally by typing the command:

    setup.bat
    
  • Add the sourcing of the colcon overlay permanently, by opening the Edit the system environment variables control panel, and adding ~/RPC/install/setup.bat to the PATH.

CMake installation

This section explains how to compile eProsima RPC with CMake, either [locally][#local-installation] or globally.

Local installation

  1. Open a command prompt, and create a RPC directory where to download and build eProsima RPC and its dependencies:

        mkdir ~\RPC
  2. Clone the following dependencies and compile them using [CMake][¢make].

    • boost_threadpool

      cd ~\RPC
      git clone https://github.com/eProsima/boost_threadpool.git
      cd boost_threadpool
      mkdir build && cd build
      cmake -DCMAKE_INSTALL_PREFIX=~/RPC/install ..
      cmake --build . --target install
    • RPC depends on Foonathan memory. To ease the dependency management, eProsima provides a vendor package Foonathan memory vendor, which downloads and builds a specific revision of Foonathan memory if the library is not found in the system.

      cd ~\RPC
      git clone https://github.com/eProsima/foonathan_memory_vendor.git
      cd foonathan_memory_vendor
      mkdir build && cd build
      cmake -DCMAKE_INSTALL_PREFIX=~/RPC/install ..
      cmake --build . --target install
    • Fast CDR

      cd ~\RPC
      git clone https://github.com/eProsima/Fast-CDR.git
      cd Fast-CDR
      mkdir build && cd build
      cmake -DCMAKE_INSTALL_PREFIX=~/RPC/install ..
      cmake --build . --target install
    • Fast DDS

      cd ~\RPC
      git clone https://github.com/eProsima/Fast-DDS.git
      cd Fast-DDS
      mkdir build && cd build
      cmake -DNO_TLS=ON -DCMAKE_INSTALL_PREFIX=~/RPC/install ..
      cmake --build . --target install
  3. Once all dependencies are installed, install eProsima RPC:

    • Building eProsima RPC over DDS use next commands:

      cd ~\RPC
      [git](git) clone https://github.com/eProsima/RPC.git
      cd RPC
      mkdir build && cd build
      cmake -DRPCPROTO=rpcdds -DCMAKE_INSTALL_PREFIX=~/RPC/install ..
      cmake --build . --target install

Global installation

To install eProsima RPC system-wide instead of locally, remove the CMAKE_INSTALL_PREFIX flags that appear in the configuration steps.

Run an application

When running an instance of an application using eProsima RPC, it must be linked with the library where the packages have been installed. This can be done by opening the Edit system environment variables control panel and adding to the PATH the RPC, Fast DDS and Fast CDR installation directories:

  • RPC: C:\Program Files\rpc
  • Fast DDS: C:\Program Files\fastrtps
  • Fast CDR: C:\Program Files\fastcdr

rpc's People

Contributors

ikerluengo avatar jaimemartin avatar pro avatar rafaellaraalvarez avatar richiprosima avatar richiware avatar rubenrubio avatar santiagomunoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpc's Issues

RPC over DDS server NotEnoughMemoryException

RPC over DDS 1.03 running on Ubuntu 16.04 x64.

Running the example: 'rpcddsgen -example x64Linux2.6gcc4.4.5 hello.idl'

hello.idl: interface Hello { void hello(); };

When running the server after starting the client I always get the exception:

terminate called after throwing an instance of 'eprosima::fastcdr::exception::NotEnoughMemoryException' what(): Not enough memory in the buffer stream Aborted (core dumped)

I have not tried in other platforms.

Compilation error:ThreadPoolStrategy.cpp:66:45: error: no member named 'task_functor' in namespace 'boost::threadpool'

Hello,I copied
/home/user/RPC/thirdparty/boost-threadpool
to
/usr/include/boost

but got this compilation error:

home/alex/software/RPC/src/strategies/ThreadPoolStrategy.cpp:66:62: error: expected '(' for function-style cast or type construction
        m_pool->schedule(boost::threadpool::task_functor<void>(boost::bind(&ThreadPoolStrategyJob::run, job)));
                                                         ~~~~^
/home/alex/software/RPC/src/strategies/ThreadPoolStrategy.cpp:66:45: error: no member named 'task_functor' in namespace 'boost::threadpool'
        m_pool->schedule(boost::threadpool::task_functor<void>(boost::bind(&ThreadPoolStrategyJob::run, job)));

Compilation fails due to FindBoostThreadpool.cmake missing

I'm trying to build rpc library from source.
The boost libraries have been installed with command:
\.b2 link=shared.

When executing command:
build>cmake -DRPCPROTO=rpcdds -A x64 ..

the boost libraries are correctly found:
-- Found Boost: F:/boost_1_75_0/boost_1_75_0 (found version "1.75.0") found components: thread system date_time chrono regex atomic

but cmake fails at the following instruction:
find_package(BoostThreadpool REQUIRED)

with the following message:

  By not providing "FindBoostThreadpool.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "BoostThreadpool", but CMake did not find one.

  Could not find a package configuration file provided by "BoostThreadpool"
  with any of the following names:

    BoostThreadpoolConfig.cmake
    boostthreadpool-config.cmake

  Add the installation prefix of "BoostThreadpool" to CMAKE_PREFIX_PATH or
  set "BoostThreadpool_DIR" to a directory containing one of the above files.
  If "BoostThreadpool" provides a separate development package or SDK, be
  sure it has been installed.

But no file containing "BoostThreadpool" is present in any directory and at the moment is not possible to complete the compilation

error: narrowing conversion of ‘***********’ from ‘unsigned int’ to ‘int’ [-Wnarrowing]

hello:
I'm trying to build rpc library from source.

When executing command:
cmake --build . --target install

show err :

/home/fastdds/RPC-master/examples/C++/rpcdds/c++11Types/RTPSCalculator/CalculatorDDSProtocol.cxx:131:22: error: narrowing conversion of ‘3418803882’ from ‘unsigned int’ to ‘int’ [-Wnarrowing]
  131 |                 case 0xCBC6CEAA:
      |                      ^~~~~~~~~~
/home/fastdds/RPC-master/examples/C++/rpcdds/c++11Types/RTPSCalculator/CalculatorDDSProtocol.cxx:174:22: error: narrowing conversion of ‘3389102612’ from ‘unsigned int’ to ‘int’ [-Wnarrowing]
  174 |                 case 0xCA019A14:
      |                      ^~~~~~~~~~

REST Over DDS/ FastRTPS

Is there an example of REST over FastRTPS over DDS, my systems on DDS and I want it to connect with AWS via REST . Is that possible.

rpcddsgen 无法识别部分IDL文件的类型

1、rpcddsgen 转换union联合体类型为C++代码时,C++代码缺少类型,编译报错。
2、rpcddsgen 无法识别IDL文件中的@DDSService注解
3、rpcddsgen 无法识别 #ifndef #end等

Build fail against latest Fast-RTPS

Hi,
i cloned the latest versions from Fast-CDR, Fast-RTPS and RPC repositories and installed all external dependencies. CDR and RTPS builds ok, then I build the make files like cmake -DRPCPROTO=rpcdds .. and finally make which produce the following build error against the latest RTPS.

[  1%] Building CXX object src/CMakeFiles/rpcdds.dir/transports/dds/components/RTPSProxyProcedureEndpoint.cpp.o
/tank/storage/projects/Nblr Solutions/autonomate_coreplatform/lib/fastrpc/src/transports/dds/components/RTPSProxyProcedureEndpoint.cpp: In member function ‘virtual void eprosima::rpc::transport::dds::RTPSProxyProcedureEndpoint::onNewDataMessage(eprosima::fastrtps::Subscriber*)’:
/tank/storage/projects/Nblr Solutions/autonomate_coreplatform/lib/fastrpc/src/transports/dds/components/RTPSProxyProcedureEndpoint.cpp:435:31: error: ‘ALIVE’ is not a member of ‘eprosima::fastrtps’
         if(info.sampleKind == eprosima::fastrtps::ALIVE)
                               ^~~~~~~~
/tank/storage/projects/Nblr Solutions/autonomate_coreplatform/lib/fastrpc/src/transports/dds/components/RTPSProxyProcedureEndpoint.cpp:435:31: note: suggested alternative:
In file included from /usr/local/include/fastdds/rtps/common/all_common.h:31:0,
                 from /usr/local/include/fastdds/dds/core/policy/ParameterTypes.hpp:24,
                 from /usr/local/include/fastdds/dds/core/policy/QosPolicies.hpp:26,
                 from /usr/local/include/fastrtps/qos/QosPolicies.h:23,
                 from /usr/local/include/fastdds/rtps/attributes/WriterAttributes.h:27,
                 from /usr/local/include/fastrtps/attributes/PublisherAttributes.h:26,
                 from /usr/local/include/fastrtps/publisher/Publisher.h:26,
                 from /tank/storage/projects/Nblr Solutions/autonomate_coreplatform/lib/fastrpc/src/transports/dds/components/RTPSProxyProcedureEndpoint.cpp:20:
/usr/local/include/fastdds/rtps/common/CacheChange.h:41:5: note:   ‘ALIVE’
     ALIVE,                            //!< ALIVE
     ^~~~~
/tank/storage/projects/Nblr Solutions/autonomate_coreplatform/lib/fastrpc/src/transports/dds/components/RTPSProxyProcedureEndpoint.cpp: In member function ‘virtual void eprosima::rpc::transport::dds::RTPSProxyProcedureEndpoint::onSubscriptionMatched(eprosima::fastrtps::Subscriber*, eprosima::fastrtps::rtps::MatchingInfo&)’:
/tank/storage/projects/Nblr Solutions/autonomate_coreplatform/lib/fastrpc/src/transports/dds/components/RTPSProxyProcedureEndpoint.cpp:496:23: error: ‘MatchingStatus’ has not been declared
     if(info.status == MatchingStatus::MATCHED_MATCHING)
                       ^~~~~~~~~~~~~~
/tank/storage/projects/Nblr Solutions/autonomate_coreplatform/lib/fastrpc/src/transports/dds/components/RTPSProxyProcedureEndpoint.cpp: In member function ‘virtual void eprosima::rpc::transport::dds::RTPSProxyProcedureEndpoint::onPublicationMatched(eprosima::fastrtps::Publisher*, eprosima::fastrtps::rtps::MatchingInfo&)’:
/tank/storage/projects/Nblr Solutions/autonomate_coreplatform/lib/fastrpc/src/transports/dds/components/RTPSProxyProcedureEndpoint.cpp:514:23: error: ‘MatchingStatus’ has not been declared
     if(info.status == MatchingStatus::MATCHED_MATCHING)
                       ^~~~~~~~~~~~~~
src/CMakeFiles/rpcdds.dir/build.make:521: recipe for target 'src/CMakeFiles/rpcdds.dir/transports/dds/components/RTPSProxyProcedureEndpoint.cpp.o' failed
make[2]: *** [src/CMakeFiles/rpcdds.dir/transports/dds/components/RTPSProxyProcedureEndpoint.cpp.o] Error 1
CMakeFiles/Makefile2:956: recipe for target 'src/CMakeFiles/rpcdds.dir/all' failed
make[1]: *** [src/CMakeFiles/rpcdds.dir/all] Error 2
Makefile:179: recipe for target 'all' failed
make: *** [all] Error 2

Examples don't link out of the box

Just cloned and built RPC a moment ago, with the following options:

  • THIRDPARTY=ON
  • RPCPROTO=rpcdds
  • WITH_FASTRTPS=ON
  • COMPILE_EXAMPLES=ON
    The following error occurs:
    /usr/bin/ld: libCalculator.a(CalculatorTopicsPlugin.cxx.o): undefined reference to symbol '_ZN8eprosima7fastcdr3CdrC1ERNS0_10FastBufferENS1_10EndiannessENS1_7CdrTypeE' /home/vilas/projects/theirs/RPC/build/external/install/lib/libfastcdr.so.1.0.7: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status CMakeFiles/CalculatorServerExample.dir/build.make:131: recipe for target 'CalculatorServerExample' failed make[5]: *** [CalculatorServerExample] Error 1 CMakeFiles/Makefile2:142: recipe for target 'CMakeFiles/CalculatorServerExample.dir/all' failed make[4]: *** [CMakeFiles/CalculatorServerExample.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make[3]: *** [all] Error 2

how to install rpcddsgen tool ?

I have downloaded the installation package according to the tutorial on the official website. Both Linux and windows have tried and failed. I thought the reason is probably due to rpcddsgen.jar error.
Please give the detailed installation tutorial and installation package, looking forward to your reply.

Build Failure under Boost 1.66

When I tried to build, below log was shown.

/usr/local/include/boost/asio/io_service.hpp:27:20: error: conflicting declaration ‘typedef class boost::asio::io_context boost::asio::io_service’
 typedef io_context io_service;
                    ^~~~~~~~~~
In file included from /home/tinyara/github/eProsima/RPC/src/transports/TCPServerTransport.cpp:9:0:
/home/tinyara/github/eProsima/RPC/include/transports/TCPServerTransport.h:24:15: note: previous declaration as ‘class boost::asio::io_service’
         class io_service;
               ^~~~~~~~~~

I found that the forward declaration makes error.
In Boost 1.42, io_service was class, but in Boost 1.66, io_service is defined like typedef io_context io_service;

I think we can remove forward declaration and include <boost/asio.hpp>

RPC over DDS (RTPS): Multiple subscribers delivery problem

In the example RTPSCalculator I executed multiple (2-10) CalculatorServerExample instances. Then I launch 1 instance of CalculatorClientExample.
Some (2 - always, 3 - maximum) server instances received both 'addition' and 'subtraction', some (1-2) only 'subtraction' and others none of them.
RTPSCalculatorAsync - situation even worse.
I tried this with disabled antivirus/firewall, additional network interfaces - same result.
OS: windows 7 x64
MSVC 2015

I tried both binary distribution and manualy compiled from github.
P.S. As I saw in debugger RTPSProxyProcedureEndpoint::num_matched_sub_ & RTPSProxyProcedureEndpoint::num_matched_pub_ does not match the number of launched server instances.

Thanks!

RPC Linux

Is the RPC developed for windows platform only?
If linux version available please provide it as building fails!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.