mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 01:50:46 +02:00
added ROS service to resend robot program
This commit is contained in:
committed by
Felix Mauch
parent
ea0908ed58
commit
888db15012
@@ -184,6 +184,7 @@ protected:
|
|||||||
|
|
||||||
bool setSpeedSlider(ur_msgs::SetSpeedSliderFractionRequest& req, ur_msgs::SetSpeedSliderFractionResponse& res);
|
bool setSpeedSlider(ur_msgs::SetSpeedSliderFractionRequest& req, ur_msgs::SetSpeedSliderFractionResponse& res);
|
||||||
bool setIO(ur_msgs::SetIORequest& req, ur_msgs::SetIOResponse& res);
|
bool setIO(ur_msgs::SetIORequest& req, ur_msgs::SetIOResponse& res);
|
||||||
|
bool resendRobotProgram(std_srvs::TriggerRequest& req, std_srvs::TriggerResponse& res);
|
||||||
void commandCallback(const std_msgs::StringConstPtr& msg);
|
void commandCallback(const std_msgs::StringConstPtr& msg);
|
||||||
|
|
||||||
std::unique_ptr<UrDriver> ur_driver_;
|
std::unique_ptr<UrDriver> ur_driver_;
|
||||||
@@ -229,6 +230,7 @@ protected:
|
|||||||
|
|
||||||
ros::ServiceServer set_speed_slider_srv_;
|
ros::ServiceServer set_speed_slider_srv_;
|
||||||
ros::ServiceServer set_io_srv_;
|
ros::ServiceServer set_io_srv_;
|
||||||
|
ros::ServiceServer resend_robot_program_srv_;
|
||||||
ros::Subscriber command_sub_;
|
ros::Subscriber command_sub_;
|
||||||
|
|
||||||
uint32_t runtime_state_;
|
uint32_t runtime_state_;
|
||||||
|
|||||||
@@ -294,6 +294,12 @@ bool HardwareInterface ::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_h
|
|||||||
// Service to set any of the robot's IOs
|
// Service to set any of the robot's IOs
|
||||||
set_io_srv_ = robot_hw_nh.advertiseService("set_io", &HardwareInterface::setIO, this);
|
set_io_srv_ = robot_hw_nh.advertiseService("set_io", &HardwareInterface::setIO, this);
|
||||||
|
|
||||||
|
if (headless_mode)
|
||||||
|
{
|
||||||
|
resend_robot_program_srv_ =
|
||||||
|
robot_hw_nh.advertiseService("resend_robot_program", &HardwareInterface::resendRobotProgram, this);
|
||||||
|
}
|
||||||
|
|
||||||
// Calling this service will make the "External Control" program node on the UR-Program return.
|
// Calling this service will make the "External Control" program node on the UR-Program return.
|
||||||
deactivate_srv_ = robot_hw_nh.advertiseService("hand_back_control", &HardwareInterface::stopControl, this);
|
deactivate_srv_ = robot_hw_nh.advertiseService("hand_back_control", &HardwareInterface::stopControl, this);
|
||||||
|
|
||||||
@@ -657,6 +663,21 @@ bool HardwareInterface::setIO(ur_msgs::SetIORequest& req, ur_msgs::SetIOResponse
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HardwareInterface::resendRobotProgram(std_srvs::TriggerRequest& req, std_srvs::TriggerResponse& res)
|
||||||
|
{
|
||||||
|
res.success = ur_driver_->sendRobotProgram();
|
||||||
|
if (res.success)
|
||||||
|
{
|
||||||
|
res.message = "Successfully resent robot program";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res.message = "Could not resend robot program";
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void HardwareInterface::commandCallback(const std_msgs::StringConstPtr& msg)
|
void HardwareInterface::commandCallback(const std_msgs::StringConstPtr& msg)
|
||||||
{
|
{
|
||||||
std::string str = msg->data;
|
std::string str = msg->data;
|
||||||
|
|||||||
Reference in New Issue
Block a user