@@ -57,6 +57,14 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std:
5757 {
5858 startRobotProgram (autostart_program);
5959 }
60+
61+ if (headless_mode | !std::empty (autostart_program))
62+ {
63+ if (!waitForProgramRunning (500 ))
64+ {
65+ URCL_LOG_ERROR (" Program did not start running. Is the robot in remote control?" );
66+ }
67+ }
6068}
6169
6270ExampleRobotWrapper::~ExampleRobotWrapper ()
@@ -66,34 +74,41 @@ ExampleRobotWrapper::~ExampleRobotWrapper()
6674 stopConsumingRTDEData ();
6775 }
6876}
69- void ExampleRobotWrapper::initializeRobotWithDashboard ()
77+
78+ bool ExampleRobotWrapper::initializeRobotWithDashboard ()
7079{
7180 // // Stop program, if there is one running
7281 if (!dashboard_client_->commandStop ())
7382 {
7483 URCL_LOG_ERROR (" Could not send stop program command" );
84+ return false ;
7585 }
7686
7787 // Power it off
7888 if (!dashboard_client_->commandPowerOff ())
7989 {
8090 URCL_LOG_ERROR (" Could not send Power off command" );
91+ return false ;
8192 }
8293
8394 // Power it on
8495 if (!dashboard_client_->commandPowerOn ())
8596 {
8697 URCL_LOG_ERROR (" Could not send Power on command" );
98+ return false ;
8799 }
88100
89101 // Release the brakes
90102 if (!dashboard_client_->commandBrakeRelease ())
91103 {
92104 URCL_LOG_ERROR (" Could not send BrakeRelease command" );
105+ return false ;
93106 }
94107
95108 // Now the robot is ready to receive a program
96109 URCL_LOG_INFO (" Robot ready to start a program" );
110+ robot_initialized_ = true ;
111+ return true ;
97112}
98113
99114void ExampleRobotWrapper::handleRobotProgramState (bool program_running)
@@ -210,4 +225,19 @@ bool ExampleRobotWrapper::resendRobotProgram()
210225 return startRobotProgram (autostart_program_);
211226}
212227
228+ bool ExampleRobotWrapper::isHealthy () const
229+ {
230+ if (!robot_initialized_)
231+ {
232+ URCL_LOG_ERROR (" Robot is not initialized" );
233+ return false ;
234+ }
235+ if (!program_running_)
236+ {
237+ URCL_LOG_ERROR (" Robot program is not running" );
238+ return false ;
239+ }
240+ return true ;
241+ }
242+
213243} // namespace urcl
0 commit comments