Home
FastRTPSGEN User`s Manual
Contents
1. SUE FASTRTPSGEN v1 0 0 USER MANUAL eProsima Proyectos y Sistemas de Mantenimiento SL Ronda del poniente 16 Bajo K 28760 Tres Cantos Madrid Tel 34 91 804 34 48 info eProsima com www eProsima com Trademarks eProsima is a trademark of Proyectos y Sistemas de Mantenimiento SL All other trademarks used in this document are the property of their respective owners License eProsima Fast RTPS is licensed under the terms described in the FASTRTPS_LIBRARY_LICENSE txt file in cluded in this distribution Technical Support Phone 34 91 804 34 48 Email Support eProsima com Contents A 4 NOOO NN 1 2 Building your publisher subscriber COEC cccsssssscccssssssscccsssssssseeessssseecessessseseeeesssseeeesessesseesseseseeees 2 3 Defining YOUF data ty PCSiciiessscssssseccecseveccccucssosssesecccecsecssdecsecectsssceecedcesdeceseseccsvessscsdscsassedsestsatecsiccssnessseoesd 4 Sil BaSiG t 0 ccs O TT 4 3 2 ANTAVS s r k ks Id E AA eae AAA A AA AA AAA AAA AE 4 33 SEQUENCES ask weer ca ce i i Ae A eed tl hee edd cae A eh ded el ee eee 5 A NO 5 3 5 UNION A A A AA A 6 3 6 ENUMErALO ASi A A A e ooh dat ad e o od ae lead 7 SR A IO 8 4 Hello World examples iscicsiccesessscsccecitsccveenedesdidccalcscassacscecededesescstucessceeve cdcdacddescsbasesessssvecteedscuscsscteededcdsedeets 9 41 Writing the IDE Tile neen AE ete GR oe PAG e le tees 9 4 2 GENErating specifie COGS seccace
2. The Java application can be executed using the following script In Windows gt fastrtpsgen bat Note The script will be found by Windows if its location has been set in the PATH environment variable This can be done during the installation process More information can be found in the Installation Manual In Linux fastrtpsgen sh eProsima FASTRTPSGEN Java application is capable of processing several IDL files The expected argument line is fastrtpsgen lt options gt lt IDL file gt lt IDL file gt where the available options are Option Description help Shows the help information version Shows the current version of eProsima FASTRTPSGEN d lt directory gt Output directory where the generated files are created example lt platform gt Generates an example and a solution to compile the generated source code for a specific platform The help command shows the supported platforms replace Replaces the generated source code files whether they exist For each processed IDL file eProsima FASTRTPSGEN tool generates nine source code files 2 eProsima FASTRTPSGEN Manual eProsima FASTRTPSGEN Manual 2 Building your publisher subscriber code The next table summarizes the content of each generated file supposing a file named Example idl is passed to the application File Description Example h cpp C Header and source file conta
3. types Next subsections introduce the supported IDL types 3 1 Basic types The following table shows the basic IDL types supported by eProsima FASTRTPSGEN and how they are mapped to C 11 IDL C 11 char vartype char vartype octet vartype uint8_t vartype short vartype int16 t vartype unsigned short vartype uint16 t vartype long vartype int32 t vartype unsigned long vartype uint32 t vartype long long vartype int64 t vartype unsigned long long vartype uint64 t vartype float vartype float vartype double vartype double vartype boolean vartype bool vartype string vartype std string vartype 3 2 Arrays eProsima FASTRTPSGEN supports arrays and multidimensional arrays An array is mapped to the STD array container The following table shows the supported array types and how they are mapped IDL type C 11 type char arraytype 5 std array lt char 5 gt arraytype octet arraytype 5 std array lt uintg t 5 gt arraytype short arraytype 5 std array lt int16 t 5 gt arraytype unsigned short arraytype 5 std array lt uint16 t 5 gt arraytype long arraytype 5 std array lt int32 t 5 gt arraytype eProsima FASTRTPSGEN Manual eProsima FASTRTPSGEN Manual 3 2 Arrays unsigned long arraytype 5 std array lt u
4. N Manual 3 Defining your data types eProsima FASTRTPSGEN Manual 3 7 Keyed Types In order to use keyed topics the user should define some key members inside the structure This is achieved by writting Key before the members of the structure you want to use as keys For example in the following IDL file struct MyType t Key long id Key string type long positionX long positionY 5 the fields id and type would be the keys in the type The FASTRTPSGEN application automatically detects these tags and correctly generates the serialization methods for the key generation function in TopicDataType getKey This function will obtain the 128 MD5 digest of the big endian serialization of the Key Members 8 eProsima FASTRTPSGEN Manual eProsima FASTRTPSGEN Manual 4 HelloWorld example 4 HelloWorld example This section explains how to write a HelloWorld example step by step This example has a simple structure with a string and a long id to transmit between the publisher and the subscriber 4 1 Writing the IDL file The first step is to write an IDL file containing the structures you want to serialize deserialize In this case it is a simple structure struct HelloWorld Key long id string message J Save this file as HelloWorld idl 4 2 Generating specific code Open a command prompt and go to the directory containing HelloWorld idl If you are running this example in Wind
5. amming language IDL C 11 union Union switch long class Union t t case 1 public octet octet value Union case 2 Union long long value Union const Union amp x case 3 Union Union amp amp x string string value Union amp operator const Union amp x Union amp operator Union amp amp x 6 eProsima FASTRTPSGEN Manual eProsima FASTRTPSGEN Manual 3 5 Unions void d int32t _ d int32_t _d const int32_t amp _d void octet_value uint8_t _octet_value uint8_t octet_value const uint8 t amp octet_value void long value int64_t _long value int64_t long value const int64_t amp long value void string value const std string amp string value void string value std string amp amp string value const std string amp string value const std string amp string value private int32 t m_d uint8 t m octet value int64 t m long value std string m string value 3 6 Enumerations An enumeration in IDL format is a collection of identifiers that have a numeric value associated An IDL enu meration type is mapped directly to the corresponding C 11 enumeration definition The following table shows an example of an IDL enumeration type and its mapping to the C 11 programming language IDL C 11 enum Enumeration enum Enumeration uint32_t t t RED RED GREEN GREEN BLUE BLUE E y eProsima FASTRTPSGE
6. ed as a C class while each member is mapped as a class attribute A set of methods to get and set the attribute is also created The following table shows and example of an IDL structure type and its map ping to the C 11 programming language eProsima FASTRTPSGEN Manual 3 Defining your data types eProsima FASTRTPSGEN Manual IDL C 11 struct Structure class Structure t t octet octet value public long long value Structure string string value Structure Structure const Structure amp x Structure Structure amp amp x Structure amp operator const Structure amp x Structure amp operator Structure 88x void octet_value uint8_t _octet_value uint8_t octet_value const uint8_tg octet_value void long value int64 t long value int64 t long value const int64_t amp long value void string value const std string 8 string value void string value std string 88 string value const std string amp string value const std string amp string value private uint8 t m octet value int64 t m long value std string m string value Ja 3 5 Unions In IDL a union is defined as a sequence of members with their own types and a discriminant that specifies which member is in use An IDL union type is mapped as a C class with access functions to the union members and the discriminant The following table shows an example of IDL union type and its mapping to the C 11 progr
7. ining the user data types mapped to C 11 programming language as well as serialization and deserialization methods for the types ExamplePublisher h cpp C code where a publisher is created and used to send the user defined types ExampleSubscriber h cpp C code where a subscriber is created and used to receive the user defined types ExamplePubSubType h cpp C code that uses the serialization and deserializa tion methods defined for the types to serialize the data into the message that the publisher sends or the subscriber receives It also defines the method needed to obtain the key from the data type ExamplePubSubMain cpp Main file of the example It parses the argument publisher or subscriber and executes the selected side accordingly eProsima FASTRTPSGEN Manual 3 Defining your data types eProsima FASTRTPSGEN Manual 3 Defining your data types You have to define your data types using IDL format Not all IDL features are supported in this version of eProsima FASTRTPSGEN This section shows you what IDL types are supported and how eProsima FASTRT PSGEN maps them in C 11 programming language For each IDL file parsed by eProsima FASTRTPSGEN two source code files are generated They contain the C 11 mapping of your IDL types For example from an IDL file named Foo idl eProsima FASTRTPSGEN tool generates the files Foo h and Foo cpp that contain the C 11 mapping of the defined IDL
8. int32 t 5 gt arraytype long long arraytype 5 std array lt int64 t 5 gt arraytype unsigned long long arraytype 5 std array lt uint64 t 5 gt arraytype float arraytype 5 std array lt float 5 gt arraytype double arraytype 5 std array lt double 5 gt arraytype 3 3 Sequences eProsima FASTRTPSGEN supports sequences A sequence is mapped to the STD vector container The fol lowing table shows the supported sequence types and how they are mapped IDL C 11 sequence lt char gt sequencetype std vector lt char gt seguencetype sequence lt octet gt sequencetype std vector lt uint8_t gt sequencetype sequence lt short gt sequencetype std vector lt int16_t gt sequencetype sequence lt unsigned short gt sequencetype std vector lt uint16_t gt sequencetype sequence lt long gt sequencetype std vector lt int32_t gt sequencetype seguence lt unsigned long gt sequencetype std vector lt uint32_t gt sequencetype sequence lt long long gt sequencetype std vector lt int64_t gt sequencetype seguence lt unsigned long long gt sequencetype std vector lt uint64 t gt sequencetype sequence lt float gt sequencetype std vector lt float gt sequencetype sequence lt double gt sequencetype std vector lt double gt sequencetype 3 4 Structures In IDL a structure is defined as a set of members each one with its own type An IDL structure type is mapp
9. ke data HelloWorld st if mp_sub gt takeNextData amp st 8m info if m_info sampleKind ALIVE Print your structure data here 4 4 Building and executing To build your code using Visual Studio 2010 make sure you are in the Debug or Release profile and then build it F7 Now go to lt example_dir gt bin x64Win64vS2010 directory and execute HelloWorl dExample exe with the correct argument either publisher or subscriber To build your code in Linux use this command make f makefile x64Linux2 6gcc In both scenarios you should start the same executable in two different terminals passing pub lisher and subscriber to each of them 10 eProsima FASTRTPSGEN Manual
10. on Data Representation is a transfer syntax low level representation for transfer between agents mapping from data types defined in OMG IDL to byte streams One of the main features of eProsima FASTRTPSGEN is to avoid the users the trouble of knowing anything about serialization or deserialization procedures It also provides a first implementation of a publisher and a subscriber using eProsima RTPS library This document presents a brief guide of how to use eProsima FASTRTPSGEN The structure of the docu ment is presented below e You begin learning how to use the application to create your source code in section 2 Building your publisher subscriber code e All supported data types by eProsima FASTRTPSGEN are listed in section 3 Defining your data types This section also shows how to define these data types using the IDL definition language In section 4 HelloWorld example a complete HelloWorld example is shown This release of eProsima FASTRTPSGEN only supports the generation of source code in C 11 Forthcoming releases will integrate more programming languages 1 Visit http www omg org cgi bin doc formal 02 06 51 for more information about CDR serialization standard eProsima FASTRTPSGEN Manual 1 2 Building your publisher subscriber code eProsima FASTRTPSGEN Manual 2 Building your publisher subscriber code This section guides you through the usage of this Java application and briefly describes the generated files
11. ows execute the following line fastrtpsgen example x64Win64VS2010 HelloWorld idl If you are running it in Linux execute this one fastrtpsgen example x64Linux2 6gcc HelloWorld idl Note that if you are running eProsima FASTRTPSGEN in a 32 bit operating system you have to use example i86Win32VS2010 or example i86Linux2 6gcc instead This command generates your serialization code and some project files designed to build your Hel loWorld example In Windows it generates a Visual Studio 2010 solution named solu tion x64Win64VS2010 s n This solution has a single project called HelloWorld with all the needed code already included In Linux on the other hand it generates a makefile 4 3 Finishing the generated code To finish the behaviour of the publisher and the subscriber you need to edit the run method in the HelloWorldPublisher cxx file and the onNewDataMessage method of the listener of the subscriber in the HelloWorldSubscriber cxx file eProsima FASTRTPSGEN Manual 9 4 HelloWorld example eProsima FASTRTPSGEN Manual 4 3 1 Publisher behavior void HelloWorldPublisher run while m_listener n_matched eClock my_sleep 250 Sleep 250 ms Publication code HelloWorld st Modify the values of your structure here mp_publisher gt write amp st 4 3 2 Subscriber behavior void exampleSubscriber SubListener onNewDataMessage if mp_sub NULL t Ta
12. ts 355820 iv kudeala as bed be ehee vaa 9 4 3 Finishing the generated CON ccccccccnnnnnooononononcnnnnnnnnnnonncononnnnnnnnnnnrnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnrnnrnnnnnnnnnnnnnnss 9 4 3 Publisher behavior anceis lat aga kava 10 4 3 2 Subscriber behavior siria 10 4 4 B ilding ANG EXECUTIOS coi desd 10 Figure List Table List eProsima FASTRTPSGEN Manual 1 Introduction 1 Introduction eProsima FASTRTPSGEN is a Java application that generates source code using the data types defined in an IDL file This generated source code can be used in your applications in order to publish and subscribe to a topic of your defined type To declare your structured data you have to use IDL Interface Definition Language format IDL is a spe cification language made by OMG Object Management Group which describes an interface in a lan guage independent way enabling communication between software components that do not share the same language eProsima FASTRTPSGEN is a tool that reads IDL files and parses a subset of the OMG IDL specification to generate serialization source code This subset includes the data type descriptions included in section 3 The rest of the file content is ignored eProsima FASTRTPSGEN generated source code uses a relevant component a C 11 library that provides a serialization mechanism In this case as indicated by the RTPS specification document the serialization mechanism used in CDR The standard CDR Comm
Download Pdf Manuals
Related Search
Related Contents
USER`S GUIDE - MyLineSpa.com GX2000E_GX2100E_OM_E.. USER GUIDE MANUEL DE L`UTILISATEUR Manual de instrucciones - TDA INFORME TECNICO PREVIO DE EVALUACION DE SOFTWARE N Snapper - Agco Lawn Mower 5900528 User's Manual こちら Sony DVP-K370 User's Manual Yamaha USB Audio Driver for Mac OS X 取扱説明書 Copyright © All rights reserved.
Failed to retrieve file