diff --git a/CMakeLists.txt b/CMakeLists.txt index e9f3b834..eb945022 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ find_package(catkin REQUIRED COMPONENTS trajectory_msgs ur_msgs tf + control_panel_ur ) ## System dependencies are found with CMake's conventions @@ -110,7 +111,7 @@ find_package(catkin REQUIRED COMPONENTS catkin_package( INCLUDE_DIRS include # LIBRARIES ur_modern_driver - CATKIN_DEPENDS hardware_interface controller_manager actionlib control_msgs geometry_msgs roscpp sensor_msgs trajectory_msgs ur_msgs + CATKIN_DEPENDS hardware_interface controller_manager actionlib control_msgs geometry_msgs roscpp sensor_msgs trajectory_msgs ur_msgs control_panel_ur DEPENDS ur_hardware_interface ) diff --git a/package.xml b/package.xml index 5cf0127f..d6af1d21 100644 --- a/package.xml +++ b/package.xml @@ -52,6 +52,7 @@ ur_msgs tf realtime_tools + control_panel_ur hardware_interface controller_manager ros_controllers @@ -66,6 +67,7 @@ ur_description tf realtime_tools + control_panel_ur diff --git a/src/ur_ros_wrapper.cpp b/src/ur_ros_wrapper.cpp index b859c837..cd969de4 100644 --- a/src/ur_ros_wrapper.cpp +++ b/src/ur_ros_wrapper.cpp @@ -52,6 +52,9 @@ #include #include +/// Ur Dashboard +#include "control_panel_ur/UrDashboard.h" + /// TF #include #include @@ -853,6 +856,7 @@ int main(int argc, char **argv) { ros::init(argc, argv, "ur_driver"); ros::NodeHandle nh; + if (ros::param::get("use_sim_time", use_sim_time)) { print_warning("use_sim_time is set!!"); } @@ -876,6 +880,18 @@ int main(int argc, char **argv) { } else reverse_port = 50001; + // Wait for the dashboard to be online before starting the driver + { + sr::UrDashboard ur_dashboard; + ur_dashboard.setHostname(host); + while (ros::ok() && !ur_dashboard.initSocketServer()) + { + double timeout = 5.0; + ROS_WARN("Could not connect to dashboard, retrying in %.2f seconds", timeout); + ros::Duration(timeout).sleep(); + } + } + RosWrapper interface(host, reverse_port); ros::AsyncSpinner spinner(3);