SimpleService

This sample is included with the C++, Python and the Java editions of OpenRTM-aist.

Overview

This is a sample that shows how to use ServicePort. The service is defined using the IDL shown below.

 typedef sequence<string> EchoList;
 typedef sequence<float> ValueList;

 interface MyService
 {
   string echo(in string msg);
   EchoList get_echo_history();
   void set_value(in float value);
   float get_value();
   ValueList get_value_history();
 };

Start the MyServiceConsumer and MyServiceProvider components. Activate the Consumer component and a list of available commands will be displayed on the console. Try each command. (Use RTSystemEditor for connection between ports.)

Screenshots

MyService_example_en.png
Running the SimpleService sample.

SimpleService_example_rtse_en.png
The SimpleService sample viewed in RTSystemEditor.

How to use

SimpleService is a sample that sends a command from MyServiceConsumer and causes it to be processed by MyServiceProvider. Connect the corresponding ports of MyServiceConsumer and MyServiceProvider on RTSystemEditor. Activate both components (If the Consumer component is activated, it may activate the Provider too). A list of commands will be displayed at the Consumer prompt, so try to use the commands. The response of the Provider can be observed on the prompt.

  • Procedure
    • Start RTSystemEditor and open a new SystemEditor. See RTSystemEditor for details on how to use RTSystemEditor
    • Start both MyServiceConsumer and MyServiceProvider components.

The startup of the component differs depending on the OS and the language of OpenRTM-aist, so start regarding the table below.

Windows Linux
MyServiceConsumer component MyServiceProvider component MyServiceConsumer component MyServiceProvider component
C++ MyServiceConsumer.bat MyServiceProvider.bat MyServiceConsumerComp MyServiceProviderComp
Python MyServiceConsumer.bat MyServiceProvider.bat MyServiceConsumer.py MyServiceProvider.py
Java MyServiceConsumer.bat MyServiceProvider.bat MyServiceConsumer.sh MyServiceProvider.sh
    • Both components are displayed on Name Service View of RTSystemEditor. Drag and drop the components from the Name Service View into the System Editor.
    • Drag and drop between two ports to connect them.
    • Activate both components by right-clinking one of components and selecting [Activate Systems] (in this case, if the Consumer is activated, the provider is activated too.)
    • Input commands at the Consumer console.
  • Commands
    • echo <message>: Displays a message.
    • set_value <value>: Sets a value to the Provider.
    • get_value: Displays the value set on the Provider.
    • get_echo_history: Displays messages that have been set on the Provider.
    • get_value_history: Displays values that have been set on the Provider.

Download

latest Releases : 2.0.0-RELESE

2.0.0-RELESE Download page

Number of Projects

Choreonoid

Motion editor/Dynamics simulator

OpenHRP3

Dynamics simulator

OpenRTP

Integrated Development Platform

AIST RTC collection

RT-Components collection by AIST

TORK

Tokyo Opensource Robotics Association

DAQ-Middleware

Middleware for DAQ (Data Aquisition) by KEK