24#include "SampleAppsHelper.h"
26#include "SampleApps.h"
31int SyncOutputWithMotion::Run()
38 const int AXIS_COUNT = 1;
39 const int AXIS_NUMBER = 0;
41 const double USER_UNITS = 1048576;
44 const double TIME_SLICE = 0.01;
47 const int TOTAL_POINTS = (int)(REVS / TIME_SLICE / RPS);
48 const int EMPTY_CT = -1;
91 std::vector<double> positions, times;
92 for (
int i = 0; i < TOTAL_POINTS; i += AXIS_COUNT)
94 positions.push_back(i * TIME_SLICE * RPS);
95 times.push_back(TIME_SLICE);
112 int outPutEnableID = TOTAL_POINTS / 2;
130 printf(
"Motion started. Waiting to complete.\n");
132 printf(
"Motion Complete. The outputs should have been set\n");
139 printf(
"\n%s\n", err.text);
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....
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
void MotionCountSet(int32_t motionCount)
Set the number of processed Motion Supervisors in the controller.
static MotionController * CreateFromSoftware()
Initialize and start the RMP EtherCAT controller.
void Delete(void)
Delete the MotionController and all its objects.
MultiAxis * MultiAxisGet(int32_t motionSupervisorNumber)
MultiAxisGet returns a pointer to a MultiAxis object and initializes its internals.
int32_t AxisCountGet()
Get the number of axes processing.
int32_t MotionCountGet()
Get the number of Motion Supervisors available in the firmware.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Axis * AxisGet(int32_t index)
Get the Axis class used in this MultiAxis class.
void AxisAdd(Axis *axis)
Add an Axis to a MultiAxis group.
Represents multiple axes of motion control, allows you to map two or more Axis objects together for e...
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)
RSIState StateGet()
Get the Axis or MultiAxis state.
void StreamingOutputsClear()
Clear the contents of the Streaming Output List.
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.
void EStopAbort()
E-Stop, then abort an axis.
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
@ RSIMotionTypePT
simple Position and Time algorithm
@ RSIActionNONE
None - do not perform any action.
@ RSIStateIDLE
Idle, ready for anything.
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.