Skip to content

Commit

Permalink
Remove control board data from singleton on ControlBoard destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
xela-95 committed Feb 20, 2024
1 parent b84e162 commit 7f99132
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion plugins/controlboard/src/ControlBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ ControlBoard::~ControlBoard()
{
m_controlBoardDriver.close();
}
// ControlBoardDataSingleton::getControlBoardHandler()->removeControlBoard();
ControlBoardDataSingleton::getControlBoardHandler()->removeControlBoard(
m_controlBoardData.modelScopedName);
}

void ControlBoard::Configure(const Entity& _entity,
Expand Down
10 changes: 4 additions & 6 deletions tests/controlboard/ControlBoardTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class ControlBoardTest : public testing::TestWithParam<std::string>
: testFixture{"../../../tests/controlboard/" + GetParam()}
{
std::cerr << "========== Test Parameter: " << GetParam() << std::endl;
yarp::os::NetworkBase::setLocalMode(true);
gz::common::Console::SetVerbosity(4);

// testFixture = gz::sim::TestFixture{"../../../tests/controlboard/" + GetParam()};
Expand Down Expand Up @@ -92,7 +91,7 @@ class ControlBoardTest : public testing::TestWithParam<std::string>
double linkMass{1};
double linkLength{1.0};
double linkInertiaAtLinkEnd{0.3352}; // Computed with parallel axis theorem
int plannedIterations{2000};
int plannedIterations{1000};
int iterations{0};
double acceptedTolerance{5e-3};
bool configured{false};
Expand All @@ -102,14 +101,13 @@ class ControlBoardTest : public testing::TestWithParam<std::string>
gz::sim::Link link;
gz::sim::Link parentLink;
gz::sim::Joint joint;
yarp::os::Property option;
double jointVelocityPreviousStep{};
yarp::dev::PolyDriver* driver;
yarp::dev::ITorqueControl* iTorqueControl = nullptr;
yarp::dev::IControlMode* iControlMode = nullptr;
};

TEST_P(ControlBoardTest, GetTorqueWithPendulumJointRelativeToParentLink)
TEST_P(ControlBoardTest, CompareJointTorqueWithExpectedValueUsingPendulumModel)
{

testFixture
Expand Down Expand Up @@ -204,5 +202,5 @@ TEST_P(ControlBoardTest, GetTorqueWithPendulumJointRelativeToParentLink)

INSTANTIATE_TEST_SUITE_P(ControlBoardTorqueControl,
ControlBoardTest,
testing::Values("pendulum_joint_relative_to_parent_link.sdf",
"pendulum_joint_relative_to_child_link.sdf"));
testing::Values("pendulum_joint_relative_to_child_link.sdf",
"pendulum_joint_relative_to_parent_link.sdf"));

0 comments on commit 7f99132

Please sign in to comment.