4using RSI.RapidCode.dotNET;
28 bool hasErrors =
false;
29 System.Text.StringBuilder errorStringBuilder =
new System.Text.StringBuilder();
36 errorStringBuilder.AppendLine(
"WARNING: " + error.Message);
41 errorStringBuilder.AppendLine(
"ERROR: " + error.Message);
47 throw new Exception(errorStringBuilder.ToString());
66 Console.WriteLine(
"Starting Network..");
74 for (
int i = 0; i < messagesToRead; i++)
78 throw new SystemException(
"Expected OPERATIONAL state but the network did not get there.");
82 Console.WriteLine(
"Network Started");
106 Console.WriteLine(
"Shutting down the network..");
113 for (
int i = 0; i < messagesToRead; i++)
117 throw new SystemException(
"Expected SHUTDOWN state but the network did not get there.");
121 Console.WriteLine(
"Network Shutdown");
175 foreach (
int axisNum
in axisNums)
197 creationParameters.RmpPath = rmpPath;
217 throw new SystemException(
"Error: " + axisNumber.ToString() +
" is invalid. Axis numbers cannot be negative.");
222 throw new SystemException(
"Error: " + axisNumber.ToString() +
" is invalid. Axis numbers cannot be greater than the number of axes on the controller.");
239 const double positionToleranceMax = Double.MaxValue / 10.0;
static void SetupControllerForHardware(MotionController controller)
Sets up the controller for hardware use by resetting it and starting the network.
static void ConfigurePhantomAxis(MotionController controller, int axisNumber)
Configures a specified axis as a phantom axis with custom settings.
static MotionController CreateController()
Creates the MotionController object, using creation parameters.
static void StartTheNetwork(MotionController controller)
Starts the network communication for the given MotionController.
static void SetupControllerForPhantoms(MotionController controller, int axisCount, int[] axisNums)
Sets up the controller for phantom axes, including configuring specified axes as phantom.
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
static void ShutdownTheNetwork(MotionController controller)
Shuts down the network communication for the given MotionController.
static void ClearControllerCounts(MotionController controller)
Clears count settings for axes, motion, and user limits on the controller.
HelperFunctionsCS class provides static methods for common tasks in RMP applications.
void HardwareNegLimitActionSet(RSIAction action)
Set the action that will occur when the Hardware Negative Limit Event triggers.
void HardwarePosLimitActionSet(RSIAction action)
Set the action that will occur when the Hardware Positive Limit Event triggers.
void PositionToleranceCoarseSet(double tolerance)
Set the Coarse Position Tolerance for Axis settling.
void SoftwareNegLimitActionSet(RSIAction action)
Set the action that will occur when the Software Negative Limit Event triggers.
void HomeActionSet(RSIAction action)
Set the action that will occur when the Home Event triggers.
void PositionToleranceFineSet(double tolerance)
Set the Fine Position Tolerance for Axis settling.
void ErrorLimitActionSet(RSIAction action)
Set the action that will occur when the Error Limit Event triggers.
void MotorTypeSet(RSIMotorType type)
Set the motor type.
void PositionSet(double position)
Set the Command and Actual positions.
void SoftwarePosLimitActionSet(RSIAction action)
Set the action that will occur when the Software Positive Limit Event triggers.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
RSINetworkState NetworkStateGet()
void Reset()
Reset the controller which stops and restarts the RMP firmware.
void MotionCountSet(int32_t motionCount)
Set the number of processed Motion Supervisors in the controller.
static MotionController * Create(CreationParameters *creationParameters)
Initialize and start the RMP EtherCAT controller.
const char *const NetworkLogMessageGet(int32_t messageIndex)
int32_t AxisCountGet()
Get the number of axes processing.
int32_t NetworkLogMessageCountGet()
void UserLimitCountSet(int32_t userLimitCount)
Set the number of processed UserLimits in the MotionController.
void AxisCountSet(int32_t axisCount)
Set the number of allocated and processed axes in the controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void NetworkShutdown()
Shutdown the network. For EtherCAT, this will kill the RMPNetwork process.
void NetworkStart()
Start the network with RSINetworkStartupMethodNORMAL.
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 ...
bool isWarning
Whether the error is or is not a warning.
RSINetworkState
State of network.
RSIAction
Action to perform on an Axis.
CreationParameters for MotionController::Create.