/******************************************************************************* * Copyright (c) 2018 INSA - GEI, Toulouse, France. * All rights reserved. This program and the accompanying materials * are made available "AS IS", without any warranty of any kind. * * INSA assumes no responsibility for errors or omissions in the * software or documentation available. * * Part of code Copyright ST Microelectronics. * * Contributors: * Lucien Senaneuch - Initial API and implementation * Sebastien DI MERCURIO - Maintainer since Octobre 2018 *******************************************************************************/ #include #include #include "Robot.h" #include using namespace std; #define NB_TEST 50 #define DELAY_BETWEEN_TEST 1000000 // 1 seconde int nb_retries; int nb_test; int laststatus; int nb_success; int nb_timeout; int nb_unknown_cmd; int flipflop; int Test(Robot rob) { try { if (flipflop == 0) { rob.Move(100); } else { rob.Move(-100); } } catch (string e) { //if (e.find("Timeout")==string.npos) // status=ROBOT_TIMED_OUT; } return rob.GetLastCommandStatus();; } int main() { Robot myRobot; if (myRobot.Open("/dev/ttyUSB0") == SUCCESS) { // ouverture de la com avec le robot std::cout << "Start robot: "; try { myRobot.StartWithoutWatchdog(); } catch ( string e ) { std::cerr << std::endl << e << std::endl; return 1; } if (myRobot.GetLastCommandStatus()==SUCCESS) std::cout << "Ok" <