Skip to content
Open
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(backward_ros REQUIRED)
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
find_package(${Dependency} REQUIRED)
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Video explanation of its implemntation and how to use can be found [here](https://youtu.be/iEiZje8imeU?si=3jsBkv6SsXmHkQpW).
Video explanation of its implementation and how to use can be found [here](https://youtu.be/iEiZje8imeU?si=3jsBkv6SsXmHkQpW).
# ModbusHardwareInterface
If you not familiar with `ros2_control.xacro` check the [section at the end](#mini-urdf-and-xacro-introduction).
## Using ModbusHardwareInterface in ros2_control.xacro
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>pkg-config</buildtool_depend>

<depend>backward_ros</depend>
<depend>hardware_interface</depend>
<depend>libmodbus-dev</depend>
<depend>pluginlib</depend>
Expand Down
12 changes: 11 additions & 1 deletion test/test_modbus_hardware_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@

#include <string>

#include "rclcpp/rclcpp.hpp"

#include "hardware_interface/resource_manager.hpp"
#include "ros2_control_test_assets/components_urdfs.hpp"
#include "ros2_control_test_assets/descriptions.hpp"

class TestModbusHardwareInterface : public ::testing::Test
{
protected:
static void SetUpTestCase() { rclcpp::init(0, nullptr); }

static void TearDownTestCase() { rclcpp::shutdown(); }

void SetUp() override
{
// TODO(anyone): Extend this description to your robot
Expand Down Expand Up @@ -66,11 +72,15 @@ class TestModbusHardwareInterface : public ::testing::Test
)";
}
std::string valid_modbus_hardware;

rclcpp::Node::SharedPtr rm_node = std::make_shared<rclcpp::Node>("ResourceManager");
};

TEST_F(TestModbusHardwareInterface, load_modbus_hardware_interface_2dof)
{
auto urdf = ros2_control_test_assets::urdf_head + valid_modbus_hardware +
ros2_control_test_assets::urdf_tail;
ASSERT_NO_THROW(hardware_interface::ResourceManager rm(urdf));

ASSERT_NO_THROW(hardware_interface::ResourceManager rm(
urdf, rm_node->get_node_clock_interface(), rm_node->get_node_logging_interface()));
}