-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update DeviceRegistry::getDevicesAsPolyDriverList method - Add pragma once direcgtive to DeviceRegistry - Remove check to BaseStateDriver raising exeption with new data management - Move initialization of Camera buffers after Driver has been opened - Add test-helpers library and TestHelpers class - Fix Imu test - Update ControlBoardPositionDirectTest (still failing)
- Loading branch information
Showing
18 changed files
with
326 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#pragma once | ||
|
||
#include <map> | ||
#include <mutex> | ||
#include <string> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,54 @@ | ||
add_executable(ConfigurationParsingTest ConfigurationParsingTest.cc) | ||
add_executable(ConfigurationParsingFromFileTest ConfigurationParsingFromFileTest.cc) | ||
add_executable(ConfigurationParsingFromStringTest ConfigurationParsingFromStringTest.cc) | ||
|
||
target_link_libraries(ConfigurationParsingTest | ||
target_link_libraries(ConfigurationParsingFromFileTest | ||
PRIVATE | ||
GTest::gtest_main | ||
test-helpers | ||
gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER} | ||
gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER} | ||
YARP::YARP_dev | ||
YARP::YARP_os | ||
YARP::YARP_init | ||
gz-sim-yarp-device-registry | ||
gz-sim-yarp-basestate-system | ||
gz-sim-yarp-camera-system | ||
gz-sim-yarp-controlboard-system | ||
gz-sim-yarp-forcetorque-system | ||
gz-sim-yarp-imu-system | ||
gz-sim-yarp-laser-system | ||
) | ||
|
||
target_link_libraries(ConfigurationParsingFromStringTest | ||
PRIVATE | ||
GTest::gtest_main | ||
test-helpers | ||
gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER} | ||
gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER} | ||
YARP::YARP_dev | ||
YARP::YARP_os | ||
YARP::YARP_init | ||
gz-sim-yarp-device-registry | ||
gz-sim-yarp-basestate-system | ||
gz-sim-yarp-camera-system | ||
gz-sim-yarp-controlboard-system | ||
gz-sim-yarp-forcetorque-system | ||
gz-sim-yarp-imu-system | ||
gz-sim-yarp-laser-system | ||
) | ||
|
||
add_test(NAME ConfigurationParsingTest COMMAND ConfigurationParsingTest) | ||
|
||
# add_test(NAME ConfigurationParsingFromFileTest COMMAND ConfigurationParsingFromFileTest) | ||
add_test(NAME ConfigurationParsingFromStringTest COMMAND ConfigurationParsingFromStringTest) | ||
|
||
set(_env_vars) | ||
# list(APPEND _env_vars "GZ_SIM_SYSTEM_PLUGIN_PATH=$<TARGET_FILE_DIR:gz-sim-yarp-camera-system>") | ||
list(APPEND _env_vars "LIBGL_ALWAYS_SOFTWARE=1" | ||
"GZ_SIM_SYSTEM_PLUGIN_PATH=$<TARGET_FILE_DIR:gz-sim-yarp-device-registry>" | ||
"GZ_SIM_RESOURCE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/.." | ||
) | ||
"GZ_SIM_RESOURCE_PATH=${GZ_SIM_RESOURCE_PATH}:${CMAKE_CURRENT_SOURCE_DIR}/.." | ||
) | ||
|
||
# set_tests_properties(ConfigurationParsingFromFileTest PROPERTIES | ||
# ENVIRONMENT "${_env_vars}") | ||
|
||
set_tests_properties(ConfigurationParsingTest PROPERTIES | ||
set_tests_properties(ConfigurationParsingFromStringTest PROPERTIES | ||
ENVIRONMENT "${_env_vars}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include <BaseStateDriver.cpp> | ||
#include <CameraDriver.cpp> | ||
#include <ControlBoardDriver.hh> | ||
#include <DeviceRegistry.hh> | ||
#include <ForceTorqueDriver.cpp> | ||
#include <ImuDriver.cpp> | ||
#include <LaserDriver.cpp> | ||
#include <TestHelpers.hh> | ||
|
||
#include <gz/common/Console.hh> | ||
#include <gz/sim/Entity.hh> | ||
#include <gz/sim/EntityComponentManager.hh> | ||
#include <gz/sim/EventManager.hh> | ||
#include <gz/sim/TestFixture.hh> | ||
#include <sdf/Element.hh> | ||
|
||
#include <iostream> | ||
#include <memory> | ||
#include <string> | ||
|
||
#include <yarp/dev/IFrameGrabberImage.h> | ||
#include <yarp/dev/PolyDriver.h> | ||
#include <yarp/os/Network.h> | ||
|
||
TEST(ConfigurationParsingTest, LoadPluginsWithYarpConfigurationFile) | ||
{ | ||
std::string modelSdfName = "model_configuration_file.sdf"; | ||
std::string sdfPath = std::string("../../../tests/commons/") + modelSdfName; | ||
yarp::os::NetworkBase::setLocalMode(true); | ||
gz::common::Console::SetVerbosity(4); | ||
|
||
gz::sim::TestFixture testFixture{sdfPath}; | ||
|
||
testFixture.OnConfigure([&](const gz::sim::Entity& _worldEntity, | ||
const std::shared_ptr<const sdf::Element>& /*_sdf*/, | ||
gz::sim::EntityComponentManager& _ecm, | ||
gz::sim::EventManager& /*_eventMgr*/) { | ||
// Test Camera | ||
// std::cerr << "Testing Camera configuration" << std::endl; | ||
// auto cameraDrivers | ||
// = gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::CameraDriver>(); | ||
// EXPECT_EQ(cameraDrivers.size(), 1); | ||
// EXPECT_TRUE(cameraDrivers[0] != nullptr); | ||
|
||
// Test ForceTorque | ||
std::cerr << "Testing FT configuration" << std::endl; | ||
auto ftDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::ForceTorqueDriver>(); | ||
EXPECT_EQ(ftDrivers.size(), 1); | ||
EXPECT_TRUE(ftDrivers[0] != nullptr); | ||
|
||
// Test Imu | ||
std::cerr << "Testing Imu configuration" << std::endl; | ||
auto imuDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::ImuDriver>(); | ||
EXPECT_EQ(imuDrivers.size(), 1); | ||
EXPECT_TRUE(imuDrivers[0] != nullptr); | ||
|
||
// Test Laser | ||
std::cerr << "Testing Laser configuration" << std::endl; | ||
auto laserDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::LaserDriver>(); | ||
EXPECT_EQ(laserDrivers.size(), 1); | ||
EXPECT_TRUE(laserDrivers[0] != nullptr); | ||
|
||
// Test basestate | ||
std::cerr << "Testing BaseState configuration" << std::endl; | ||
auto bsDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::BaseStateDriver>(); | ||
EXPECT_EQ(bsDrivers.size(), 1); | ||
EXPECT_TRUE(bsDrivers[0] != nullptr); | ||
|
||
// Test controlboard | ||
std::cerr << "Testing ControlBoard configuration" << std::endl; | ||
auto cbDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::ControlBoardDriver>(); | ||
EXPECT_EQ(cbDrivers.size(), 1); | ||
EXPECT_TRUE(cbDrivers[0] != nullptr); | ||
}); | ||
|
||
testFixture.Finalize(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include <BaseStateDriver.cpp> | ||
#include <CameraDriver.cpp> | ||
#include <ControlBoardDriver.hh> | ||
#include <DeviceRegistry.hh> | ||
#include <ForceTorqueDriver.cpp> | ||
#include <ImuDriver.cpp> | ||
#include <LaserDriver.cpp> | ||
#include <TestHelpers.hh> | ||
|
||
#include <gz/common/Console.hh> | ||
#include <gz/sim/Entity.hh> | ||
#include <gz/sim/EntityComponentManager.hh> | ||
#include <gz/sim/EventManager.hh> | ||
#include <gz/sim/TestFixture.hh> | ||
#include <sdf/Element.hh> | ||
|
||
#include <iostream> | ||
#include <memory> | ||
#include <string> | ||
|
||
#include <yarp/dev/IFrameGrabberImage.h> | ||
#include <yarp/dev/PolyDriver.h> | ||
#include <yarp/os/Network.h> | ||
|
||
TEST(ConfigurationParsingTest, LoadPluginsWithYarpConfigurationString) | ||
{ | ||
std::string modelSdfName = "model_configuration_string.sdf"; | ||
std::string sdfPath = std::string("../../../tests/commons/") + modelSdfName; | ||
yarp::os::NetworkBase::setLocalMode(true); | ||
|
||
gz::sim::TestFixture testFixture{sdfPath}; | ||
gz::common::Console::SetVerbosity(4); | ||
|
||
testFixture.OnConfigure([&](const gz::sim::Entity& _worldEntity, | ||
const std::shared_ptr<const sdf::Element>& /*_sdf*/, | ||
gz::sim::EntityComponentManager& _ecm, | ||
gz::sim::EventManager& /*_eventMgr*/) { | ||
// Test Camera | ||
std::cerr << "Testing Camera configuration" << std::endl; | ||
auto cameraDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::CameraDriver>(); | ||
EXPECT_EQ(cameraDrivers.size(), 1); | ||
EXPECT_TRUE(cameraDrivers[0] != nullptr); | ||
|
||
// Test ForceTorque | ||
std::cerr << "Testing FT configuration" << std::endl; | ||
auto ftDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::ForceTorqueDriver>(); | ||
EXPECT_EQ(ftDrivers.size(), 1); | ||
EXPECT_TRUE(ftDrivers[0] != nullptr); | ||
|
||
// Test Imu | ||
std::cerr << "Testing Imu configuration" << std::endl; | ||
auto imuDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::ImuDriver>(); | ||
EXPECT_EQ(imuDrivers.size(), 1); | ||
EXPECT_TRUE(imuDrivers[0] != nullptr); | ||
|
||
// Test Laser | ||
std::cerr << "Testing Laser configuration" << std::endl; | ||
auto laserDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::LaserDriver>(); | ||
EXPECT_EQ(laserDrivers.size(), 1); | ||
EXPECT_TRUE(laserDrivers[0] != nullptr); | ||
|
||
// Test basestate | ||
std::cerr << "Testing BaseState configuration" << std::endl; | ||
auto bsDrivers | ||
= gzyarp::testing::TestHelpers::getDevicesOfType<yarp::dev::gzyarp::BaseStateDriver>(); | ||
EXPECT_EQ(bsDrivers.size(), 1); | ||
EXPECT_TRUE(bsDrivers[0] != nullptr); | ||
|
||
// Controlboard test skipped since configuration too complex to pass as string | ||
}); | ||
|
||
testFixture.Finalize(); | ||
} |
Oops, something went wrong.