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
{
Axis* axis = controller->AxisGet(AXIS_NUMBER);
printf("Motion started. Waiting to complete.\n");
printf("Motion Complete. The outputs should have been set\n");
}
{
printf("%s\n", err.text);
return -1;
}
controller->Delete();
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.
static IOPoint * CreateDigitalOutput(Axis *axis, RSIMotorDedicatedOut motorDedicatedOutNumber)
Create a Digital Output from an Axis' Dedicated Output bits.
Represents one specific point: Digital Output, Digital Input, Analog Output, or Analog Input....
static MotionController * CreateFromSoftware()
Initialize and start the RMP EtherCAT controller.
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 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).
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
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 ...
@ RSIMotionTypePT
Position-Time algorithm with continuous position but discontinuous velocity. Best for short time inte...
@ RSIActionNONE
None - do not perform any action.
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.