$search
00001 /**************************************************************** 00002 * 00003 * Copyright (c) 2010 00004 * 00005 * Fraunhofer Institute for Manufacturing Engineering 00006 * and Automation (IPA) 00007 * 00008 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 * 00010 * Project name: care-o-bot 00011 * ROS stack name: cob3_common 00012 * ROS package name: canopen_motor 00013 * Description: The in Elmo drives integrated Recorder allows the user to record drive information at a high frequency. 00014 * The Recorder firstly has to be configured properly. It can be started immidiately after configuring or later, triggered by a signal (e.g. a begin-motion-command). 00015 * When the recording is finished, you can read out the data via CANopen using a segmented SDO transfer. Appropriate functions for this CANopen specific process are provided by the CanDriveHarmonica class. 00016 * This class brings all the functions to use the Elmo Recorder in a comfortable way. 00017 * 00018 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00019 * 00020 * Author: Philipp Köhler 00021 * Supervised by: Christian Connette, email:christian.connette@ipa.fhg.de 00022 * 00023 * Date of creation: Mar 2010 00024 * ToDo: 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 Fraunhofer Institute for Manufacturing 00037 * Engineering and Automation (IPA) nor the names of its 00038 * contributors may be used to endorse or promote products derived from 00039 * this software without specific prior written permission. 00040 * 00041 * This program is free software: you can redistribute it and/or modify 00042 * it under the terms of the GNU Lesser General Public License LGPL as 00043 * published by the Free Software Foundation, either version 3 of the 00044 * License, or (at your option) any later version. 00045 * 00046 * This program is distributed in the hope that it will be useful, 00047 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00048 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00049 * GNU Lesser General Public License LGPL for more details. 00050 * 00051 * You should have received a copy of the GNU Lesser General Public 00052 * License LGPL along with this program. 00053 * If not, see <http://www.gnu.org/licenses/>. 00054 * 00055 ****************************************************************/ 00056 00057 #ifndef _ElmoRecorder_H 00058 #define _ElmoRecorder_H 00059 00060 #include <string> 00061 #include <cob_canopen_motor/SDOSegmented.h> 00062 00063 class CanDriveHarmonica; 00064 00072 class ElmoRecorder { 00073 public: 00077 ElmoRecorder(CanDriveHarmonica * pParentHarmonicaDrive); 00078 00079 ~ElmoRecorder(); 00080 00084 int processData(segData& SDOData); 00085 00095 int configureElmoRecorder(int iRecordingGap, int driveID, int startImmediately = 1); 00096 00101 bool isInitialized(bool initNow); 00102 00107 int readoutRecorderTry(int iObjSubIndex); 00108 00113 int readoutRecorderTryStatus(int iStatusReg, segData& SDOData); 00114 00118 int setLogFilename(std::string sLogFileprefix); 00119 00120 private: 00124 int m_iCurrentObject; 00125 00126 float m_fRecordingStepSec; 00127 00128 std::string m_sLogFilename; 00129 00133 int m_iReadoutRecorderTry; 00134 00135 CanDriveHarmonica* m_pHarmonicaDrive; 00136 00140 int m_iDriveID; 00141 00145 bool m_bIsInitialized; 00146 00150 int readoutRecorder(int iObjSubIndex); 00151 00157 int logToFile(std::string filename, std::vector<float> vtValues[]); 00158 00162 float convertBinaryToFloat(unsigned int binaryRepresentation); 00163 00167 float convertBinaryToHalfFloat(unsigned int iBinaryRepresentation); 00168 }; 00169 00170 #endif