-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic test for YarpRobotLoggerDevice #862
Conversation
There is CI failure:
I guess the problem is to put all |
Argh, that cleanup went out of hand, I will probably cleanup the PR in the next days. |
Fixed and rebased, CI should be happy. |
Thank you!! This was an important missing point! |
A few jobs fail, I will check them when I have a laptop. |
std::string toString(const matioCpp::VariableType& type) | ||
{ | ||
switch(type) | ||
{ | ||
case matioCpp::VariableType::Element: | ||
return "Element"; | ||
case matioCpp::VariableType::Vector: | ||
return "Vector"; | ||
case matioCpp::VariableType::MultiDimensionalArray: | ||
return "MultiDimensionalArray"; | ||
case matioCpp::VariableType::Struct: | ||
return "Struct"; | ||
case matioCpp::VariableType::CellArray: | ||
return "CellArray"; | ||
case matioCpp::VariableType::StructArray: | ||
return "StructArray"; | ||
case matioCpp::VariableType::Unsupported: | ||
return "Unsupported"; | ||
default: | ||
return "Unknown VariableType"; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be used. In any case, what was the use case here? I may also add it to matioCpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, debugging leftover. Yes, I can add some helped in matio-cpp from my first time experience.
devices/YarpRobotLoggerDevice/tests/YarpRobotLoggerDeviceTest.cpp
Outdated
Show resolved
Hide resolved
Windows build is failing with:
|
Ubuntu 20.04 ci is failing with:
|
Probably fixed by @S-Dafarra suggestion in #862 (comment) . |
std::string envVarListSeparator = ":"; | ||
#define blf_putenv putenv | ||
#endif | ||
std::string original_yarp_data_dirs = getenv("YARP_DATA_DIRS"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the problem is here. It returns a nullptr if the env variable is not found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
devices/YarpRobotLoggerDevice/tests/YarpRobotLoggerDeviceTest.cpp
Outdated
Show resolved
Hide resolved
Ok, all the failures are in the non-conda case, as in that case |
I replicated the failure locally by unsetting
|
This was fixed in 7931de9 . |
Last failure:
We need to modify the logic to account for the different location of the |
The name of the file looks weird. Maybe the issue is in https://github.com/robotology/robometry/blob/bb2ea36c90141b9a6ac2be903619786734f95a52/src/librobometry/src/BufferManager.cpp#L325 which converts the format specified in bipedal-locomotion-framework/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp Line 515 in 08513da
|
Nevermind, I guess it was just a copy paste issue 😂 |
There are some failures on valgrind also, but they are probably related to YARP:
|
I had the same failure on conda-forge, I solved de-vendoring catch2, but I guess also updating the FetchContent's catch2 should solve the problem. |
Hi @traversaro could you please rebase it on top of master? |
Sorry, I missed this comment, I guess you merged yourself? |
yes don't worry :) |
Unfortunately the CI fails with
|
I think the test passes fine, see:
That error message is due to some code that access directly the server without respecting the The test fails to a leak in
|
There is still a macos error:
but this is a conda-forge problem tracked in conda-forge/idyntree-feedstock#105 . |
Cool, now a totally unrelated test is failing with a leak, probably due to tbb.
|
Discussing with @GiulioRomualdi, it turns out that the
YarpRobotLoggerDevice
is an important and critical piece of software, that has almost zero test coverage, making it complex to make (or review) any change to it.As an initial (and by far non complete) solution for this, in this PR I add a basic test for the
YarpRobotLoggerDevice
, that logs the encoders and the imu of a fake robot, and check that the value saved in the .mat files are indeed correct.In the future, the test can be made more complex to test more functionality of the
YarpRobotLoggerDevice
(log of YARP ports, textual logging), but I guess we can start simple.For what regards the technicalities, this has been implemented with this key ideas:
yarpserver
to run thanks to the use ofyarp::os::NetworkBase::setLocalMode(true)
libYARP_robotinterface
library, that permits to do from C++ what typically is done by launching theyarprobotinterface
from the command line. In this way, we can start and stop the yarprobotinterface automatically, and also access all the devices that the yarprobotinterface spawns.fakeMotionControl
andfakeIMU
devices have been used to build a "virtual" robot with 4 joints and 1 imu. In the future we could even run a robot in Gazebo with the same technique (see Write the code that extracts a list of devices from a given simulation instance from gzyarp::Handler and pass it to BipedalLocomotion::RobotInterface::YarpRobotControl::setDriver() and BipedalLocomotion::RobotInterface::YarpSensorBridge::setDriversList robotology/gz-sim-yarp-plugins#149), but for this specific test there was no need for a fully fledged simulation of the robot.cc @nicktrem @xela-95 that could be interested to this PR as well.