APIs, concepts, guides, and more

◆ RecorderRecordDataValueGet() [1/2]

int32_t RecorderRecordDataValueGet ( int32_t index)
Description:
RecorderRecordDataValueGet gets one value from a retrieved record.
Parameters
indexindex of the recorded value, within the record
Returns
the value from the index of the record

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
MotionController controller = MotionController.Get();
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
}
Constants used in the C# sample apps.
Definition _constants.cs:3
const int AXIS_0_INDEX
Default: 0.
Definition _constants.cs:11
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:5863
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:11550
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
RecorderRecordDataRetrieve