Skip to content

Commit 01b3ebf

Browse files
Calling on_deactivate in dtr (#679) (#704)
* added on_deactivate call in dtr * Code formatting --------- Co-authored-by: Lennart Nachtigall <[email protected]> Co-authored-by: Felix Exner <[email protected]> (cherry picked from commit 39bb31d) Co-authored-by: Lennart Nachtigall <[email protected]>
1 parent 5058ac4 commit 01b3ebf

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ur_robot_driver/include/ur_robot_driver/hardware_interface.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class URPositionHardwareInterface : public hardware_interface::SystemInterface
8888
{
8989
public:
9090
RCLCPP_SHARED_PTR_DEFINITIONS(URPositionHardwareInterface);
91+
virtual ~URPositionHardwareInterface();
9192

9293
hardware_interface::CallbackReturn on_init(const hardware_interface::HardwareInfo& system_info) final;
9394

ur_robot_driver/src/hardware_interface.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ namespace rtde = urcl::rtde_interface;
5454

5555
namespace ur_robot_driver
5656
{
57+
58+
URPositionHardwareInterface::~URPositionHardwareInterface()
59+
{
60+
// If the controller manager is shutdown via Ctrl + C the on_deactivate methods won't be called.
61+
// We therefore need to make sure to actually deactivate the communication
62+
on_deactivate(rclcpp_lifecycle::State());
63+
}
64+
5765
hardware_interface::CallbackReturn
5866
URPositionHardwareInterface::on_init(const hardware_interface::HardwareInfo& system_info)
5967
{

0 commit comments

Comments
 (0)