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. usingnamespace RSI::RapidCode;staticvoidCheckErrors(RapidCodeObject* rsiObject){ RsiError* err;while (rsiObject->ErrorLogCountGet() >0) { err =rsiObject->ErrorLogGet();printf("%s\n",err->text); }}staticvoidStartTheNetwork(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; }}intmain(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 classCheckErrors(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 phantomaxis->ClearFaults();axis->AmpEnableSet(true);axis->MoveRelative(100);while (!axis->MotionDoneGet()) {printf("%lf",axis->CommandPositionGet()); }return0; }catch (const std::exception& e) {printf("\n%s\n",e.what()); }}