create_DataTrace.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <vector>
00003 #include <signal.h>
00004 #include "youbot/YouBotBase.hpp"
00005 #include "youbot/YouBotManipulator.hpp"
00006 #include "youbot/DataTrace.hpp"
00007 
00008 using namespace std;
00009 using namespace youbot;
00010 
00011 bool running = true;
00012 
00013 void sigintHandler(int signal) {
00014   running = false;
00015   std::cout << std::endl << " Interrupt!" << std::endl;
00016 }
00017 
00018 int main() {
00019 
00020   signal(SIGINT, sigintHandler);
00021 
00022   try {
00023 
00024     YouBotBase myBase("youbot-base");
00025 
00026     myBase.doJointCommutation();
00027 
00028     DataTrace myTrace(myBase.getBaseJoint(4), "testName");
00029 
00030     JointCurrentSetpoint currentSetpoint;
00031     currentSetpoint.current = 0.4 * ampere;
00032 
00033     myTrace.startTrace();
00034 
00035     while (running) {
00036       SLEEP_MILLISEC(1);
00037       myBase.getBaseJoint(4).setData(currentSetpoint);
00038       myTrace.updateTrace(currentSetpoint);
00039     }
00040 
00041     myTrace.stopTrace();
00042     myTrace.plotTrace();
00043 
00044     EthercatMaster::getInstance().destroy();
00045 
00046   } catch (std::exception& e) {
00047     std::cout << e.what() << std::endl;
00048   } catch (...) {
00049     std::cout << "unhandled exception" << std::endl;
00050   }
00051   return 0;
00052 }
Generated by  doxygen 1.6.3