APIs, concepts, guides, and more
Template.cpp
1#include "rsi.h" // Import our RapidCode Library.
2#include "SampleAppsHelper.h" // Import our SampleApp helper functions.
3
4using namespace RSI::RapidCode; // Import the RapidCode namespace
5
7void TemplateMain(int argc, char *argv[])
8{
9 const int AXIS_X = (0);
10 const int AXIS_Y = (1);
11 const int IO_NODE = (7);
12
13 Axis *axisX;
14 Axis *axisY;
15 MultiAxis *multiAxisXY;
16 IO *io;
17
18 // Create and initialize RsiController class
21 try
22 {
23 // enable one MotionSupervisor for the MultiAxis
24 controller->MotionCountSet(controller->AxisCountGet() + 1);
25
26 // Get Axis X and Y respectively.
27 axisX = controller->AxisGet(AXIS_X);
29
30 axisY = controller->AxisGet(AXIS_Y);
32
33 // Initialize a MultiAxis, using the last MotionSupervisor.
34 multiAxisXY = controller->MultiAxisGet(controller->MotionCountGet() - 1);
36 multiAxisXY->AxisAdd(axisX);
37 multiAxisXY->AxisAdd(axisY);
38
39 // Initialize an IO.
40 io = controller->IOGet(IO_NODE);
41
42 // Insert your application code here.
43 }
44 catch (RsiError const& err)
45 {
46 printf("\n%s\n", err.text);
47 }
48 controller->Delete(); // Delete the controller as the program exits to ensure memory is deallocated in the correct order.
49 system("pause"); // Allow time to read Console.
50}
51
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 ...