00001 /* 00002 * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 00018 #ifndef _ElmoRecorder_H 00019 #define _ElmoRecorder_H 00020 00021 #include <string> 00022 #include <cob_canopen_motor/SDOSegmented.h> 00023 00024 class CanDriveHarmonica; 00025 00033 class ElmoRecorder { 00034 public: 00038 ElmoRecorder(CanDriveHarmonica * pParentHarmonicaDrive); 00039 00040 ~ElmoRecorder(); 00041 00045 int processData(segData& SDOData); 00046 00056 int configureElmoRecorder(int iRecordingGap, int driveID, int startImmediately = 1); 00057 00062 bool isInitialized(bool initNow); 00063 00068 int readoutRecorderTry(int iObjSubIndex); 00069 00074 int readoutRecorderTryStatus(int iStatusReg, segData& SDOData); 00075 00079 int setLogFilename(std::string sLogFileprefix); 00080 00081 private: 00085 int m_iCurrentObject; 00086 00087 float m_fRecordingStepSec; 00088 00089 std::string m_sLogFilename; 00090 00094 int m_iReadoutRecorderTry; 00095 00096 CanDriveHarmonica* m_pHarmonicaDrive; 00097 00101 int m_iDriveID; 00102 00106 bool m_bIsInitialized; 00107 00111 int readoutRecorder(int iObjSubIndex); 00112 00118 int logToFile(std::string filename, std::vector<float> vtValues[]); 00119 00123 float convertBinaryToFloat(unsigned int binaryRepresentation); 00124 00128 float convertBinaryToHalfFloat(unsigned int iBinaryRepresentation); 00129 }; 00130 00131 #endif