#include <cassert>
#include "rsi.h"
#include <cmath>
{
{
printf(
"%s\n", err->
text);
}
if (hasError)
{
exit(1);
}
}
{
;
{
printf("%s\n", err);
}
if (hasError)
{
exit(1);
}
}
int syncOutputWithMotionMain(int argc, char *argv[])
{
const double TIME_SLICE = 0.01;
const int AXIS_COUNT = 1;
const int REVS = 4;
const int RPS = 1;
const int CPS = (int)std::powl(2, 20);
const int TOTAL_POINTS = (int)(REVS / TIME_SLICE / RPS);
const int EMPTY_CT = -1;
try {
PrintStreamingOutputErrors(controller);
PrintStreamingOutputNetworkErrors(controller);
PrintStreamingOutputErrors(multiAxis);
for (int i = 0; i < AXIS_COUNT; i++)
{
PrintStreamingOutputErrors(tempAxis);
}
std::vector<double> positions, times;
for (int i = 0; i < TOTAL_POINTS; i += AXIS_COUNT)
{
positions.push_back(i * TIME_SLICE * RPS);
times.push_back(TIME_SLICE);
}
assert(multiAxis->
StateGet() == RSIState::RSIStateIDLE);
IOPoint *output0 = IOPoint::CreateDigitalOutput(multiAxis->
AxisGet(0), RSIMotorGeneralIo::RSIMotorGeneralIo0);
int outPutEnableID = TOTAL_POINTS / 2;
multiAxis->
MovePT(RSIMotionType::RSIMotionTypePT, &positions[0], ×[0], TOTAL_POINTS, EMPTY_CT,
false,
true);
printf("Motion started. Waiting to complete.\n");
printf("Motion Complete. The outputs should have been set\n");
}
printf("\n%s\n", err.text);
argc = argc;
return 1;
}
return 0;
}
void UserUnitsSet(double countsPerUserUnit)
Sets the number of counts per User Unit.
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 MotionCountSet(int32_t motionCount)
Set the number of processed Motion Supervisors in the controller.
const char *const NetworkLogMessageGet(int32_t messageIndex)
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 NetworkLogMessageCountGet()
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void NetworkStart()
Start the network with RSINetworkStartupMethodNORMAL.
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.
const RsiError *const ErrorLogGet()
Get the next RsiError in the log.
int32_t ErrorLogCountGet()
Get the number of software errors in the error log.
The RapidCode base class. All non-error objects are derived from this class.
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...