diff --git a/src/devices/RemoteControlBoard/tests/RemoteControlBoard_test.cpp b/src/devices/RemoteControlBoard/tests/RemoteControlBoard_test.cpp index 04d0387d1c..bec1397d48 100644 --- a/src/devices/RemoteControlBoard/tests/RemoteControlBoard_test.cpp +++ b/src/devices/RemoteControlBoard/tests/RemoteControlBoard_test.cpp @@ -125,7 +125,7 @@ TEST_CASE("dev::RemoteControlBoardTest", "[yarp::dev]") yarp::dev::tests::exec_iAxisInfo_test_1(iinfo); yarp::dev::tests::exec_iEncodersTimed_test_1(ienc); yarp::dev::tests::exec_iControlMode_test_1(icmd, iinfo); - yarp::dev::tests::exec_iInteractionMode_test_1(iint); + yarp::dev::tests::exec_iInteractionMode_test_1(iint, iinfo); yarp::dev::tests::exec_iMotor_test_1(imot); yarp::dev::tests::exec_iMotorEncoders_test_1(imotenc); yarp::dev::tests::exec_iPidControl_test_1(ipid); diff --git a/src/devices/controlBoardRemapper/tests/controlBoardRemapper_t2_test.cpp b/src/devices/controlBoardRemapper/tests/controlBoardRemapper_t2_test.cpp index 69de847b26..679fedaa8a 100644 --- a/src/devices/controlBoardRemapper/tests/controlBoardRemapper_t2_test.cpp +++ b/src/devices/controlBoardRemapper/tests/controlBoardRemapper_t2_test.cpp @@ -108,7 +108,7 @@ TEST_CASE("dev::ControlBoardRemapperTest2", "[yarp::dev]") yarp::dev::tests::exec_iAxisInfo_test_1(iinfo); yarp::dev::tests::exec_iEncodersTimed_test_1(ienc); yarp::dev::tests::exec_iControlMode_test_1(icmd, iinfo); - yarp::dev::tests::exec_iInteractionMode_test_1(iint); + yarp::dev::tests::exec_iInteractionMode_test_1(iint,iinfo); yarp::dev::tests::exec_iMotor_test_1(imot); yarp::dev::tests::exec_iMotorEncoders_test_1(imotenc); yarp::dev::tests::exec_iPidControl_test_1(ipid); diff --git a/src/devices/fakeMotionControl/tests/fakeMotionControl_test.cpp b/src/devices/fakeMotionControl/tests/fakeMotionControl_test.cpp index a67f885511..1e92a55961 100644 --- a/src/devices/fakeMotionControl/tests/fakeMotionControl_test.cpp +++ b/src/devices/fakeMotionControl/tests/fakeMotionControl_test.cpp @@ -92,7 +92,7 @@ TEST_CASE("dev::fakeMotionControl", "[yarp::dev]") yarp::dev::tests::exec_iAxisInfo_test_1(iaxis); yarp::dev::tests::exec_iEncodersTimed_test_1(ienc); yarp::dev::tests::exec_iControlMode_test_1(icmd, iaxis); - yarp::dev::tests::exec_iInteractionMode_test_1(iint); + yarp::dev::tests::exec_iInteractionMode_test_1(iint, iaxis); yarp::dev::tests::exec_iMotor_test_1(imot); yarp::dev::tests::exec_iMotorEncoders_test_1(imotenc); yarp::dev::tests::exec_iPidControl_test_1(ipid); diff --git a/src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h b/src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h index e81a04c7eb..b478a768b5 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h @@ -10,6 +10,10 @@ #include #include +#include +#include +#include + using namespace yarp::dev; using namespace yarp::os; @@ -43,6 +47,22 @@ namespace yarp::dev::tests b = icurr->getCurrentRange(0, &min, &max); CHECK(b); + + auto mins = std::vector< double >(axis); + auto maxs = std::vector< double >(axis); + auto currs = std::vector< double >(axis); + + b = icurr->getCurrentRanges(mins.data(), maxs.data()); + CHECK(b); + + b = icurr->getCurrents(currs.data()); + CHECK(b); + + b = icurr->getRefCurrents(currs.data()); + CHECK(b); + + b = icurr->setRefCurrents(currs.data()); + CHECK(b); } } diff --git a/src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h b/src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h index d6211fa08a..59c3fb00d3 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h @@ -6,6 +6,11 @@ #ifndef IINTERACTIONMODETEST_H #define IINTERACTIONMODETEST_H +#include +#include +#include + +#include #include #include @@ -14,11 +19,15 @@ using namespace yarp::os; namespace yarp::dev::tests { - inline void exec_iInteractionMode_test_1(IInteractionMode* iint) + inline void exec_iInteractionMode_test_1(IInteractionMode* iint, IAxisInfo* iinfo) { REQUIRE(iint != nullptr); + REQUIRE(iinfo != nullptr); - bool b=false; + int ax; + bool b = iinfo->getAxes(&ax); + CHECK(b); + REQUIRE(ax > 0); yarp::dev::InteractionModeEnum val; yarp::dev::InteractionModeEnum ret; @@ -39,6 +48,25 @@ namespace yarp::dev::tests b = iint->getInteractionMode(0, &ret); CHECK(b); + + auto modes = std::vector< yarp::dev::InteractionModeEnum>(ax); + b = iint->getInteractionModes(modes.data()); + CHECK(b); + + auto joints = std::vector(ax); + std::iota(joints.begin(), joints.end(), 0); + b = iint->getInteractionModes(ax, joints.data(), modes.data()); + CHECK(b); + + for (size_t j = 0; j < ax; j++) + { + modes[j]= yarp::dev::InteractionModeEnum::VOCAB_IM_STIFF; + } + b = iint->setInteractionModes(modes.data()); + CHECK(b); + b = iint->setInteractionModes(ax, joints.data(), modes.data()); + CHECK(b); + } } #endif