diff --git a/hardware_interface/test/test_resource_manager.cpp b/hardware_interface/test/test_resource_manager.cpp index 59257f4edc..ed62bf78a4 100644 --- a/hardware_interface/test/test_resource_manager.cpp +++ b/hardware_interface/test/test_resource_manager.cpp @@ -961,15 +961,15 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) TEST_SYSTEM_HARDWARE_STATE_INTERFACES, TEST_SYSTEM_HARDWARE_COMMAND_INTERFACES, false); } - // When actuator is configured all interfaces become available + // When actuator is configured state interfaces become available configure_components(rm, {TEST_ACTUATOR_HARDWARE_NAME}); { check_interfaces( {"joint1/position"}, - std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); + std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); check_interfaces( {"joint1/max_velocity"}, - std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); + std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); check_interfaces( TEST_SYSTEM_HARDWARE_COMMAND_INTERFACES, std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); @@ -987,9 +987,8 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) // Can claim Actuator's interfaces { - check_interface_claiming({}, {"joint1/position"}, true); - check_interface_claiming( - TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, {"joint1/max_velocity"}, true); + check_interface_claiming({}, {"joint1/position"}, false); + check_interface_claiming(TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, {}, true); check_interface_claiming(TEST_SENSOR_HARDWARE_STATE_INTERFACES, {}, false); check_interface_claiming( TEST_SYSTEM_HARDWARE_STATE_INTERFACES, TEST_SYSTEM_HARDWARE_COMMAND_INTERFACES, false); @@ -1045,8 +1044,7 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) std::bind(&TestableResourceManager::state_interface_exists, &rm, _1), true); } - // When Sensor and System are configured their state- - // and command- interfaces are available + // When Sensor and System are configured their state-interfaces are available configure_components(rm, {TEST_SENSOR_HARDWARE_NAME, TEST_SYSTEM_HARDWARE_NAME}); { check_interfaces( @@ -1054,10 +1052,10 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); check_interfaces( {"joint2/velocity", "joint3/velocity"}, - std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); + std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); check_interfaces( {"joint2/max_acceleration", "configuration/max_tcp_jerk"}, - std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); + std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); check_interfaces( TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, @@ -1073,15 +1071,15 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) // Can claim: // - all Actuator's state interfaces and command interfaces // - sensor's state interfaces - // - system's state and command interfaces + // - system's state interfaces + // Cannot claim: + // - system's command interfaces { check_interface_claiming( TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, TEST_ACTUATOR_HARDWARE_COMMAND_INTERFACES, true); check_interface_claiming(TEST_SENSOR_HARDWARE_STATE_INTERFACES, {}, true); - check_interface_claiming({}, {"joint2/velocity", "joint3/velocity"}, true); - check_interface_claiming( - TEST_SYSTEM_HARDWARE_STATE_INTERFACES, - {"joint2/max_acceleration", "configuration/max_tcp_jerk"}, true); + check_interface_claiming(TEST_SYSTEM_HARDWARE_STATE_INTERFACES, {}, true); + check_interface_claiming({}, {"joint2/velocity", "joint3/velocity"}, false); } // All active - everything available @@ -1122,10 +1120,10 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) { check_interfaces( {"joint1/position"}, - std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); + std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); check_interfaces( {"joint1/max_velocity"}, - std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); + std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); check_interfaces( TEST_SYSTEM_HARDWARE_COMMAND_INTERFACES, std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); @@ -1142,16 +1140,21 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) } // Can claim everything - // - actuator's state and command interfaces + // - actuator's state interfaces // - sensor's state interfaces // - system's state and command interfaces + // Cannot claim: + // - actuator's command interface { - check_interface_claiming({}, {"joint1/position"}, true); - check_interface_claiming( - TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, {"joint1/max_velocity"}, true); + check_interface_claiming(TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, {}, true); check_interface_claiming(TEST_SENSOR_HARDWARE_STATE_INTERFACES, {}, true); check_interface_claiming( TEST_SYSTEM_HARDWARE_STATE_INTERFACES, TEST_SYSTEM_HARDWARE_COMMAND_INTERFACES, true); + check_interface_claiming({}, {"joint1/position"}, false); + //check_interface_claiming( + //TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, {"joint1/max_velocity"}, true); + // TODO(fmauch): Claiming the state interfaces should work but the check function expects both + // to fail. } // When sensor is cleaned up the interfaces are not available anymore @@ -1159,10 +1162,10 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) { check_interfaces( {"joint1/position"}, - std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); + std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); check_interfaces( {"joint1/max_velocity"}, - std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); + std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), false); check_interfaces( TEST_SYSTEM_HARDWARE_COMMAND_INTERFACES, std::bind(&TestableResourceManager::command_interface_is_available, &rm, _1), true); @@ -1178,17 +1181,24 @@ TEST_F(ResourceManagerTest, resource_availability_and_claiming_in_lifecycle) std::bind(&TestableResourceManager::state_interface_is_available, &rm, _1), true); } - // Can claim everything - // - actuator's state and command interfaces - // - no sensor's interface + // Can claim: + // - actuator's state interfaces // - system's state and command interfaces + // Cannot claim: + // - actuator's command interfaces + // - sensor's interface { - check_interface_claiming({}, {"joint1/position"}, true); - check_interface_claiming( - TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, {"joint1/max_velocity"}, true); - check_interface_claiming(TEST_SENSOR_HARDWARE_STATE_INTERFACES, {}, false); + check_interface_claiming(TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, {}, true); check_interface_claiming( TEST_SYSTEM_HARDWARE_STATE_INTERFACES, TEST_SYSTEM_HARDWARE_COMMAND_INTERFACES, true); + + check_interface_claiming(TEST_SENSOR_HARDWARE_STATE_INTERFACES, {}, false); + check_interface_claiming({}, {"joint1/position"}, false); + + //check_interface_claiming( + //TEST_ACTUATOR_HARDWARE_STATE_INTERFACES, {"joint1/max_velocity"}, true); + // TODO(fmauch): Claiming the state interfaces should work but the check function expects both + // to fail. } // Check if all interfaces still exits