@@ -5,7 +5,7 @@ namespace urcl
55{
66ExampleRobotWrapper::ExampleRobotWrapper (const std::string& robot_ip, const std::string& output_recipe_file,
77 const std::string& input_recipe_file, const bool headless_mode,
8- const std::string& script_file)
8+ const std::string& autostart_program, const std::string& script_file)
99{
1010 dashboard_client_ = std::make_shared<DashboardClient>(robot_ip);
1111
@@ -21,6 +21,11 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std:
2121 std::make_shared<UrDriver>(robot_ip, script_file, output_recipe_file, input_recipe_file,
2222 std::bind (&ExampleRobotWrapper::handleRobotProgramState, this , std::placeholders::_1),
2323 headless_mode, std::move (tool_comm_setup));
24+
25+ if (!headless_mode && !std::empty (autostart_program))
26+ {
27+ startRobotProgram (autostart_program);
28+ }
2429}
2530void ExampleRobotWrapper::initializeRobotWithDashboard ()
2631{
@@ -106,4 +111,15 @@ bool ExampleRobotWrapper::waitForProgramRunning(int milliseconds)
106111 return false ;
107112}
108113
114+ bool ExampleRobotWrapper::startRobotProgram (const std::string& program_file_name)
115+ {
116+ if (!dashboard_client_->commandLoadProgram (program_file_name))
117+ {
118+ URCL_LOG_ERROR (" Could not load program '%s'" , program_file_name.c_str ());
119+ return false ;
120+ }
121+
122+ return dashboard_client_->commandPlay ();
123+ }
124+
109125} // namespace urcl
0 commit comments