diff --git a/rt_manipulators_lib/CMakeLists.txt b/rt_manipulators_lib/CMakeLists.txt index d3cbbe0..c461d51 100644 --- a/rt_manipulators_lib/CMakeLists.txt +++ b/rt_manipulators_lib/CMakeLists.txt @@ -23,6 +23,7 @@ add_library(${library_name} src/hardware_joints.cpp src/hardware_communicator.cpp src/kinematics.cpp + src/kinematics_ros_utils.cpp src/kinematics_utils.cpp src/config_file_parser.cpp src/dynamixel_x.cpp @@ -64,4 +65,22 @@ install( INCLUDES DESTINATION include ) +if(BUILD_TESTING) + find_package(ament_cmake_gtest) + ament_add_gtest(test_kinematics_ros_utils + ros_test/test_kinematics_ros_utils.cpp) + + target_link_libraries(${test_kinematics_ros_utils} + ${library_name} + ) + target_include_directories(test_kinematics_ros_utils PRIVATE + $ + $) + + install(DIRECTORY + ros_test/urdf + DESTINATION share/${PROJECT_NAME}/ + ) +endif() + ament_package() diff --git a/rt_manipulators_lib/include/kinematics_ros_utils.hpp b/rt_manipulators_lib/include/kinematics_ros_utils.hpp new file mode 100644 index 0000000..355f76c --- /dev/null +++ b/rt_manipulators_lib/include/kinematics_ros_utils.hpp @@ -0,0 +1,28 @@ +// Copyright 2023 RT Corporation +// +// 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. + +#ifndef RT_MANIPULATORS_LIB_INCLUDE_KINEMATICS_ROS_UTILS_HPP_ +#define RT_MANIPULATORS_LIB_INCLUDE_KINEMATICS_ROS_UTILS_HPP_ + +#include + +#include "kinematics_utils.hpp" + +namespace kinematics_ros_utils { + +kinematics_utils::links_t parse_urdf_file(const std::string & path); + +} // kinematics_ros_utils + +#endif // RT_MANIPULATORS_LIB_INCLUDE_KINEMATICS_ROS_UTILS_HPP_ diff --git a/rt_manipulators_lib/ros_test/test_kinematics_ros_utils.cpp b/rt_manipulators_lib/ros_test/test_kinematics_ros_utils.cpp new file mode 100644 index 0000000..3ee6646 --- /dev/null +++ b/rt_manipulators_lib/ros_test/test_kinematics_ros_utils.cpp @@ -0,0 +1,34 @@ +// Copyright 2023 RT Corporation +// +// 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 +#include + +#include "gtest/gtest.h" +#include "rt_manipulators_cpp/link.hpp" + +class KinematicsROSUtilsFixture: public ::testing::Test { + protected: + virtual void SetUp() { + } + + virtual void TearDown() { + } + + std::vector links; +}; + +TEST_F(KinematicsROSUtilsFixture, load_link_names) { + EXPECT_EQ("test_base", "test_base"); +} diff --git a/rt_manipulators_lib/ros_test/urdf/test_robot.urdf b/rt_manipulators_lib/ros_test/urdf/test_robot.urdf new file mode 100644 index 0000000..0fc2b5f --- /dev/null +++ b/rt_manipulators_lib/ros_test/urdf/test_robot.urdf @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rt_manipulators_lib/ros_test/urdf/test_robot.xacro b/rt_manipulators_lib/ros_test/urdf/test_robot.xacro new file mode 100644 index 0000000..15f1bc8 --- /dev/null +++ b/rt_manipulators_lib/ros_test/urdf/test_robot.xacro @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rt_manipulators_lib/src/kinematics_ros_utils.cpp b/rt_manipulators_lib/src/kinematics_ros_utils.cpp new file mode 100644 index 0000000..6329ed9 --- /dev/null +++ b/rt_manipulators_lib/src/kinematics_ros_utils.cpp @@ -0,0 +1,24 @@ +// Copyright 2023 RT Corporation +// +// 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 "kinematics_ros_utils.hpp" + +namespace kinematics_ros_utils { + +kinematics_utils::links_t parse_urdf_file(const std::string & path) { + std::vector links; + return links; +} + +} // kinematics_ros_utils