6#ifndef RMP_INSTALL_PATH
7#define RMP_INSTALL_PATH ""
15#include <source_location>
34 bool hasErrors =
false;
35 std::string errorStrings(
"");
40 errorStrings += err->
what();
51 std::ostringstream message;
52 message <<
"Error! In "
53 << location.file_name() <<
'('
54 << location.line() <<
':'
55 << location.column() <<
") `"
56 << location.function_name() <<
"`:\n"
59 throw std::runtime_error(message.str().c_str());
78 std::cout <<
"Starting Network.." << std::endl;
79 controller->NetworkStart();
84 int messagesToRead = controller->NetworkLogMessageCountGet();
86 for (
int i = 0; i < messagesToRead; i++)
88 std::cout << controller->NetworkLogMessageGet(i) << std::endl;
90 throw std::runtime_error(
"Expected OPERATIONAL state but the network did not get there.");
94 std::cout <<
"Network Started" << std::endl << std::endl;
118 std::cout <<
"Shutting down the network.." << std::endl;
119 controller->NetworkShutdown();
124 int messagesToRead = controller->NetworkLogMessageCountGet();
126 for (
int i = 0; i < messagesToRead; i++)
128 std::cout << controller->NetworkLogMessageGet(i) << std::endl;
130 throw std::runtime_error(
"Expected SHUTDOWN state but the network did not get there.");
134 std::cout <<
"Network Shutdown" << std::endl << std::endl;
148 std::cout <<
"----------------------------------------------------------------------------------------------------\n";
149 std::cout <<
"Running " << sampleAppName <<
" Sample App\n";
150 std::cout <<
"----------------------------------------------------------------------------------------------------\n" << std::endl;
164 std::cout <<
"\n----------------------------------------------------------------------------------------------------\n";
167 std::cout << sampleAppName <<
" Sample App Completed Successfully\n";
171 std::cout << sampleAppName <<
" Sample App Failed with Exit Code: " << exitCode <<
"\n";
173 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.
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.