Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions diff_drive_controller/test/test_diff_drive_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ class TestDiffDriveController : public ::testing::Test
controller_name + "/cmd_vel", rclcpp::SystemDefaultsQoS());
}

void TearDown() override
{
// Reset the controller before the fixture is destroyed to ensure the controller's
// shutdown transition (which clears loaned interfaces) runs while the underlying
// StateInterface/CommandInterface objects are still alive. LoanedStateInterface stores
// a const reference (not a shared_ptr), so destruction order matters.
controller_.reset();
}

static void TearDownTestCase() { rclcpp::shutdown(); }

/// Publish velocity msgs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ class OmniWheelDriveControllerFixture : public ::testing::Test
"/test_omni_wheel_drive_controller/cmd_vel", rclcpp::SystemDefaultsQoS());
}

void TearDown() override
{
// Reset the controller before the fixture is destroyed to ensure the controller's
// shutdown transition (which clears loaned interfaces) runs while the underlying
// StateInterface/CommandInterface objects are still alive. LoanedStateInterface stores
// a const reference (not a shared_ptr), so destruction order matters.
controller_.reset();
}

static void TearDownTestCase() { rclcpp::shutdown(); }

protected:
Expand Down