Single Axis Sync Outputs sample application.
This sample application will show you a basic demonstartion on how to set up Sync Outputs, so that you can easily change any IO�s state based on a specified point index (or ElmentID) on your steaming motion.
#include "rsi.h"
#include "SampleAppsHelper.h"
#include "SampleApps.h"
int SingleAxisSyncOutputs::Run()
{
const int AXIS_COUNT = 1;
const int AXIS_NUMBER = 0;
const double USER_UNITS = 1048576;
const int NODE_INDEX = 0;
const int OUTPUT_INDEX = 0;
const int OUTPUT_ENABLE_ID = 2;
const int OUTPUT_DISABLE_ID = 3;
const int TOTAL_POINTS = 4;
const int EMPTY_CT = -1;
const double POSITIONS[] = { 0.25, 0.50, 0.75, 1.0 };
const double TIMES[] = { 0.5, 1.0, 1.5, 2.0 };
USE_HARDWARE = false;
char rmpPath[] = "C:\\RSI\\X.X.X\\";
if (USE_HARDWARE)
{
}
else
{
}
try
{
IOPoint* output0 = IOPoint::CreateDigitalOutput(controller->
IOGet(NODE_INDEX), OUTPUT_INDEX);
axis->
MovePT(RSIMotionType::RSIMotionTypePT, POSITIONS, TIMES, TOTAL_POINTS, EMPTY_CT,
false,
true);
printf("Motion started. Waiting to complete.\n");
printf("Motion Complete. The outputs should have been set\n");
}
{
printf("%s\n", err.text);
return -1;
}
return 0;
}
void UserUnitsSet(double countsPerUserUnit)
Sets the number of counts per User Unit.
void ErrorLimitActionSet(RSIAction action)
Set the action that will occur when the Error Limit Event triggers.
void PositionSet(double position)
Set the Command and Actual positions.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
void Set(bool state)
Set the state of a Digital Output.
Represents one specific point: Digital Output, Digital Input, Analog Output, or Analog Input....
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
void Delete(void)
Delete the MotionController and all its objects.
IO * IOGet(int32_t nodeNumber)
IOGet returns a pointer to an IO object using its node number and initializes its internals.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
void AmpEnableSet(bool enable)
Enable all amplifiers.
void Abort()
Abort an axis.
int32_t MotionDoneWait()
Waits for a move to complete.
void StreamingOutputAdd(int32_t onMask, int32_t offMask, uint64_t address)
void StreamingOutputsEnableSet(bool enable)
Sets whether Streaming Output is enabled (true) or disabled (false).
void MovePT(RSIMotionType type, const double *const position, const double *const time, int32_t pointCount, int32_t emptyCount, bool retain, bool final)
A move commanded by a list of position and time points.
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
static void SetupControllerForHardware(MotionController *controller)
Sets up the controller for hardware use by resetting it and starting the network.
static void CheckErrors(RapidCodeObject *rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
static void SetupControllerForPhantoms(MotionController *controller, int axisCount, std::vector< int > axisNums)
Sets up the controller for phantom axes, including configuring specified axes as phantom.