🔴RMP INtime: Run a real-time program 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 Tenasys Documentation for more information 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:

#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;
}

Last updated