Git Product home page Git Product logo

rti_boilerplate's Introduction

rti_boilerplate

This package allows a user to create multiple instances of publisher and subscriber within one node. The API supports instances of different message types defined in an IDL file.

Adding new IDL file:

  1. Add your own idl file in the idl folder.

  2. Generate the codes:

    $ ./gencode

This script will auto:

  • Generate the DDS codes for the idl files you have created.
  • Generate boilerplates specific to the message type so you can use the API.
  • Generate a CMakeLists.txt for the boilerplates. This must be included in the main CMakeLists.txt so you can use it in the API. See No.3 .
  1. Add the generated codes and boilerplates in the main CMakeLists.txt:

     include(lib/boilerplate/Template/CMakeLists.txt)
     include(lib/boilerplate/Sensors/CMakeLists.txt)
     include(lib/boilerplate/<IDL_NAME>/CMakeLists.txt)
    
     add_executable(main
         src/main.cpp
         ${BOILERPLATE_SOURCE}
         ${SOURCE_Template}
         ${SOURCE_Sensors}
         ${SOURCE_<IDLNAME>}
     )
    

Using the API:

  1. Include your new message type's header files:

     #include "TemplateBoilerplate.h"
    
  2. Create participant:

     DDSBoilerplate * participant;
     participant = new DDSBoilerplate(DOMAIN_ID);
    
  3. Creating a Publisher:

     TemplateMsg::Publisher pub1(participant, "Example Template1");
    

TemplateMsg can be any message based on the idl file you have created.

  1. Publish:

     pub1.instance->value = 1;
     pub1.publish(); 
    
  2. Creating a Subscriber:

     TemplateMsg::Subscriber sub1(participant, "Example Template3");
    

TemplateMsg can be any message based on the idl file you have created.

  1. Subscribing and receiving data:

    for (int i = 0; i < sub1.get_data_seq().length(); ++i) {
         if (sub1.get_info_seq()[i].valid_data) {
             float sensor_val = sub1.get_data_seq()[i].value;
             printf("Value3: %f\n", sensor_val);
         }
     }
    

rti_boilerplate's People

Contributors

grassjelly avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

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.