Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 2.69 KB

README.md

File metadata and controls

75 lines (57 loc) · 2.69 KB

YARP basics tutorial

This tutorial shows some of the basic features of YARP, usually required when dealing with a robot 🤖

Gitpod

Prerequisites

For this tutorial, you just need to be aware of:

  • What a class is in C++
  • Optionally run CMake

You will see how to:

Build and Install the code

Follow these steps to build and properly install your module:

$ cd tutorial_yarp-basics
$ mkdir build; cd build
$ cmake ../
$ make
$ make install

the make install will install your module (binary, xml files, etc) in the icub contrib folder which is already setup on your machine.

Have fun with the tutorial

Terminal 1: Start the yarp server if not already running

$ yarpserver

Terminal 2: run the tutorial executable. It requires an input parameter to run!! The parameter is the name of the port the executable will open. The parameter must be given in the form of --name <portName> where is a string of your choise. Remember, portname must start with / and cannot contain @ charaters.

$ tutorial_yarp-basics  --name <portName>

Terminal 3: open a yarp port to send commands to the tutorial executable

$ yarp write ... <portName>

Terminal 4: open a yarp port to receive answers from the tutorial executable

$ yarp read ... <portName>

Terminal 5: start a yarpview to see the image being published

$ yarpview

Terminal 6: connect

$ yarp connect /imagePort:o /yarpview/img:i

Now everything is set up. The tutorial will open a fake robot part and instantiate a remote_controlboard device to connect to it. In the yarp write terminal you are able to send command to the tutorial executable and the output will be shown in the yarp read terminal.

Available commands are:

  • any integer number: the application will reply with that number +1
  • enc: the application will reply with the encoder position of the first joint of the fake robot
  • send_image: the application will send an image on port /imagePort:o
  • quit: the application will quit

Once the tutorial executable has received the first command, you'll also see a dummy image being shown in the yarpview window.