APIs, concepts, guides, and more
Run a sample app in INtime in C++

Create C++ RapidCodeRT Hello World project that runs on the INtime kernel.

🔹 RMP INtime: Run a real-time program on INtime

Warning
The tutorial assumes you have INtime SDK and Visual Studio properly installed on a Windows PC
  1. Create your application using the INtime Application Wizard Image Image
  2. Add the C:\RSI\X.X.X|include\ folder to your Additional Include Directories. Image
  3. Add the RapidCodeRT.lib to your additional dependencies. Image
  4. Add the lib\rt subfolder to your Additional Library Directories Image
  5. Add your RMP license (rsi.lic) to project sources and set to "Copy file" so it's copied to your output folder. Image
  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. Image
  7. Configure the Pool Maximum in the INtime Properties in project.
    • Pool Maximum (bytes)
    • Initial thread stack size (bytes)
      Note
      See the Tenasys Documentationfor more information about RTOS memory management.
      Image
  8. Run a simple program.
Warning
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:

#include <stdio.h>
#include "rsi.h" // Import our RapidCode Library.
using namespace RSI::RapidCode;
static void CheckErrors(RapidCodeObject* rsiObject)
{
bool hasErrors = false;
RsiError* err;
while (rsiObject->ErrorLogCountGet() > 0)
{
err = rsiObject->ErrorLogGet();
printf("%s\n", err->text);
hasErrors = true;
}
if (hasErrors)
{
printf("Exiting due to RapidCodeRT creation errors.\n");
exit(1);
}
}
int main(int argc, char* argv[])
{
MotionController* controller = MotionController::CreateFromSoftware();
CheckErrors(controller);
printf("Hello, RapidCodeRT!\n");
printf("Serial Number: %d \n", controller->SerialNumberGet());
Axis* axis = controller->AxisGet(0); // Initialize Axis class
CheckErrors(axis);
try {
axis->ClearFaults();
axis->AmpEnableSet(true);
axis->MoveRelative(1);
while (!axis->MotionDoneGet()) {
printf("%8.3lf\n", axis->CommandPositionGet());
controller->OS->Sleep(100);
}
}
catch (const std::exception& e)
{
printf("\n%s\n", e.what());
}
printf("Exiting successfully.\n");
controller->Delete();
controller = nullptr;
return 0;
}
double CommandPositionGet()
Get the current command position.
void MoveRelative(double relativePosition, double vel, double accel, double decel, double jerkPct)
Command a relative point-to-point S-Curve motion.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5643
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
void Delete(void)
Delete the MotionController and all its objects.
uint32_t SerialNumberGet(void)
Get the controller's serial number.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:796
RapidCodeOS * OS
Provides access to operating system (Windows) features.
Definition rsi.h:3792
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
void AmpEnableSet(bool enable)
Enable all amplifiers.
bool MotionDoneGet()
Check to see if motion is done and settled.
void Sleep(int32_t milliseconds)
Put the current thread to sleep.
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.
Definition rsi.h:180
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
Definition rsi.h:107