Difference between revisions of "API2"
From RobotinoWiki
Line 5: | Line 5: | ||
|A C/C++ library to access Robotino's sensors and actors from your own program. | |A C/C++ library to access Robotino's sensors and actors from your own program. | ||
|} | |} | ||
+ | |||
+ | ==Quick links== | ||
+ | * [https://doc.openrobotino.org/download/RobotinoAPI2/rec_robotino_api2/ Documentation] | ||
==Example== | ==Example== |
Revision as of 10:41, 18 March 2019
Introduction
A C/C++ library to access Robotino's sensors and actors from your own program. |
Quick links
Example
#include <iostream> #include "rec/robotino/api2/all.h" rec::robotino::api2::Com com; rec::robotino::api2::Bumper bumper; int main( int argc, char **argv ) { std::string hostname = "172.26.1.1"; if( argc > 1 ) { hostname = argv[1]; } com.setAddress( hostname.c_str() ); com.connectToServer( true ); while(com.isConnected() && false == bumper.value()) { std::cout << "Bumper is " << (bumper.value()?"":"not") << " pressed" << std::endl; com.processEvents(); rec::robotino::api2::msleep( 100 ); } com.disconnectFromServer(); rec::robotino::api2::shutdown(); return 0; }