$search
#include <ElmoRecorder.h>
Public Member Functions | |
int | configureElmoRecorder (int iRecordingGap, int driveID, int startImmediately=1) |
ElmoRecorder (CanDriveHarmonica *pParentHarmonicaDrive) | |
bool | isInitialized (bool initNow) |
int | processData (segData &SDOData) |
int | readoutRecorderTry (int iObjSubIndex) |
int | readoutRecorderTryStatus (int iStatusReg, segData &SDOData) |
int | setLogFilename (std::string sLogFileprefix) |
~ElmoRecorder () | |
Private Member Functions | |
float | convertBinaryToFloat (unsigned int binaryRepresentation) |
float | convertBinaryToHalfFloat (unsigned int iBinaryRepresentation) |
int | logToFile (std::string filename, std::vector< float > vtValues[]) |
int | readoutRecorder (int iObjSubIndex) |
Private Attributes | |
bool | m_bIsInitialized |
float | m_fRecordingStepSec |
int | m_iCurrentObject |
int | m_iDriveID |
int | m_iReadoutRecorderTry |
CanDriveHarmonica * | m_pHarmonicaDrive |
std::string | m_sLogFilename |
The in Elmo drives integrated Recorder allows the user to record drive information at a high frequency.
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). 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. This class brings all the functions to use the Elmo Recorder in a comfortable way.
Definition at line 72 of file ElmoRecorder.h.
ElmoRecorder::ElmoRecorder | ( | CanDriveHarmonica * | pParentHarmonicaDrive | ) |
pParentHarmonicaDrive | This pointer is used to give ElmoRecorder the ability to take use of CANopen functions of CanDriveHarmonica |
Definition at line 61 of file ElmoRecorder.cpp.
ElmoRecorder::~ElmoRecorder | ( | ) |
Definition at line 68 of file ElmoRecorder.cpp.
int ElmoRecorder::configureElmoRecorder | ( | int | iRecordingGap, | |
int | driveID, | |||
int | startImmediately = 1 | |||
) |
Configures the Elmo Recorder to log internal data at a high frequency (This can be used for identification of the drive chain) You can read the data out after recording process has finished, using readoutRecorderTry().
iRecordingGap | iRecordingGap = N indicates that a new sample should be taken once per N time quanta (= 4 * 90 usec) | |
driveID | Enter the drive ID of the current motor, to later identify the logfiles | |
startImmediately | 1: start the recording process immediately, 0: start recording at next BG (begin motion) command |
Definition at line 76 of file ElmoRecorder.cpp.
float ElmoRecorder::convertBinaryToFloat | ( | unsigned int | binaryRepresentation | ) | [private] |
Convert the 32bit binary representation of a float to an actual 32bit float value
Definition at line 253 of file ElmoRecorder.cpp.
float ElmoRecorder::convertBinaryToHalfFloat | ( | unsigned int | iBinaryRepresentation | ) | [private] |
Convert the 16bit binary representation of a float to an actual 16bit (half)float value
Definition at line 280 of file ElmoRecorder.cpp.
bool ElmoRecorder::isInitialized | ( | bool | initNow | ) |
initNow | Enter true to set the initialization state to true, enter false to only request the state. |
Definition at line 71 of file ElmoRecorder.cpp.
int ElmoRecorder::logToFile | ( | std::string | filename, | |
std::vector< float > | vtValues[] | |||
) | [private] |
After processing the collected Recorder data log it to a file.
vtValues[] | A 2 x N vector with a time stamp in the first column and the according data point value in teh second | |
filename | Path and file-prefix to an existing directory! It is extended with _MotorNumber_RecordedSource.log |
Definition at line 308 of file ElmoRecorder.cpp.
int ElmoRecorder::processData | ( | segData & | SDOData | ) |
Processes the collected Elmo Recorder data and saves them into a logfile.
Definition at line 155 of file ElmoRecorder.cpp.
int ElmoRecorder::readoutRecorder | ( | int | iObjSubIndex | ) | [private] |
iObjSubIndex | Requests the SDO Upload of the recorder object 0x2030 of the selected iObjSubIndex-source |
Definition at line 145 of file ElmoRecorder.cpp.
int ElmoRecorder::readoutRecorderTry | ( | int | iObjSubIndex | ) |
Start point of the actual read-out process. The following flow looks as follows: Request SR -> readoutRecorderTryStatus() If recorder ready -> readoutRecorder() start SDO read-out -> when finished -> processData() process data -> logToFile() save to file. This function takes use of the SR (status register) that tells the recorder state. In this function, the SR is requested.
Definition at line 107 of file ElmoRecorder.cpp.
int ElmoRecorder::readoutRecorderTryStatus | ( | int | iStatusReg, | |
segData & | SDOData | |||
) |
This function is called, when a new SR message is received. If the Recorder is finished and ready to upload data, readoutRecorder() is called to actually start the read-out process.
iStatusReg | Status register received from the binary interpreter response. |
Definition at line 119 of file ElmoRecorder.cpp.
int ElmoRecorder::setLogFilename | ( | std::string | sLogFileprefix | ) |
sLogFileprefix | Path (to an existing directory!) and file-prefix for the created logfile. It is extended with _MotorNumber_RecordedSource.log |
Definition at line 246 of file ElmoRecorder.cpp.
bool ElmoRecorder::m_bIsInitialized [private] |
Elmo Recorder is intialized from the time of the first configuration on.
Definition at line 145 of file ElmoRecorder.h.
float ElmoRecorder::m_fRecordingStepSec [private] |
Definition at line 126 of file ElmoRecorder.h.
int ElmoRecorder::m_iCurrentObject [private] |
Stores the targeted object from the time of requesting the read-out to the actual begin after "Recorder has finished" confirmation by SR
Definition at line 124 of file ElmoRecorder.h.
int ElmoRecorder::m_iDriveID [private] |
Hold the drive ID to later identify the logfiles (in the same directory)
Definition at line 140 of file ElmoRecorder.h.
int ElmoRecorder::m_iReadoutRecorderTry [private] |
A flag that tells, whether we are waiting for read-out until the confirmation by SR, that the recorder is ready for read-out
Definition at line 133 of file ElmoRecorder.h.
CanDriveHarmonica* ElmoRecorder::m_pHarmonicaDrive [private] |
Definition at line 135 of file ElmoRecorder.h.
std::string ElmoRecorder::m_sLogFilename [private] |
Definition at line 128 of file ElmoRecorder.h.