🔴RMP INtime: Run a RapidCodeRT app

The tutorial assumes you have INtime and Visual Studio properly installed on a Windows PC

  1. Create your application using the INtime Applicaion Wizard

2. Configure it to run on your eRMP

3. Set the console output to run on your local machine

run C:\Program Files (x86)\INtime\bin\stealconsoleio.exe

4. Test and confirm that you can run a HelloWorld program on the remote PC and get the output on your local pc.

5. Configure your C++ program to be able to run RMP motion controller.

5.1 Add C:\\RSI\X.X.X\include and $(INtime)rt\include\cpp20 to your "Additional INclude Directories"

5.2 Add RSIAPP __INTIME_CPP20 _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS _SILENCE_BOGUS_WARNINGS _HAS_NAMESPACE to your "Preprocessor Definitions"

5.3 Add C:\RSI\X.X.X\lib\rt to "Additional Library Directories".

5.4 Add RapidCodeRT.lib rt.lib pcibus.lib netlib.lib clib.lib vshelper17.lib to "Additional Dependancies".

For Additional Dependancies please see: INtime documentation

6. Add your rsi.lic to your eRMP

6.1 Configure your eRMP for FTP file transfer

6.2 Transfer rsi.lic to the root folder of your eRMP.

7. Create a simple program to run on your eRMP. This example program will spin a phantom axis.

#include <iostream>
#include "rsi.h" // Import our RapidCode Library. 
using namespace RSI::RapidCode;

static void CheckErrors(RapidCodeObject* rsiObject)
{
  RsiError* err;
  while (rsiObject->ErrorLogCountGet() > 0)
  {
    err = rsiObject->ErrorLogGet();
    printf("%s\n", err->text);
  }
}
static void StartTheNetwork(MotionController* controller)
{
  // Initialize the Network
  if (controller->NetworkStateGet() != RSINetworkState::RSINetworkStateOPERATIONAL)        // Check if network is started already.
  {
    std::cout << "Starting Network.." << std::endl;
    controller->NetworkStart();                                                          // If not. Initialize The Network. (This can also be done from RapidSetup Tool)
  }
  if (controller->NetworkStateGet() != RSINetworkState::RSINetworkStateOPERATIONAL)        // Check if network is started again.
  {
    int messagesToRead = controller->NetworkLogMessageCountGet();                        // Some kind of error starting the network, read the network log messages
    for (int i = 0; i < messagesToRead; i++)
    {
      std::cout << controller->NetworkLogMessageGet(i) << std::endl;                                // Print all the messages to help figure out the problem
    }
    std::cout << "Expected OPERATIONAL state but the network did not get there." << std::endl;
    //throw new RsiError();                                                             // Uncomment if you want your application to exit when the network isn't operational. (Comment when using phantom axis)
  }
  else                                                                                    // Else, of network is operational.
  {
    std::cout << "Network Started" << std::endl;
  }
}


int main(int argc, char* argv[])
{
  MotionController* controller = MotionController::CreateFromSoftware(nullptr, "NodeB");
  CheckErrors(controller);
  printf("Hello, World!\n");
  printf("Serial Number: %d", controller->SerialNumberGet());
  try {
    Axis* axis = controller->AxisGet(0);           // Initialize Axis class
    CheckErrors(axis);
    axis->ErrorLimitActionSet(RSIAction::RSIActionNONE);       // Set Error Limit Action.
    axis->HardwareNegLimitActionSet(RSIAction::RSIActionNONE); // Set Hardware Negative Limit Action.
    axis->HardwarePosLimitActionSet(RSIAction::RSIActionNONE); // Set Hardware Positive Limit Action.
    axis->HomeActionSet(RSIAction::RSIActionNONE);             // Set Home Action.
    axis->SoftwareNegLimitActionSet(RSIAction::RSIActionNONE); // Set Software Negative Limit Action.
    axis->SoftwarePosLimitActionSet(RSIAction::RSIActionNONE); // Set Software Positive Limit Action.
    axis->MotorTypeSet(RSIMotorType::RSIMotorTypePHANTOM);     // Set the MotorType to phantom
    axis->ClearFaults();
    axis->AmpEnableSet(true);
    axis->MoveRelative(100);
    while (!axis->MotionDoneGet()) {
      printf("%lf", axis->CommandPositionGet());
    }
    return 0;
  }
  catch (const std::exception& e)
  {
    printf("\n%s\n", e.what());
  }
}

Last updated