APIs, concepts, guides, and more

◆ RecorderConfigureToTriggerOnMotion()

void RecorderConfigureToTriggerOnMotion ( Axis * axis,
bool triggerOnMotion )
RecorderConfigureToTriggerOnMotion sets the recorder to trigger on motion. The recording will will start when the motion starts, and the recording will automatically stop when the Motion Done condition is true.
(axisor multiAxis) Axis or MultiAxis object to be affected.
triggerOnMotionA boolean value to set trigger state. TRUE = trigger on Motion.

Part of the Recorder method group.

Sample Code:
using RSI.RapidCode.dotNET; // Import our RapidCode Library.
using NUnit.Framework;
using System;
#if DOXYGEN // RSI internal documentation use only
class Recorder_Sample : StaticMemoryTestBase
public void Recorder()
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. (in milliseconds)
const int INPUT_INDEX = 0;
// Get the host controller addresses for the values we want to record
// Number of processed Recorders in the controller.
Axis axis = CreateAndReadyAxis(Constants.AXIS_NUMBER); // Helper function to setup an axis
UInt64 userBufferAddress = controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSER_BUFFER, 0); // Grabing an memory address to store a simulated IO point.
// Instead of using physical IO we will use simulated IO using a memory address as simulated IO. See the IO sample apps to see how to use a physical IO instead.
IOPoint input = IOPoint.CreateDigitalInput(controller, userBufferAddress, INPUT_INDEX); // Create a simulated IOpoint using userBuffer memory.
if (controller.RecorderEnabledGet() == true) // Check if the recorder is running already. If it is, stop it.
controller.RecorderStop(); // Stop recording.
controller.RecorderReset(); // Reset controller.
controller.RecorderPeriodSet(RECORD_PERIOD_SAMPLES); // Configure recorder to record every 'n' samples (Every 'n' ms)
controller.RecorderCircularBufferSet(false); // Do not use a circular buffer
controller.RecorderDataCountSet(VALUES_PER_RECORD); // Configure the number of values for each record. (how many things to record)
controller.RecorderDataAddressSet(0, axis.AddressGet(RSIAxisAddressType.RSIAxisAddressTypeACTUAL_POSITION)); // Configure the recoder to record values from this address (1st recorded address)
controller.RecorderDataAddressSet(1, input.AddressGet()); // Configure the recoder to record values from this address (2nd recorded address)
controller.RecorderStart(); // Start recording.
controller.OS.Sleep(RECORD_TIME); // Put this thread to sleep for some milliseconds.
int recordsAvailable = controller.RecorderRecordCountGet(); // find out how many records were recorded. (Get the number of records that are stored and ready for reading)
Console.WriteLine("There are {0} Records available.", recordsAvailable); // Print the number of records recorded.
for (int i = 0; i < recordsAvailable; i++) // Check every record recorded.
controller.RecorderRecordDataRetrieve(); // Retrieve one record of recorded data.
double positionRecord = controller.RecorderRecordDataDoubleGet(0); // Get the value from the 1st specified address. /use double
var digitalInputsValue = controller.RecorderRecordDataValueGet(1); // Get the value from the 2nd specified address.
if ((digitalInputsValue & input.MaskGet()) == input.MaskGet()) // We are checking to see if the digital input 1 bit changes. If it does then we record the position when that input went high.
i = recordsAvailable; // break from loop.
Console.WriteLine("Your encoder position was: " + positionRecord + " when the input triggered.");
controller.RecorderStop(); // Stop recording.
controller.RecorderReset(); // Reset controller.
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:5513
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:10928
int32_t RecorderRecordCountGet()
Get the number of records that are stored and ready for reading.
void RecorderStart()
Start recording data.
void RecorderCircularBufferSet(bool enable)
Configure recorder as circular buffer (or not).
void RecorderRecordDataRetrieve()
Retrieve one record of recorded data.
void RecorderDataCountSet(int32_t count)
Set the number of data values to be recorded.
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.
void RecorderStop()
Stop recording data.
void RecorderReset()
Reset the recorder.
void RecorderDataAddressSet(int32_t index, uint64_t address)
Setup the addresses to be recorded.
void RecorderPeriodSet(uint32_t samples)
Set the number of samples between records.
void RecorderCountSet(int32_t recorderCount)
Set the number of processed Recorders in the controller.
bool RecorderEnabledGet()
Determine if the recorder is recording.
void AxisCountSet(int32_t axisCount)
Set the number of allocated and processed axes in the controller.
RapidCodeOS * OS
Provides access to operating system (Windows) features.
Definition rsi.h:3664
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.
Used to get firmware address used in User Limits, Recorders, etc.
Definition rsienums.h:404
Used to get firmware address used in User Limits, Recorders, etc.
Definition rsienums.h:433
See also