APIs, concepts, guides, and more

◆ RecorderRecordDataValueGet() [2/2]

int32_t RecorderRecordDataValueGet ( int32_t recorderNumber,
int32_t recordIndex,
int32_t dataIndex )
Description:
RecorderRecordDataValueGet gets one data value from a retrieved record.
Parameters
recorderNumberIndex of the recorder. 0 to 63 Valid
recordIndexIndex of the collected Record. 0 to 1023 Valid
dataIndexIndex of the recorded data within that record. 0 to Number of Items collected - 1 Valid.
Returns
the int32_t value from the indexed data.

Part of the Recorder method group.

Sample Code:
Monitoring: Recorder
/* This sample demonstrates how to use the Recorder to track multiple controller parameters.
Shows how to configure the recorder, record axis position and digital input values,
and retrieve recorded data to find when specific events occurred.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Recorder");
// set sample config params
const int VALUES_PER_RECORD = 2; // how many values to store in each record
const int RECORD_PERIOD_SAMPLES = 1; // how often to record data (samples between consecutive records)
const int RECORD_TIME = 250; // how long to record (milliseconds)
const int INPUT_INDEX = 0;
// get rmp objects
try
{
Helpers.CheckErrors(controller);
// set recorder count before any RapidCodeObject get/create other than the controller
controller.RecorderCountSet(1);
// get axis
Axis axis = controller.AxisGet(Constants.AXIS_0_INDEX);
// configure phantom axis
// create simulated digital input using user buffer memory
ulong userBufferAddress = controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSER_BUFFER, 0);
IOPoint digitalInput = IOPoint.CreateDigitalInput(controller, userBufferAddress, INPUT_INDEX);
// stop recorder if already running
if (controller.RecorderEnabledGet() == true)
{
controller.RecorderStop(); // stop recording
controller.RecorderReset(); // reset controller
}
// configure recorder
controller.RecorderPeriodSet(RECORD_PERIOD_SAMPLES); // record every n samples
controller.RecorderCircularBufferSet(false); // do not use circular buffer
controller.RecorderDataCountSet(VALUES_PER_RECORD); // number of values per record
controller.RecorderDataAddressSet(0, axis.AddressGet(RSIAxisAddressType.RSIAxisAddressTypeACTUAL_POSITION)); // record axis position
controller.RecorderDataAddressSet(1, digitalInput.AddressGet()); // record digital input state
// start recording
controller.RecorderStart();
controller.OS.Sleep(RECORD_TIME); // record for specified time
// retrieve recorded data
int recordsAvailable = controller.RecorderRecordCountGet();
Console.WriteLine($"There are {recordsAvailable} records available");
// process records to find when input triggered
for (int i = 0; i < recordsAvailable; i++)
{
controller.RecorderRecordDataRetrieve(); // retrieve one record
double positionRecord = controller.RecorderRecordDataDoubleGet(0); // get axis position value
int digitalInputValue = controller.RecorderRecordDataValueGet(1); // get digital input value
// check if digital input bit is high
if ((digitalInputValue & digitalInput.MaskGet()) == digitalInput.MaskGet())
{
Console.WriteLine($"Encoder position was: {positionRecord} when input triggered");
break;
}
}
// stop and reset recorder
controller.RecorderStop();
controller.RecorderReset();
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
Definition _helpers.cs:15
static void PhantomAxisReset(Axis phantomAxis)
Configures a phantom axis on the controller.
Definition _helpers.cs:144
Helpers class provides static methods for common tasks in RMP applications.
Definition _helpers.cs:5
uint64_t AddressGet(RSIAxisAddressType addressType)
Get the an address for some location on the Axis.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5862
uint64_t AddressGet()
Get the Host Address for the I/O point.
static IOPoint * CreateDigitalInput(Axis *axis, RSIMotorDedicatedIn motorDedicatedInNumber)
Create a Digital Input from an Axis' Dedicated Input bits.
int32_t MaskGet()
Get the bit mask for the I/O point.
Represents one specific point: Digital Output, Digital Input, Analog Output, or Analog Input....
Definition rsi.h:11549
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
int32_t RecorderRecordCountGet()
Get the number of records that are stored and ready for reading on Recorder 0.
void RecorderStart()
Start recording data.
void RecorderCircularBufferSet(bool enable)
Configure recorder as circular buffer (or not) on Recorder 0.
void RecorderRecordDataRetrieve()
Retrieve one record of recorded data on Recorder 0.
void RecorderDataCountSet(int32_t count)
Set the number of data values to be recorded on Recorder 0.
static MotionController * Get()
Get an already running RMP EtherCAT controller.
uint64_t AddressGet(RSIControllerAddressType type)
Get the an address for some location on the MotionController.
int32_t RecorderRecordDataValueGet(int32_t index)
Get one value from a retrieved record on Recorder 0.
void RecorderStop()
Stop recording data on Recorder 0.
void Delete(void)
Delete the MotionController and all its objects.
void RecorderReset()
Reset the recorder on Recorder 0.
void RecorderDataAddressSet(int32_t index, uint64_t address)
Setup the addresses to be recorded on Recorder 0.
void RecorderPeriodSet(uint32_t samples)
Set the number of samples between records on Recorder 0.
void RecorderCountSet(int32_t recorderCount)
Set the number of processed Recorders in the controller.
bool RecorderEnabledGet()
Determine if the recorder is recording on Recorder 0.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:800
RapidCodeOS * OS
Provides access to operating system (Windows) features.
Definition rsi.h:3840
double RecorderRecordDataDoubleGet(int32_t index)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void Sleep(int32_t milliseconds)
Put the current thread to sleep.
RSIControllerAddressType
Used to get firmware address used in User Limits, Recorders, etc.
Definition rsienums.h:405
RSIAxisAddressType
Used to get firmware address used in User Limits, Recorders, etc.
Definition rsienums.h:434
See also
RecorderRecordDataRetrieveBulk