Can't find TestActuatorHardware in `ros2_control` tests.
I'm trying to develop my own ros2_control
controller.
I'm starting here
https://control.ros.org/master/doc/ros2_controllers/doc/writing_new_controller.html
and then more or less following along with admittance_controller
here, using PickNik's generate_parameter_library
to update to the new approaches in ros2_controllers
.
I believe I have a skeleton implementation and all the required methods filled in, and I'm trying to run a controller load test, but my test can't find TestActuatorHardware
:
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestLoadMyCustomController
[ RUN ] TestLoadMyCustomController.load_controller
[INFO] [1666914636.756125863] [resource_manager]: Loading hardware 'TestActuatorHardware'
unknown file: Failure
C++ exception with description "According to the loaded plugin descriptions the class test_actuator
with base class type hardware_interface::ActuatorInterface does not exist.
Declared types are robotiq_driver/RobotiqGripperHardwareInterface" thrown in the test body.
[ FAILED ] TestLoadMyCustomController.load_controller (1 ms)
[----------] 1 test from TestLoadMyCustomController (1 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestLoadMyCustomController.load_controller
1 FAILED TEST
I do not yet have a minimal reproduction. That's probably the next step so I can simply share the whole thing, but if someone can save me the effort and knows what's happening here, it would be appreciated.
It seems to me like the test is just not finding many ros2_control
controller plugins. Sometimes the list is blank, and there should be a lot more exported controllers available in my installation.
Asked by danzimmerman on 2022-10-27 19:00:22 UTC
Answers
This looks like perhaps it's just a problem not being up-to-date with ros2_control
but cribbing from a bleeding-edge test in admittance_controller
.
I started a new virtual env and installed a bunch of ros2_control
-related packages from source, and now my test passes:
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestLoadDzMinimalController
[ RUN ] TestLoadDzMinimalController.load_controller
[INFO] [1668053588.268818404] [resource_manager]: Loading hardware 'TestActuatorHardware'
[INFO] [1668053588.269133031] [resource_manager]: Initialize hardware 'TestActuatorHardware'
[INFO] [1668053588.269149398] [resource_manager]: Successful initialization of hardware 'TestActuatorHardware'
[INFO] [1668053588.269161442] [resource_manager]: Loading hardware 'TestSensorHardware'
[INFO] [1668053588.269218916] [resource_manager]: Initialize hardware 'TestSensorHardware'
[INFO] [1668053588.269227868] [resource_manager]: Successful initialization of hardware 'TestSensorHardware'
[INFO] [1668053588.269234006] [resource_manager]: Loading hardware 'TestSystemHardware'
[INFO] [1668053588.269277314] [resource_manager]: Initialize hardware 'TestSystemHardware'
[INFO] [1668053588.269286159] [resource_manager]: Successful initialization of hardware 'TestSystemHardware'
[INFO] [1668053588.282571466] [test_controller_manager]: Loading controller 'load_dz_minimal_controller'
[ OK ] TestLoadDzMinimalController.load_controller (24 ms)
[----------] 1 test from TestLoadDzMinimalController (24 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (24 ms total)
[ PASSED ] 1 test.
Asked by danzimmerman on 2022-11-09 23:18:06 UTC
Comments
(Note on the virtual environment, I'm using Humble installed via Robostack https://robostack.github.io/ and had a mix of binary packages with tag 2.12 and 2.13 from the ros2_control
repo.)
Asked by danzimmerman on 2022-11-09 23:33:25 UTC
Comments
Minimal reproduction here: https://github.com/danzimmerman/dz_minimal_controller
Test result output in the README there.
Asked by danzimmerman on 2022-10-28 18:06:07 UTC
I reduced the differences against the
package.xml
andCMakeLists.txt
ofadmittance_controller
on the branch https://github.com/danzimmerman/dz_minimal_controller/tree/dz/cargo-cult-admittance-cmake so it's easier to look at side-by-side.I started the original package with
ros2 pkg create
which I think was a mistake.Asked by danzimmerman on 2022-10-28 20:00:49 UTC
This seems to be a test issue only. I also had the
PLUGINLIB_CLASS_EXPORT
inside the controller namespace, but fixing that didn't fix thecolcon test
failure.However, now that it's fixed, the controller loads and runs correctly from an ordinary launch file.
Asked by danzimmerman on 2022-11-04 19:56:18 UTC
ros2 launch dz_minimal_controller controller_load.launch.py
from the branchhttps://github.com/danzimmerman/dz_minimal_controller/tree/dz/cargo-cult-admittance-cmake
works.
Asked by danzimmerman on 2022-11-04 19:57:32 UTC