33 const std::string
SCRIPT_FILE =
"resources/external_control.urscript";
34 const std::string
OUTPUT_RECIPE =
"examples/resources/rtde_output_recipe.txt";
35 const std::string
INPUT_RECIPE =
"examples/resources/rtde_input_recipe.txt";
47 std::cout <<
"\033[1;32mProgram running: " << std::boolalpha << program_running <<
"\033[0m\n" << std::endl;
53 std::cout <<
"\033[1;32mTool contact result: " <<
toUnderlying(result) <<
"\033[0m\n" << std::endl;
58 int main(
int argc,
char* argv[])
65 robot_ip = std::string(argv[1]);
69 auto second_to_run = std::chrono::seconds(0);
72 second_to_run = std::chrono::seconds(std::stoi(argv[2]));
113 std::unique_ptr<ToolCommSetup> tool_comm_setup;
114 const bool HEADLESS =
true;
129 std::chrono::duration<double> time_done(0);
130 std::chrono::duration<double> timeout(second_to_run);
131 vector6d_t tcp_speed = { 0.0, 0.0, -0.02, 0.0, 0.0, 0.0 };
132 auto stopwatch_last = std::chrono::steady_clock::now();
133 auto stopwatch_now = stopwatch_last;
142 std::unique_ptr<rtde_interface::DataPackage> data_pkg =
g_my_driver->getDataPackage();
148 URCL_LOG_ERROR(
"Could not send joint command. Is the robot in remote control?");
154 URCL_LOG_INFO(
"Tool contact result triggered. Received tool contact result %i.",
159 if (time_done > timeout && second_to_run.count() != 0)
167 URCL_LOG_WARN(
"Could not get fresh data package from robot");
170 stopwatch_now = std::chrono::steady_clock::now();
171 time_done += stopwatch_now - stopwatch_last;
172 stopwatch_last = stopwatch_now;
#define URCL_LOG_ERROR(...)
This is the main class for interfacing the driver.
void setLogLevel(LogLevel level)
Set log level this will disable messages with lower log level.
#define URCL_LOG_WARN(...)
constexpr std::underlying_type< E >::type toUnderlying(const E e) noexcept
Converts an enum type to its underlying type.
This class is a wrapper around the dashboard server.
ToolContactResult
Types for encoding until tool contact execution result.
std::array< double, 6 > vector6d_t
Set when cartesian velocity control is active.
#define URCL_LOG_INFO(...)