GripperDataTrace.hpp

Go to the documentation of this file.
00001 #ifndef YOUBOT_GRIPPERDATATRACE_H
00002 #define YOUBOT_GRIPPERDATATRACE_H
00003 
00004 /****************************************************************
00005  *
00006  * Copyright (c) 2011
00007  * All rights reserved.
00008  *
00009  * Hochschule Bonn-Rhein-Sieg
00010  * University of Applied Sciences
00011  * Computer Science Department
00012  *
00013  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00014  *
00015  * Author:
00016  * Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov
00017  * Supervised by:
00018  * Gerhard K. Kraetzschmar
00019  *
00020  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00021  *
00022  * This sofware is published under a dual-license: GNU Lesser General Public 
00023  * License LGPL 2.1 and BSD license. The dual-license implies that users of this
00024  * code may choose which terms they prefer.
00025  *
00026  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00027  *
00028  * Redistribution and use in source and binary forms, with or without
00029  * modification, are permitted provided that the following conditions are met:
00030  *
00031  *     * Redistributions of source code must retain the above copyright
00032  *       notice, this list of conditions and the following disclaimer.
00033  *     * Redistributions in binary form must reproduce the above copyright
00034  *       notice, this list of conditions and the following disclaimer in the
00035  *       documentation and/or other materials provided with the distribution.
00036  *     * Neither the name of the Hochschule Bonn-Rhein-Sieg nor the names of its
00037  *       contributors may be used to endorse or promote products derived from
00038  *       this software without specific prior written permission.
00039  *
00040  * This program is free software: you can redistribute it and/or modify
00041  * it under the terms of the GNU Lesser General Public License LGPL as
00042  * published by the Free Software Foundation, either version 2.1 of the
00043  * License, or (at your option) any later version or the BSD license.
00044  *
00045  * This program is distributed in the hope that it will be useful,
00046  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00047  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00048  * GNU Lesser General Public License LGPL and the BSD license for more details.
00049  *
00050  * You should have received a copy of the GNU Lesser General Public
00051  * License LGPL and BSD license along with this program.
00052  *
00053  ****************************************************************/
00054 
00055 #include <vector>
00056 #include <sstream>
00057 #include <string>
00058 #include <cstdio>
00059 #include <stdexcept>
00060 #include <iostream>
00061 #include <stdlib.h>
00062 #include "boost/date_time/gregorian/gregorian.hpp"
00063 #include "boost/filesystem.hpp"
00064 #include "generic/Logger.hpp"
00065 #include "generic/Units.hpp"
00066 #include "generic/Time.hpp"
00067 #include "generic/ConfigFile.hpp"
00068 #include "generic/Exceptions.hpp"
00069 #include "youbot/YouBotGripper.hpp"
00070 #include "youbot/YouBotGripperBar.hpp"
00071 #include "youbot/YouBotGripperParameter.hpp"
00072 
00073 using namespace boost::posix_time;
00074 
00075 namespace youbot {
00076 
00077 ///////////////////////////////////////////////////////////////////////////////
00078 /// Creates a trace of one parameter of the gripper
00079 ///////////////////////////////////////////////////////////////////////////////
00080 class GripperDataTrace {
00081   public:
00082     GripperDataTrace(YouBotGripperBar& youBotGripperBar, const std::string Name, const bool overwriteFiles = false);
00083 
00084     virtual ~GripperDataTrace();
00085 
00086     void startTrace(const std::string parameterName, const std::string unit);
00087 
00088     void stopTrace();
00089 
00090     void plotTrace();
00091 
00092     void updateTrace(const double parameterValue);
00093 
00094     unsigned long getTimeDurationMilliSec();
00095 
00096 
00097   private:
00098     GripperDataTrace(const GripperDataTrace & source);
00099 
00100     GripperDataTrace & operator=(const GripperDataTrace & source);
00101 
00102     YouBotGripperBar& gripperBar;
00103 
00104     JointSensedAngle sensedAngle;
00105 
00106     JointSensedEncoderTicks sensedEncoderTicks;
00107 
00108     JointSensedVelocity sensedVelocity;
00109 
00110     JointSensedRoundsPerMinute sensedRoundsPerMinute;
00111 
00112     JointSensedCurrent sensedCurrent;
00113 
00114     JointSensedTorque sensedTorque;
00115 
00116     std::fstream file;
00117 
00118     JointAngleSetpoint angleSetpoint;
00119 
00120     JointVelocitySetpoint velocitySetpoint;
00121 
00122     JointRoundsPerMinuteSetpoint roundsPerMinuteSetpoint;
00123 
00124     JointCurrentSetpoint currentSetpoint;
00125 
00126     JointTorqueSetpoint torqueSetpoint;
00127 
00128     JointPWMSetpoint PWMSetpoint;
00129 
00130     JointEncoderSetpoint encoderSetpoint;
00131 
00132     std::fstream parametersBeginTraceFile;
00133 
00134     std::fstream parametersEndTraceFile;
00135 
00136     ptime traceStartTime;
00137 
00138     time_duration timeDuration;
00139 
00140     unsigned long timeDurationMicroSec;
00141 
00142     JointSensedPWM actualPWM;
00143 
00144     std::vector<YouBotGripperParameter*> parameterVector;
00145 
00146     std::string name;
00147 
00148     std::string path;
00149 
00150 };
00151 
00152 } // namespace youbot
00153 #endif
Generated by  doxygen 1.6.3