Skip to content

Commit

Permalink
Fix URDF in test now that mimic info is read from file
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-bass committed Jul 5, 2024
1 parent d6d863f commit ff29eca
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
1 change: 0 additions & 1 deletion robotiq_driver/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

<!-- Support for gtest and gmock-based tests in the ament buildsystem in CMake. -->
<test_depend>ament_cmake_gmock</test_depend>
<test_depend>ros2_control_test_assets</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
5 changes: 1 addition & 4 deletions robotiq_driver/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
find_package(ament_cmake_gtest REQUIRED)
find_package(ament_cmake_gmock REQUIRED)
find_package(ament_lint_auto REQUIRED)
find_package(ros2_control_test_assets REQUIRED)

ament_lint_auto_find_test_dependencies()

Expand All @@ -21,9 +20,7 @@ target_include_directories(test_robotiq_gripper_hardware_interface
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(test_robotiq_gripper_hardware_interface robotiq_driver)
ament_target_dependencies(test_robotiq_gripper_hardware_interface
ros2_control_test_assets
)
ament_target_dependencies(test_robotiq_gripper_hardware_interface)

###############################################################################
# test_default_serial_factory
Expand Down
52 changes: 30 additions & 22 deletions robotiq_driver/tests/test_robotiq_gripper_hardware_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
#include <lifecycle_msgs/msg/state.hpp>
#include <rclcpp_lifecycle/state.hpp>

#include <ros2_control_test_assets/components_urdfs.hpp>
#include <ros2_control_test_assets/descriptions.hpp>

namespace robotiq_driver::test
{

Expand All @@ -54,27 +51,38 @@ namespace robotiq_driver::test
*/
TEST(TestRobotiqGripperHardwareInterface, load_urdf)
{
std::string urdf_control_ =
std::string urdf =
R"(
<ros2_control name="robotiq_driver_ros2_control" type="system">
<hardware>
<plugin>robotiq_driver/RobotiqGripperHardwareInterface</plugin>
<param name="gripper_speed_multiplier">1.0</param>
<param name="gripper_force_multiplier">0.5</param>
<param name="COM_port">/dev/ttyUSB0</param>
<param name="gripper_closed_position">0.7929</param>
</hardware>
<joint name="robotiq_85_left_knuckle_joint">
<command_interface name="position" />
<state_interface name="position">
<param name="initial_value">0.7929</param>
</state_interface>
<state_interface name="velocity"/>
</joint>
</ros2_control>
)";
<?xml version="1.0" encoding="utf-8"?>
<robot name="test_robot">
<link name="robotiq_85_base_link"/>
<link name="robotiq_85_left_knuckle_link"/>
<joint name="robotiq_85_left_knuckle_joint" type="revolute">
<parent link="robotiq_85_base_link" />
<child link="robotiq_85_left_knuckle_link" />
<axis xyz="0 -1 0" />
<origin xyz="0.03060114 0.0 0.05490452" rpy="0 0 0" />
<limit lower="0.0" upper="0.8" velocity="0.5" effort="50" />
</joint>
<ros2_control name="robotiq_driver_ros2_control" type="system">
<hardware>
<plugin>robotiq_driver/RobotiqGripperHardwareInterface</plugin>
<param name="gripper_speed_multiplier">1.0</param>
<param name="gripper_force_multiplier">0.5</param>
<param name="COM_port">/dev/ttyUSB0</param>
<param name="gripper_closed_position">0.7929</param>
</hardware>
<joint name="robotiq_85_left_knuckle_joint">
<command_interface name="position" />
<state_interface name="position">
<param name="initial_value">0.7929</param>
</state_interface>
<state_interface name="velocity"/>
</joint>
</ros2_control>
</robot>
)";

auto urdf = ros2_control_test_assets::urdf_head + urdf_control_ + ros2_control_test_assets::urdf_tail;
hardware_interface::ResourceManager rm(urdf);

// Check interfaces
Expand Down

0 comments on commit ff29eca

Please sign in to comment.