1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-10 18:10:47 +02:00

Load the script from an external file

This commit is contained in:
Felix Mauch
2019-05-20 12:28:35 +02:00
parent ec31db35b2
commit 89ee1aae8a
7 changed files with 110 additions and 87 deletions

View File

@@ -45,9 +45,15 @@ bool HardwareInterface ::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_h
joint_velocities_ = { { 0, 0, 0, 0, 0, 0 } };
joint_efforts_ = { { 0, 0, 0, 0, 0, 0 } };
std::string robot_ip = robot_hw_nh.param<std::string>("robot_ip", "192.168.56.101");
std::string script_filename;
if (!robot_hw_nh.getParam("script_file", script_filename))
{
ROS_ERROR_STREAM("Required parameter " << robot_hw_nh.resolveName("script_file") << " not given.");
return false;
}
ROS_INFO_STREAM("Initializing urdriver");
ur_driver_.reset(new UrDriver(robot_ip));
ur_driver_.reset(new UrDriver(robot_ip, script_filename));
if (!root_nh.getParam("hardware_interface/joints", joint_names_))
{

View File

@@ -64,7 +64,11 @@ int main(int argc, char** argv)
hw_interface.reset(new ur_driver::HardwareInterface);
hw_interface->init(nh, nh_priv);
if (!hw_interface->init(nh, nh_priv))
{
ROS_ERROR_STREAM("Could not correctly initialize robot. Exiting");
exit(1);
}
ROS_INFO_STREAM("initialized hw interface");
controller_manager::ControllerManager cm(hw_interface.get(), nh);
ROS_INFO_STREAM("started controller manager");