Run a RapidCodeRT C++ app on INtime
Create C++ RapidCodeRT Hello World project that runs on the INtime kernel.
The tutorial assumes you have INtime SDK and Visual Studio properly installed on a Windows PC
    1.
    Create your application using the INtime Applicaion Wizard
2. Add the C:\RSI\X.X.X|include folder to your Additional Include Directories.
3. Add the RapidCodeRT.lib to your additional dependencies.
4. Add the lib\rt subfolder to your Additional Library Directories
5. Add your RMP license (rsi.lic) to project sources and set to "Copy file" so it's copied to your output folder.
6. Add C:\RSI\X.X.X\RapidCodeRT.rsl to project sources and set to "Copy file" so it's copied to your output folder.
7. Configure the Pool Maximum in the INtime Properties in project.
    Pool Maximum (bytes)
    Initial thread stack size (bytes)
See the Tenaysis Documentation for more inormation about RTOS memory management.
9. Run a simple program.
This example program requires that you have the RMP running and have set the axis count greater than 1. This can be done via RapidSetup.exe or rsiconfig.exe
Example Code:
1
#include <stdio.h>
2
#include "rsi.h" // Import our RapidCode Library.
3
using namespace RSI::RapidCode;
4
5
static void CheckErrors(RapidCodeObject* rsiObject)
6
{
7
bool hasErrors = false;
8
RsiError* err;
9
while (rsiObject->ErrorLogCountGet() > 0)
10
{
11
err = rsiObject->ErrorLogGet();
12
printf("%s\n", err->text);
13
hasErrors = true;
14
}
15
if (hasErrors)
16
{
17
printf("Exiting due to RapidCodeRT creation errors.\n");
18
exit(1);
19
}
20
}
21
22
23
int main(int argc, char* argv[])
24
{
25
MotionController* controller = MotionController::CreateFromSoftware();
26
CheckErrors(controller);
27
printf("Hello, RapidCodeRT!\n");
28
printf("Serial Number: %d \n", controller->SerialNumberGet());
29
30
Axis* axis = controller->AxisGet(0); // Initialize Axis class
31
CheckErrors(axis);
32
33
try {
34
35
axis->ClearFaults();
36
axis->AmpEnableSet(true);
37
axis->MoveRelative(1);
38
while (!axis->MotionDoneGet()) {
39
printf("%8.3lf\n", axis->CommandPositionGet());
40
controller->OS->Sleep(100);
41
}
42
}
43
catch (const std::exception& e)
44
{
45
printf("\n%s\n", e.what());
46
}
47
48
printf("Exiting successfully.\n");
49
50
controller->Delete();
51
52
controller = nullptr;
53
54
return 0;
55
}
56
Copied!
Last modified 7mo ago
Export as PDF
Copy link