APIs, concepts, guides, and more
Run a sample app on eRMP

Create C++ RapidCodeRT Hello World project that runs on eRMP.

🔹 RMP INtime: Run a RapidCodeRT app

Warning
The tutorial assumes you have INtime and Visual Studio properly installed on a Windows PC
  1. Create your application using the INtime Application Wizard Image
  2. Configure it to run on your eRMP Image
  3. Set the console output to run on your local machine run C:\Program Files (x86)\INtime\bin\stealconsoleio.exe Image
  4. Test and confirm that you can run a HelloWorld program on the remote PC and get the output on your local pc. Image
  5. Configure your C++ program to be able to run RMP motion controller.
    1. Add C:\\RSI\X.X.X\include and $(INtime)rt\include\cpp20 to your "Additional INclude Directories" Image
    2. Add
      RSIAPP
      __INTIME_CPP20
      _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
      _SILENCE_BOGUS_WARNINGS
      _HAS_NAMESPACE
      to your "Preprocessor Definitions"
      Image
    3. Add C:\RSI\X.X.X\lib\rt to "Additional Library Directories". Image
    4. Add RapidCodeRT.lib rt.lib pcibus.lib netlib.lib clib.lib vshelper17.lib to "Additional Dependencies". Image

      Warning
      For Additional Dependencies please see:
      INtime documentation
    5. Add your rsi.lic to your eRMP
      1. Configure your eRMP for FTP file transfer
        Image
      2. Transfer rsi.lic to the root folder of your eRMP. Image
      3. 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());
}
}
void HardwareNegLimitActionSet(RSIAction action)
Set the action that will occur when the Hardware Negative Limit Event triggers.
double CommandPositionGet()
Get the current command position.
void HardwarePosLimitActionSet(RSIAction action)
Set the action that will occur when the Hardware Positive Limit Event triggers.
void SoftwareNegLimitActionSet(RSIAction action)
Set the action that will occur when the Software Negative Limit Event triggers.
void HomeActionSet(RSIAction action)
Set the action that will occur when the Home Event triggers.
void ErrorLimitActionSet(RSIAction action)
Set the action that will occur when the Error Limit Event triggers.
void MotorTypeSet(RSIMotorType type)
Set the motor type.
void MoveRelative(double relativePosition, double vel, double accel, double decel, double jerkPct)
Command a relative point-to-point S-Curve motion.
void SoftwarePosLimitActionSet(RSIAction action)
Set the action that will occur when the Software Positive Limit Event triggers.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5549
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
RSINetworkState NetworkStateGet()
const char *const NetworkLogMessageGet(int32_t messageIndex)
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
void NetworkStart()
Start the network with RSINetworkStartupMethodNORMAL.
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.
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