Difference between revisions of "Cpp2"

From RobotinoWiki
(Using API2 with Linux, gcc and cmake)
(Using API2 with Linux, gcc and cmake)
 
Line 56: Line 56:
  
 
==Using API2 with Linux, gcc and cmake==
 
==Using API2 with Linux, gcc and cmake==
* Install the appropriate [[downloads#API2|API2 binary package]] or build [[API2 source build|API2 from source]].
+
* Install the appropriate [[downloads#API2|API2 binary package]]
* Get the examples via svn from svn.openrobotino.org
 
:svn co http://svn.openrobotino.org/examples/trunk source/examples
 
* Build the examples.
 
<pre>
 
mkdir -p build/examples
 
cd build/examples
 
ccmake ../../source/examples
 
make
 
</pre>
 
* Run the examples.
 
<pre>
 
target/example_gui_camera
 
</pre>
 

Latest revision as of 15:25, 29 November 2019

Introduction

Robotino cpp icon 64.png The second version of the application programming interface (API2) for Robotino(r) from Festo Didactic permits full access to Robotino's sensors and actors. Communication between the control program and Robotino is handled via TCP and UDP and is therefor fully network transparent. It does not matter whether the control program runs direcly on Robotino or on a remote system.

API2 requires CF card 3.x. The Robotino Simulator currently does not support API2.

Package links

Code API

Source code

API2 binary package

Using API2 with Visual Studio 2010 and cmake

  • Install Visual Studio.
  • Install cmake.
  • If you want to build the examples with grafical user interface also install Qt4.
  • Install the appropriate API2 binary package.

In order to be able to modify the C++ examples shipping with the robotino_api2 package copy the folder holding the c++ examples from the installation directory to your user directory. This is a must for users of Windows Vista or later.

C:\Program Files\REC GmbH\robotino\api2\examples\c++ -> C:\Users\yourprofile\Documents

Build and run the (non-gui) circle example

Now use cmake (cmake-gui) to generate a Visual Studio project from the CMakeLists.txt in each example folder. Put in the correct path to the source code

C:/Users/yourprofile/Documents/c++/circle

Select a path where to generate the Visual Studio files to

C:/Users/yourprofile/Documents/build/c++/circle

Click configure. You'll be ask for the compiler you are going to use. Select Visual Studio 10 here. After configuration completed click Generate to generate the Visual Studio project.

Go to the build directory specified in the cmake GUI and launch the Visual Studio Solution by double-clicking the *.sln file. Build the example. Before running it you have to set Robotino's IP address in the Debugging property page.

Build and run GUI camera example

After installing Qt set the environment variable QTDIR pointing to the directory you installed Qt into. This is neccessary for cmake to find the Qt includes and libraries. Use cmake-gui to create the Visual Studio Solution. Build and run the application.

Using API2 with Linux, gcc and cmake