using System.Threading;
Console.WriteLine("📜 IO: Sync Outputs");
int exitCode = 0;
try
{
Helpers.VerifyHardwareUsage(controller);
Helpers.VerifyAxisCount(controller);
const int TOTAL_POINTS = 4;
const int EMPTY_CT = 2;
const int OUTPUT_INDEX = 0;
const int NODE_INDEX = 0;
double[] positions = [1.0, 2.0, 3.0, 4.0];
double[] times = [0.5, 0.8, 1, 0.5];
int outputEnableID = 2;
int outputDisableID = 3;
Console.WriteLine($"Starting streaming motion with {TOTAL_POINTS} points");
Console.WriteLine($"Output will go HIGH at element ID {outputEnableID}");
Console.WriteLine($"Output will go LOW at element ID {outputDisableID}");
axis.
MovePT(
RSIMotionType.RSIMotionTypePT, positions, times, TOTAL_POINTS, EMPTY_CT,
false,
true);
{
bool outputState = output0.
Get();
Console.WriteLine($"Motion Element: {currentElement}, Output State: {outputState}");
Thread.Sleep(50);
}
}
catch (Exception e)
{
Console.WriteLine($"❌ Error: {e.Message}");
}
finally
{
controller.Delete();
}
return exitCode;
Constants used in the C# sample apps.
const bool USE_HARDWARE
Default: false.
const int EXIT_FAILURE
Exit code for failed execution.
const int AXIS_0_INDEX
Default: 0.
const int AMP_ENABLE_MS
Default: 750.
const int EXIT_SUCCESS
Exit code for successful execution.
void PositionSet(double position)
Set the Command and Actual positions.
uint16_t MotionElementIdExecutingGet()
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.
bool Get()
Get the state of Digital Input or Output.
Represents one specific point: Digital Output, Digital Input, Analog Output, or Analog Input....
static MotionController * Get()
Get an already running RMP EtherCAT controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void StreamingOutputAdd(int32_t onMask, int32_t offMask, uint64_t address)
int32_t MotionDoneWait(int32_t waitTimeoutMilliseconds=WaitForever)
Waits for a move to complete.
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.
bool MotionDoneGet()
Check to see if motion is done and settled.
RSIMotionType
PT and PVT streaming motion types.
Helpers namespace provides utility functions for common tasks in RMP applications.