6#ifndef RMP_INSTALL_PATH
7#define RMP_INSTALL_PATH ""
15#include <source_location>
27 return "RSINetworkStartErrorNETWORK_START_OK";
29 return "RSINetworkStartErrorNIC_PASSED";
31 return "RSINetworkStartErrorDEVICES_CONNECTED_POWERED";
33 return "RSINetworkStartErrorDISCOVERED_ZERO_NODES";
35 return "RSINetworkStartErrorGENERAL_DISCOVERY_FAILURE";
37 return "RSINetworkStartErrorNETWORK_INIT_FAILURE";
39 return "RSINetworkStartErrorINCORRECT_ENI_FORMAT";
41 return "RSINetworkStartErrorSLAVE_COMM_FAILED";
43 return "RSINetworkStartErrorMEMORY_CONFIG";
45 return "RSINetworkStartErrorETHERCAT_MASTER_STARTUP_ERROR";
47 return "RSINetworkStartErrorINTERNAL_RMP_ERROR";
49 return "RSINetworkStartErrorINTIME_OPEN_ERROR";
51 return "RSINetworkStartErrorFAILED_TO_READ_PRODUCT_CODE";
53 return "RSINetworkStartErrorFAILED_TO_READ_VENDOR_ID";
55 return "RSINetworkStartErrorFAILED_TO_READ_REVISION";
57 return "RSINetworkStartErrorFAILED_TO_READ_SERIAL_NO";
59 return "RSINetworkStartErrorFAILED_TO_READ_STATION_ALIAS";
61 return "RSINetworkStartErrorTHREAD_SCHEDULING_OR_PRIORITY";
63 return "RSINetworkStartErrorETHERCAT_SAFETY_NOT_LICENSED";
65 return "RSINetworkStartErrorETHERCAT_SAFETY_MAIN_DEVICE_NOT_DETECTED";
67 return "RSINetworkStartErrorUNSUPPORTED_NODE_DETECTED";
69 return "RSINetworkStartErrorENI_SAMPLE_RATE_MISMATCH";
71 return "RSINetworkStartErrorCPU_AFFINITY";
73 return "RSINetworkStartErrorUNKNOWN";
89 bool hasErrors =
false;
90 std::string errorStrings(
"");
95 errorStrings += err->
what();
106 std::ostringstream message;
107 message <<
"Error! In "
108 << location.file_name() <<
'('
109 << location.line() <<
':'
110 << location.column() <<
") `"
111 << location.function_name() <<
"`:\n"
114 throw std::runtime_error(message.str().c_str());
133 std::cout <<
"Starting Network.." << std::endl;
134 controller->NetworkStart();
140 std::cout <<
"Network start error: " << NetworkStartErrorName(startError)
141 <<
" (" <<
static_cast<int>(startError) <<
")" << std::endl;
143 int messagesToRead = controller->NetworkLogMessageCountGet();
145 for (
int i = 0; i < messagesToRead; i++)
147 std::cout << controller->NetworkLogMessageGet(i) << std::endl;
149 throw std::runtime_error(
"Expected OPERATIONAL state but the network did not get there.");
153 std::cout <<
"Network Started" << std::endl << std::endl;
177 std::cout <<
"Shutting down the network.." << std::endl;
178 controller->NetworkShutdown();
183 int messagesToRead = controller->NetworkLogMessageCountGet();
185 for (
int i = 0; i < messagesToRead; i++)
187 std::cout << controller->NetworkLogMessageGet(i) << std::endl;
189 throw std::runtime_error(
"Expected SHUTDOWN state but the network did not get there.");
193 std::cout <<
"Network Shutdown" << std::endl << std::endl;
207 std::cout <<
"----------------------------------------------------------------------------------------------------\n";
208 std::cout <<
"Running " << sampleAppName <<
" Sample App\n";
209 std::cout <<
"----------------------------------------------------------------------------------------------------\n" << std::endl;
223 std::cout <<
"\n----------------------------------------------------------------------------------------------------\n";
226 std::cout << sampleAppName <<
" Sample App Completed Successfully\n";
230 std::cout << sampleAppName <<
" Sample App Failed with Exit Code: " << exitCode <<
"\n";
232 std::cout <<
"----------------------------------------------------------------------------------------------------\n" << std::endl;
Represents the RMP soft motion controller. This class provides an interface to general controller con...
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.
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
bool isWarning
Whether the error is or is not a warning.
const char * what() const noexcept
Returns a null terminated character sequence that may be used to identify the exception.
@ RSINetworkStateSHUTDOWN
EtherCAT was shutdown or stopped, must restart.
@ RSINetworkStateOPERATIONAL
EtherCAT operational, good state.
@ RSINetworkStateUNINITIALIZED
EtherCAT not yet started.
RSINetworkStartError
Network start errors.
@ RSINetworkStartErrorNIC_PASSED
Invalid or unusable NIC/interface selection. Verify NIC name, interface state, and permissions.
@ RSINetworkStartErrorINCORRECT_ENI_FORMAT
ENI data is invalid or unreadable. Regenerate or replace the ENI file.
@ RSINetworkStartErrorETHERCAT_SAFETY_MAIN_DEVICE_NOT_DETECTED
Safety configuration was detected but no supported Safety MainDevice was found.
@ RSINetworkStartErrorMEMORY_CONFIG
Memory/configuration allocation failed during network startup. Restart and review network logs.
@ RSINetworkStartErrorENI_SAMPLE_RATE_MISMATCH
The ENI cycle time does not match the configured SampleRate. Regenerate the ENI after changing the sa...
@ RSINetworkStartErrorSLAVE_COMM_FAILED
Startup communication with one or more EtherCAT slaves failed. Verify wiring and slave health.
@ RSINetworkStartErrorFAILED_TO_READ_STATION_ALIAS
Failed to read Station Alias from a slave device. Verify slave communication stability.
@ RSINetworkStartErrorFAILED_TO_READ_PRODUCT_CODE
Failed to read Product Code from a slave device. Verify slave communication stability.
@ RSINetworkStartErrorINTIME_OPEN_ERROR
INtime open/init operation failed. Verify INtime runtime status and platform setup.
@ RSINetworkStartErrorDISCOVERED_ZERO_NODES
Discovery completed with zero nodes found. Verify topology and that slaves are powered.
@ RSINetworkStartErrorDEVICES_CONNECTED_POWERED
EtherCAT devices could not be reached. Verify cabling, power, and link status.
@ RSINetworkStartErrorCPU_AFFINITY
Linux CPU affinity is not set to a single core.
@ RSINetworkStartErrorNETWORK_INIT_FAILURE
Network startup failed after initial setup. Review network logs and configuration.
@ RSINetworkStartErrorETHERCAT_MASTER_STARTUP_ERROR
EtherCAT master failed to reach the required startup state. Check logs and network configuration.
@ RSINetworkStartErrorFAILED_TO_READ_VENDOR_ID
Failed to read Vendor ID from a slave device. Verify slave communication stability.
@ RSINetworkStartErrorFAILED_TO_READ_SERIAL_NO
Failed to read Serial Number from a slave device. Verify slave communication stability.
@ RSINetworkStartErrorNETWORK_START_OK
No startup error. Network start completed successfully.
@ RSINetworkStartErrorFAILED_TO_READ_REVISION
Failed to read Revision from a slave device. Verify slave communication stability.
@ RSINetworkStartErrorUNSUPPORTED_NODE_DETECTED
An unsupported node on the network is blocking EtherCAT startup.
@ RSINetworkStartErrorTHREAD_SCHEDULING_OR_PRIORITY
Failed to set required thread scheduling/priority. Verify RT kernel support and privileges.
@ RSINetworkStartErrorETHERCAT_SAFETY_NOT_LICENSED
Safety configuration was detected but the required safety license is not present.
@ RSINetworkStartErrorGENERAL_DISCOVERY_FAILURE
Discovery failed for an unspecified reason. Check network logs and retry discovery/start.
@ RSINetworkStartErrorINTERNAL_RMP_ERROR
Internal controller/runtime error occurred while starting the network. Restart and collect logs.
void CheckErrors(RapidCodeObject *rsiObject, const std::source_location &location=std::source_location::current())
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
void NetworkStart(MotionController *controller)
[CheckErrors]
void PrintHeader(std::string sampleAppName)
[NetworkShutdown]
void NetworkShutdown(MotionController *controller)
[NetworkStart]
void PrintFooter(std::string sampleAppName, int exitCode)
[PrintHeader]
Helpers namespace provides utility functions for common tasks in RMP applications.