Skip to content

Commit

Permalink
Fix ControlBoardPositionControlTest to use DeviceRegistry for device …
Browse files Browse the repository at this point in the history
…retrieval
  • Loading branch information
xela-95 committed Apr 17, 2024
1 parent 6c3b5f9 commit 9dc1044
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/controlboard/ControlBoardPositionControlTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

#include <gz/common/Console.hh>
#include <gz/math/Vector3.hh>
#include <gz/sim/Entity.hh>
#include <gz/sim/EntityComponentManager.hh>
#include <gz/sim/EventManager.hh>
#include <gz/sim/Joint.hh>
#include <gz/sim/Link.hh>
#include <gz/sim/Model.hh>
#include <gz/sim/TestFixture.hh>
#include <gz/sim/Types.hh>
#include <gz/sim/Util.hh>
#include <gz/sim/World.hh>
#include <gz/sim/components/JointForceCmd.hh>
#include <sdf/Element.hh>

#include <yarp/dev/IControlMode.h>
#include <yarp/dev/IEncoders.h>
Expand Down Expand Up @@ -56,7 +65,10 @@ class ControlBoardPositionFixture : public testing::Test
EXPECT_NE(gz::sim::kNullEntity, modelEntity);
model = gz::sim::Model(modelEntity);

driver = gzyarp::DeviceRegistry::getHandler()->getDevice(deviceScopedName);
auto deviceKeys = gzyarp::DeviceRegistry::getHandler()->getDevicesKeys();
ASSERT_EQ(deviceKeys.size(), 1);
driver = gzyarp::DeviceRegistry::getHandler()->getDevice(deviceKeys[0]);

ASSERT_TRUE(driver != nullptr);
iPositionControl = nullptr;
ASSERT_TRUE(driver->view(iPositionControl));
Expand Down

0 comments on commit 9dc1044

Please sign in to comment.