Skip to content

Commit 0cfb7f2

Browse files
committed
Revert and cleanup
1 parent 4143d6b commit 0cfb7f2

File tree

13 files changed

+39
-964
lines changed

13 files changed

+39
-964
lines changed

.dockerignore

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
*
44

55
# Except the following
6-
6+
!auv_control_demos
7+
!auv_control_msgs
78
!auv_controllers
8-
!velocity_controllers
9+
!controller_common
10+
!ik_solvers
911
!thruster_allocation_matrix_controller
1012
!thruster_controllers
11-
!auv_control_msgs
12-
!auv_control_demos
13-
!whole_body_controllers
14-
!ik_solvers
15-
!controller_common
1613
!topic_sensors
14+
!velocity_controllers
15+
!whole_body_controllers
1716
!ros2.repos

auv_controllers/package.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
<buildtool_depend>ament_cmake</buildtool_depend>
1818

19-
<exec_depend>thruster_allocation_matrix_controller</exec_depend>
20-
<exec_depend>thruster_controllers</exec_depend>
21-
<exec_depend>velocity_controllers</exec_depend>
2219
<exec_depend>auv_control_msgs</exec_depend>
2320
<exec_depend>controller_common</exec_depend>
21+
<exec_depend>ik_solvers</exec_depend>
22+
<exec_depend>thruster_allocation_matrix_controller</exec_depend>
23+
<exec_depend>thruster_controllers</exec_depend>
2424
<exec_depend>topic_sensors</exec_depend>
25+
<exec_depend>velocity_controllers</exec_depend>
2526
<exec_depend>whole_body_controllers</exec_depend>
26-
<exec_depend>ik_solvers</exec_depend>
2727

2828
<export>
2929
<build_type>ament_cmake</build_type>

ik_solvers/COLCON_IGNORE

Whitespace-only changes.

ik_solvers/include/ik_solvers/task_priority_solver.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Constraint
4747
: primal_(primal),
4848
constraint_(constraint),
4949
priority_(priority),
50-
gain_(gain){};
50+
gain_(gain) {};
5151

5252
/// Destructor.
5353
virtual ~Constraint() = default;

ik_solvers/src/task_priority_solver.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ namespace
172172
/// Compute the nullspace of the Jacobian matrix using the pseudoinverse.
173173
auto compute_nullspace(const Eigen::MatrixXd & augmented_jacobian) -> Eigen::MatrixXd
174174
{
175-
// TODO(evan-palmer): do we need the damping here?
176175
const Eigen::MatrixXd eye = Eigen::MatrixXd::Identity(augmented_jacobian.cols(), augmented_jacobian.cols());
177176
return eye - (augmented_jacobian.completeOrthogonalDecomposition().pseudoInverse() * augmented_jacobian);
178177
}
@@ -189,7 +188,7 @@ auto construct_augmented_jacobian(const std::vector<Eigen::MatrixXd> & jacobians
189188
jacobians.begin(), jacobians.end(), 0, [](int sum, const Eigen::MatrixXd & jac) { return sum + jac.rows(); });
190189

191190
Eigen::MatrixXd augmented_jacobian(n_rows, n_cols);
192-
int current_row = 0;
191+
int current_row = 0; // NOLINT(misc-const-correctness)
193192

194193
for (const auto & jac : jacobians) {
195194
augmented_jacobian.block(current_row, 0, jac.rows(), jac.cols()) = jac;
@@ -228,6 +227,21 @@ auto tpik(const hierarchy::ConstraintSet & tasks, size_t nv, double damping)
228227
return vel;
229228
}
230229

230+
/// Check if the solution is feasible with respect to the set constraints.
231+
auto is_feasible(const hierarchy::ConstraintSet & constraints, const Eigen::VectorXd & solution) -> bool
232+
{
233+
for (const auto & constraint : constraints) {
234+
auto set_task = std::dynamic_pointer_cast<hierarchy::SetConstraint>(constraint);
235+
const double pred = (constraint->jacobian() * solution).value();
236+
237+
if (!((set_task->primal() > set_task->lower_threshold() && pred < 0) ||
238+
(set_task->primal() < set_task->upper_threshold() && pred > 0))) {
239+
return false;
240+
}
241+
}
242+
return true;
243+
}
244+
231245
/// Search for the feasible solutions to the task hierarchy and return the one with the smallest norm.
232246
auto search_solutions(
233247
const hierarchy::ConstraintSet & set_tasks,
@@ -256,23 +270,9 @@ auto search_solutions(
256270
if (!out.has_value()) {
257271
continue;
258272
}
259-
const Eigen::VectorXd & current_solution = out.value();
260273

261-
// Check if the solution violates any set constraints
262-
bool valid = true;
263-
for (const auto & task : set_tasks) {
264-
auto set_task = std::dynamic_pointer_cast<hierarchy::SetConstraint>(task);
265-
const double pred = (task->jacobian() * current_solution).value();
266-
267-
valid = (set_task->primal() > set_task->lower_threshold() && pred < 0) ||
268-
(set_task->primal() < set_task->upper_threshold() && pred > 0);
269-
270-
if (!valid) {
271-
break;
272-
}
273-
}
274-
275-
if (valid) {
274+
const Eigen::VectorXd & current_solution = out.value();
275+
if (is_feasible(set_tasks, current_solution)) {
276276
solutions.push_back(current_solution);
277277
}
278278
}
@@ -309,6 +309,7 @@ auto TaskPriorityIKSolver::initialize(
309309
params_ = param_listener_->get_params();
310310
}
311311

312+
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
312313
auto TaskPriorityIKSolver::update_parameters() -> void
313314
{
314315
if (!param_listener_->is_old(params_)) {

whole_body_controllers/CMakeLists.txt

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,21 @@ include(GNUInstallDirs)
99

1010
# dependencies
1111
set(THIS_PACKAGE_INCLUDE_DEPENDS
12-
controller_common
1312
controller_interface
14-
control_msgs
15-
Eigen3
16-
eigen3_cmake_module
17-
geometry_msgs
1813
hardware_interface
19-
message_transforms
20-
nav_msgs
21-
pinocchio
2214
rclcpp
2315
rclcpp_lifecycle
2416
realtime_tools
17+
nav_msgs
2518
std_msgs
19+
control_msgs
20+
pinocchio
21+
geometry_msgs
2622
tf2_ros
2723
tf2_eigen
28-
trajectory_msgs
24+
message_transforms
25+
controller_common
26+
ik_solvers
2927
)
3028

3129
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
@@ -40,45 +38,6 @@ generate_parameter_library(ik_controller_parameters
4038
src/ik_controller_parameters.yaml
4139
)
4240

43-
generate_parameter_library(task_priority_solver_parameters
44-
src/ik_solvers/task_priority_solver_parameters.yaml
45-
)
46-
47-
# ik base solver library
48-
# this needs to be independent of the plugin library
49-
add_library(solver_base SHARED)
50-
target_sources(
51-
solver_base
52-
PRIVATE src/ik_solvers/solver.cpp
53-
PUBLIC
54-
FILE_SET HEADERS
55-
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
56-
FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/whole_body_controllers/ik_solvers/solver.hpp
57-
)
58-
ament_target_dependencies(solver_base PUBLIC ${THIS_PACKAGE_INCLUDE_DEPENDS})
59-
target_compile_features(solver_base PUBLIC cxx_std_23)
60-
61-
# ik solver plugin library
62-
add_library(ik_solvers SHARED)
63-
target_sources(
64-
ik_solvers
65-
PRIVATE src/ik_solvers/task_priority_solver.cpp
66-
PUBLIC
67-
FILE_SET HEADERS
68-
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
69-
FILES
70-
${CMAKE_CURRENT_SOURCE_DIR}/include/whole_body_controllers/ik_solvers/task_priority_solver.hpp
71-
)
72-
ament_target_dependencies(ik_solvers PUBLIC ${THIS_PACKAGE_INCLUDE_DEPENDS})
73-
target_compile_features(ik_solvers PUBLIC cxx_std_23)
74-
target_link_libraries(
75-
ik_solvers
76-
PUBLIC solver_base task_priority_solver_parameters
77-
)
78-
79-
# the first argument is the name of the package, NOT the target name
80-
pluginlib_export_plugin_description_file(ik_solvers solvers.xml)
81-
8241
add_library(whole_body_controllers SHARED)
8342
target_sources(
8443
whole_body_controllers
@@ -91,11 +50,11 @@ target_sources(
9150
)
9251
ament_target_dependencies(whole_body_controllers PUBLIC ${THIS_PACKAGE_INCLUDE_DEPENDS})
9352
target_compile_features(whole_body_controllers PUBLIC cxx_std_23)
94-
target_link_libraries(whole_body_controllers PUBLIC ik_controller_parameters ik_solvers)
53+
target_link_libraries(whole_body_controllers PUBLIC ik_controller_parameters)
9554
pluginlib_export_plugin_description_file(controller_interface whole_body_controllers.xml)
9655

9756
install(
98-
TARGETS whole_body_controllers ik_controller_parameters solver_base ik_solvers task_priority_solver_parameters
57+
TARGETS whole_body_controllers ik_controller_parameters
9958
EXPORT export_whole_body_controllers
10059
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
10160
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}

whole_body_controllers/duplicate.txt

Lines changed: 0 additions & 68 deletions
This file was deleted.

whole_body_controllers/include/whole_body_controllers/ik_solvers/solver.hpp

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)