Skip to content

Commit e39eaaf

Browse files
chore: pre-commit options update
1 parent c7997d0 commit e39eaaf

File tree

10 files changed

+1676
-50
lines changed

10 files changed

+1676
-50
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,3 @@ repos:
4949
exit 1
5050
- --
5151

52-
- repo: local
53-
hooks:
54-
- id: ament_cppcheck
55-
name: ament_cppcheck
56-
description: Static code analysis of C/C++ files.
57-
entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck
58-
language: system
59-
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
60-
61-
- repo: local
62-
hooks:
63-
- id: ament_cpplint
64-
name: ament_cpplint
65-
description: Static code analysis of C/C++ files.
66-
entry: ament_cpplint
67-
language: system
68-
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
69-
args: ["--linelength=100", "--filter=-whitespace/newline,-legal/copyright"]
70-
71-
# Cmake hooks
72-
- repo: local
73-
hooks:
74-
- id: ament_lint_cmake
75-
name: ament_lint_cmake
76-
description: Check format of CMakeLists.txt files.
77-
entry: ament_lint_cmake
78-
language: system
79-
files: CMakeLists\.txt$

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.16)
22
project(crisp_controllers)
33

44
find_program(CCACHE_PROGRAM ccache)
@@ -63,8 +63,8 @@ find_package(realtime_tools REQUIRED)
6363
find_package(generate_parameter_library REQUIRED)
6464

6565
generate_parameter_library(
66-
cartesian_impedance_controller_parameters
67-
src/cartesian_impedance_controller.yaml
66+
cartesian_controller_parameters
67+
src/cartesian_controller.yaml
6868
)
6969

7070
generate_parameter_library(
@@ -112,7 +112,7 @@ endif()
112112
# Link parameter libraries to the main library
113113
target_link_libraries(${PROJECT_NAME}
114114
PRIVATE
115-
cartesian_impedance_controller_parameters
115+
cartesian_controller_parameters
116116
pose_broadcaster_parameters
117117
torque_feedback_controller_parameters
118118
twist_broadcaster_parameters

include/crisp_controllers/cartesian_controller.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@
1818
#include <pinocchio/multibody/fwd.hpp>
1919
#include <rclcpp/rclcpp.hpp>
2020

21-
#include <cartesian_impedance_controller_parameters.hpp>
21+
#include <crisp_controllers/utils/ros2_version.hpp>
22+
23+
#if ROS2_VERSION_ABOVE_HUMBLE
24+
#include <crisp_controllers/cartesian_controller_parameters.hpp>
25+
#else
26+
#include <cartesian_controller_parameters.hpp>
27+
#endif
28+
2229
#include <sensor_msgs/msg/joint_state.hpp>
2330
#include "realtime_tools/realtime_buffer.hpp"
2431

@@ -147,9 +154,9 @@ class CartesianController : public controller_interface::ControllerInterface {
147154
Eigen::Quaterniond desired_orientation_;
148155

149156
/** @brief Parameter listener for dynamic parameter updates */
150-
std::shared_ptr<cartesian_impedance_controller::ParamListener> params_listener_;
157+
std::shared_ptr<cartesian_controller::ParamListener> params_listener_;
151158
/** @brief Current parameter values */
152-
cartesian_impedance_controller::Params params_;
159+
cartesian_controller::Params params_;
153160

154161
/** @brief Frame ID of the end effector in the robot model */
155162
int end_effector_frame_id;

include/crisp_controllers/pose_broadcaster.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
#include <Eigen/Dense> // NOLINT(build/include_order)
88

99
#include <controller_interface/controller_interface.hpp>
10+
#include <crisp_controllers/utils/ros2_version.hpp>
11+
12+
#if ROS2_VERSION_ABOVE_HUMBLE
1013
#include <crisp_controllers/pose_broadcaster_parameters.hpp>
14+
#else
15+
#include <pose_broadcaster_parameters.hpp>
16+
#endif
17+
1118
#include <geometry_msgs/msg/pose_stamped.hpp>
1219
#include <pinocchio/algorithm/kinematics.hpp>
1320
#include <pinocchio/multibody/fwd.hpp>

include/crisp_controllers/torque_feedback_controller.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
#include <Eigen/Dense> // NOLINT(build/include_order)
88

99
#include <controller_interface/controller_interface.hpp>
10+
#include <crisp_controllers/utils/ros2_version.hpp>
11+
12+
#if ROS2_VERSION_ABOVE_HUMBLE
1013
#include <crisp_controllers/torque_feedback_controller_parameters.hpp>
14+
#else
15+
#include <torque_feedback_controller_parameters.hpp>
16+
#endif
1117
#include <geometry_msgs/msg/wrench_stamped.hpp>
1218
#include <pinocchio/multibody/data.hpp>
1319
#include <pinocchio/multibody/model.hpp>

include/crisp_controllers/twist_broadcaster.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
#include <Eigen/Dense> // NOLINT(build/include_order)
88

99
#include <controller_interface/controller_interface.hpp>
10+
#include <crisp_controllers/utils/ros2_version.hpp>
11+
12+
#if ROS2_VERSION_ABOVE_HUMBLE
1013
#include <crisp_controllers/twist_broadcaster_parameters.hpp>
14+
#else
15+
#include <twist_broadcaster_parameters.hpp>
16+
#endif
17+
1118
#include <geometry_msgs/msg/twist_stamped.hpp>
1219
#include <pinocchio/algorithm/kinematics.hpp>
1320
#include <pinocchio/multibody/fwd.hpp>

pixi.lock

Lines changed: 1602 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ cmake = "*"
1717
pkg-config = "*"
1818
make = "*"
1919
ninja = "*"
20+
pinocchio = ">=3.7.0,<4"
2021
# pinocchio = ">=3.7.0,<4"
2122

2223
[tasks]
24+
clean = "rm -rf build install log"
25+
build = "colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
26+
clean-build = [{ task = "clean" }, { task = "build" }]
27+
source = "source install/setup.sh"
2328

2429
[target.linux.dependencies]
2530
libgl-devel = "*"
@@ -63,3 +68,4 @@ fmt = ">=11.2.0,<12"
6368

6469
[pypi-dependencies]
6570
crisp-controllers = { path = ".", editable = false }
71+
pre-commit = ">=4.5.1, <5"

src/cartesian_controller.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ CartesianController::update(const rclcpp::Time & time, const rclcpp::Duration &
242242
}
243243

244244
CallbackReturn CartesianController::on_init() {
245-
params_listener_ = std::make_shared<cartesian_impedance_controller::ParamListener>(get_node());
245+
params_listener_ = std::make_shared<cartesian_controller::ParamListener>(get_node());
246246
params_listener_->refresh_dynamic_parameters();
247247
params_ = params_listener_->get_params();
248248

@@ -492,11 +492,11 @@ CartesianController::on_activate(const rclcpp_lifecycle::State & /*previous_stat
492492
auto joint_id = model_.getJointId(joint_name); // pinocchio joind id might be different
493493
auto joint = model_.joints[joint_id];
494494

495-
#if ROS2_VERSION_ABOVE_HUMBLE
495+
#if ROS2_VERSION_ABOVE_HUMBLE
496496
q[i] = state_interfaces_[i].get_optional().value_or(q[i]);
497-
#else
497+
#else
498498
q[i] = state_interfaces_[i].get_value();
499-
#endif
499+
#endif
500500
if (joint.shortname() == "JointModelRZ") { // simple revolute joint case
501501
q_pin[joint.idx_q()] = q[i];
502502
} else if (continous_joint_types.count(
@@ -509,13 +509,13 @@ CartesianController::on_activate(const rclcpp_lifecycle::State & /*previous_stat
509509
q_ref[i] = q[i];
510510
q_target[i] = q[i];
511511

512-
#if ROS2_VERSION_ABOVE_HUMBLE
512+
#if ROS2_VERSION_ABOVE_HUMBLE
513513
dq[i] = state_interfaces_[num_joints + i].get_optional().value_or(dq[i]);
514514
dq_ref[i] = dq[i];
515-
#else
515+
#else
516516
dq[i] = state_interfaces_[num_joints + i].get_value();
517517
dq_ref[i] = state_interfaces_[num_joints + i].get_value();
518-
#endif
518+
#endif
519519
}
520520

521521
pinocchio::forwardKinematics(model_, data_, q_pin, dq);
Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cartesian_impedance_controller:
1+
cartesian_controller:
22
joints:
33
type: string_array
44
description: "Names of the joints"
@@ -17,6 +17,13 @@ cartesian_impedance_controller:
1717
default_value: False
1818
description: "Whether we use operational space control or cartesian impedance control"
1919

20+
operational_space_regularization:
21+
type: double
22+
default_value: 0.1
23+
description: "Regularization (damping) for Mx pseudo-inverse. Higher values improve stability near singularities but reduce accuracy. Valid range is 0.001-1.0; typical useful values are in the 0.01-0.5 range."
24+
validation:
25+
bounds<>: [0.001, 1.0]
26+
2027
task:
2128
k_pos_x:
2229
type: double
@@ -243,7 +250,7 @@ cartesian_impedance_controller:
243250
q_ref:
244251
type: double
245252
default_value: 1.0
246-
description: "Amount of smoothing for the target joint when using the EMA."
253+
description: "Amount of smoothing for the target pose when using the EMA."
247254
validation:
248255
bounds<>: [0.0, 1.0]
249256

@@ -264,6 +271,24 @@ cartesian_impedance_controller:
264271
default_value: true
265272
description: "Limit torques"
266273

274+
joint_limit_repulsion:
275+
enabled:
276+
type: bool
277+
default_value: true
278+
description: "Enable joint limit repulsion torques that push joints away from their limits"
279+
safe_range:
280+
type: double
281+
default_value: 0.1
282+
description: "Distance from joint limit where repulsion starts [rad]"
283+
validation:
284+
bounds<>: [0.01, 1.0]
285+
max_torque:
286+
type: double
287+
default_value: 5.0
288+
description: "Maximum repulsion torque at joint limit [Nm]"
289+
validation:
290+
bounds<>: [0.0, 50.0]
291+
267292
max_delta_tau:
268293
type: double
269294
default_value: 0.5

0 commit comments

Comments
 (0)