Send a command to the car-like Cycab mobile robot.
#include "visp/vpConfig.h"
#include "visp/vpRobotCycab.h"
#include "visp/vpMath.h"
#include <iostream>
#ifdef VISP_HAVE_CYCAB
int main()
{
try {
double x, y;
double x_min=2000, x_max=0, y_min=2000, y_max=0;
std::cout << "Send the command v: " << v << " m/s and phi: "
while (true) {
robot.setCommand(v, phi);
robot.getJoystickPosition(x, y);
if (x < x_min) x_min = x;
if (y < y_min) y_min = y;
if (x > x_max) x_max = x;
if (y > y_max) y_max = y;
std::cout << "x_min: " << x_min << " x_max: " << x_max
<< " y_min: " << y_min << " y_max: " << y_max
<< std::endl;
usleep(10000);
}
}
catch(...) {
std::cerr << "An exception was catched" << std::endl;
return 1;
}
return 0;
}
#else // VISP_HAVE_CYCAB
int main()
{
std::cout << "Sorry, you don't have access to the Cycab car-like mobile robot."
<< std::endl;
}
#endif // VISP_HAVE_CYCAB