The RMP Motion Controller APIs
Helper Functions

This class includes the source code of all our SampleAppsCPP helper functions.

Helper functions were created to reduce code. Please note that if you would like to use this classes on your personal project you will have to replicate this class.

This sample code presumes that the user has set the tuning paramters(PID, PIV, etc.) prior to running this program so that the motor can rotate in a stable manner.
This is a sample program to assist in the integration of the RMP motion controller with your application. It may not contain all of the logic and safety features that your application requires.
#include "rsi.h" // Import our RapidCode Library.
#include <iostream>
#include <cstdlib>
using namespace std;
using namespace RSI::RapidCode;
static void CheckErrors(RapidCodeObject* rsiObject)
bool hasErrors = false;
std::string errorStrings("");
while (rsiObject->ErrorLogCountGet() > 0)
const RsiError* err = rsiObject->ErrorLogGet();
errorStrings += err->what();
if (!err->isWarning)
hasErrors = true;
if (errorStrings.size() > 0)
printf("%s", errorStrings.c_str());
if (hasErrors)
throw std::runtime_error(errorStrings.c_str());
static void StartTheNetwork(MotionController* controller)
// Initialize the Network
if (controller->NetworkStateGet() != RSINetworkState::RSINetworkStateOPERATIONAL) // Check if network is started already.
cout << "Starting Network.." << 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++)
cout << controller->NetworkLogMessageGet(i) << endl; // Print all the messages to help figure out the problem
cout << "Expected OPERATIONAL state but the network did not get there." << 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.
cout << "Network Started" << endl;
static void CheckErrors(RapidCodeObject rsiObject)
Check if the RapidCodeObject has any errors.
static void StartTheNetwork(MotionController controller)
Start the controller communication/network.
Helper Functions for checking logged creation errors, starting the network, etc.
RSINetworkState NetworkStateGet()
const char *const NetworkLogMessageGet(int32_t messageIndex)
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:762
void NetworkStart()
Start the network with RSINetworkStartupMethodNORMAL.
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:178
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
Definition rsi.h:105
bool isWarning
Whether the error is or is not a warning.
Definition rsi.h:114
const char * what() const noexcept
Returns a null terminated character sequence that may be used to identify the exception.
Definition rsi.h:167