APIs, concepts, guides, and more
Template.cpp
#include "rsi.h" // Import our RapidCode Library.
#include "SampleAppsHelper.h" // Import our SampleApp helper functions.
using namespace RSI::RapidCode; // Import the RapidCode namespace
void TemplateMain(int argc, char *argv[])
{
const int AXIS_X = (0);
const int AXIS_Y = (1);
const int IO_NODE = (7);
Axis *axisX;
Axis *axisY;
MultiAxis *multiAxisXY;
IO *io;
// Create and initialize RsiController class
try
{
// enable one MotionSupervisor for the MultiAxis
controller->MotionCountSet(controller->AxisCountGet() + 1);
// Get Axis X and Y respectively.
axisX = controller->AxisGet(AXIS_X);
axisY = controller->AxisGet(AXIS_Y);
// Initialize a MultiAxis, using the last MotionSupervisor.
multiAxisXY = controller->MultiAxisGet(controller->MotionCountGet() - 1);
multiAxisXY->AxisAdd(axisX);
multiAxisXY->AxisAdd(axisY);
// Initialize an IO.
io = controller->IOGet(IO_NODE);
// Insert your application code here.
}
catch (RsiError const& err)
{
printf("\n%s\n", err.text);
}
controller->Delete(); // Delete the controller as the program exits to ensure memory is deallocated in the correct order.
system("pause"); // Allow time to read Console.
}
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5863
The IO object provides an interface to the inputs and outputs of a network node.
Definition rsi.h:12042
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...
Definition rsi.h:800
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...
Definition rsi.h:10795
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
Definition rsi.h:111
static void CheckErrors(RapidCodeObject *rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...