Skip to content

Commit

Permalink
moved damped least squares to lbr_fri_ros2
Browse files Browse the repository at this point in the history
  • Loading branch information
mhubii committed Dec 6, 2023
1 parent c67182d commit 30a3ef2
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
3 changes: 0 additions & 3 deletions lbr_demos/lbr_demos_fri_ros2_advanced_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(fri_vendor REQUIRED)
find_package(FRIClient REQUIRED)
find_package(kdl_parser REQUIRED)
Expand All @@ -34,7 +32,6 @@ target_include_directories(admittance_control_component

ament_target_dependencies(
admittance_control_component
Eigen3
kdl_parser
lbr_fri_ros2
lbr_fri_msgs
Expand Down
2 changes: 0 additions & 2 deletions lbr_demos/lbr_demos_fri_ros2_advanced_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>eigen3_cmake_module</buildtool_depend>

<exec_depend>lbr_description</exec_depend>

<depend>eigen</depend>
<depend>fri_vendor</depend>
<depend>kdl_parser</depend>
<depend>lbr_fri_ros2</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "lbr_fri_ros2/app.hpp"

#include "admittance_controller.hpp"
#include "damped_least_squares.hpp"

namespace lbr_fri_ros2 {
class AdmittanceControlNode : public rclcpp::Node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

#include "lbr_fri_msgs/msg/lbr_position_command.hpp"
#include "lbr_fri_msgs/msg/lbr_state.hpp"

#include "damped_least_squares.hpp"
#include "lbr_fri_ros2/damped_least_squares.hpp"

namespace lbr_fri_ros2 {
class AdmittanceController {
Expand Down
5 changes: 5 additions & 0 deletions lbr_fri_ros2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ endif()
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(control_toolbox REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3)
find_package(fri_vendor REQUIRED)
find_package(FRIClient REQUIRED)
find_package(lbr_fri_msgs REQUIRED)
Expand Down Expand Up @@ -40,6 +42,7 @@ target_include_directories(lbr_fri_ros2

ament_target_dependencies(lbr_fri_ros2
control_toolbox
Eigen3
lbr_fri_msgs
rclcpp
realtime_tools
Expand All @@ -53,6 +56,8 @@ target_link_libraries(lbr_fri_ros2
ament_export_targets(lbr_fri_ros2_export HAS_LIBRARY_TARGET)
ament_export_dependencies(
control_toolbox
eigen3_cmake_module
Eigen3
fri_vendor
FRIClient
lbr_fri_msgs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef LBR_DEMOS_FRI_ROS2_ADVANCED_CPP__DAMPED_LEAST_SQUARES_HPP_
#define LBR_DEMOS_FRI_ROS2_ADVANCED_CPP__DAMPED_LEAST_SQUARES_HPP_
#ifndef LBR_FRI_ROS2__DAMPED_LEAST_SQUARES_HPP_
#define LBR_FRI_ROS2__DAMPED_LEAST_SQUARES_HPP_

#include <Eigen/Core>
#include <Eigen/SVD>

namespace lbr_fri_ros2 {
template <class MatT>
Eigen::Matrix<typename MatT::Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime>
damped_least_squares(const MatT &mat, typename MatT::Scalar lambda =
Expand All @@ -21,4 +22,5 @@ damped_least_squares(const MatT &mat, typename MatT::Scalar lambda =
}
return svd.matrixV() * dampedSingularValuesInv * svd.matrixU().adjoint();
}
#endif // LBR_DEMOS_FRI_ROS2_ADVANCED_CPP__DAMPED_LEAST_SQUARES_HPP_
} // end of namespace lbr_fri_ros2
#endif // LBR_FRI_ROS2__DAMPED_LEAST_SQUARES_HPP_
6 changes: 6 additions & 0 deletions lbr_fri_ros2/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>
<buildtool_depend>eigen3_cmake_module</buildtool_depend>

<build_depend>eigen</build_depend>

<depend>control_toolbox</depend>
<depend>fri_vendor</depend>
Expand All @@ -21,6 +24,9 @@

<exec_depend>lbr_description</exec_depend>

<buildtool_export_depend>eigen3_cmake_module</buildtool_export_depend>
<build_export_depend>eigen</build_export_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Expand Down

0 comments on commit 30a3ef2

Please sign in to comment.