Skip to content
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

Ensure instantiation of hardware classes work for python bindings #1058

Merged
merged 4 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hardware_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ if(BUILD_TESTING)
target_include_directories(test_macros PRIVATE include)
ament_target_dependencies(test_macros rcpputils)

ament_add_gmock(test_inst_hardwares test/test_inst_hardwares.cpp)
target_link_libraries(test_inst_hardwares hardware_interface)
ament_target_dependencies(test_inst_hardwares rcpputils)

ament_add_gmock(test_joint_handle test/test_handle.cpp)
target_link_libraries(test_joint_handle hardware_interface)
ament_target_dependencies(test_joint_handle rcpputils)
Expand Down
2 changes: 2 additions & 0 deletions hardware_interface/include/hardware_interface/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class SystemInterface;
class System final
{
public:
System() = default;

HARDWARE_INTERFACE_PUBLIC
explicit System(std::unique_ptr<SystemInterface> impl);

Expand Down
34 changes: 34 additions & 0 deletions hardware_interface/test/test_inst_hardwares.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2023 LAAS CNRS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <gmock/gmock.h>

#include "hardware_interface/actuator.hpp"
#include "hardware_interface/actuator_interface.hpp"
#include "hardware_interface/sensor.hpp"
#include "hardware_interface/sensor_interface.hpp"
#include "hardware_interface/system.hpp"
#include "hardware_interface/system_interface.hpp"

class TestInstantiationHardwares : public ::testing::Test
{
protected:
static void SetUpTestCase() {}
};

TEST_F(TestInstantiationHardwares, build_actuator) { hardware_interface::Actuator anActuator; }

TEST_F(TestInstantiationHardwares, build_sensor) { hardware_interface::Sensor aSensor; }

TEST_F(TestInstantiationHardwares, build_system) { hardware_interface::System aSystem; }