#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 33 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 25 of file ElmoRecorder.cpp.
ElmoRecorder::~ElmoRecorder | ( | ) |
Definition at line 32 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 40 of file ElmoRecorder.cpp.
|
private |
Convert the 32bit binary representation of a float to an actual 32bit float value
Definition at line 215 of file ElmoRecorder.cpp.
|
private |
Convert the 16bit binary representation of a float to an actual 16bit (half)float value
Definition at line 242 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 35 of file ElmoRecorder.cpp.
|
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 270 of file ElmoRecorder.cpp.
int ElmoRecorder::processData | ( | segData & | SDOData | ) |
Processes the collected Elmo Recorder data and saves them into a logfile.
Definition at line 119 of file ElmoRecorder.cpp.
|
private |
iObjSubIndex | Requests the SDO Upload of the recorder object 0x2030 of the selected iObjSubIndex-source |
Definition at line 109 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 71 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 83 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 208 of file ElmoRecorder.cpp.
|
private |
Elmo Recorder is intialized from the time of the first configuration on.
Definition at line 106 of file ElmoRecorder.h.
|
private |
Definition at line 87 of file ElmoRecorder.h.
|
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 85 of file ElmoRecorder.h.
|
private |
Hold the drive ID to later identify the logfiles (in the same directory)
Definition at line 101 of file ElmoRecorder.h.
|
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 94 of file ElmoRecorder.h.
|
private |
Definition at line 96 of file ElmoRecorder.h.
|
private |
Definition at line 89 of file ElmoRecorder.h.