Skip to content
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8363bef
Refactor JointSaturationLimiter to use cached vectors for desired and…
sachinkum0009 Jun 22, 2026
c0d7a0d
Add clamp_joint_limits and handle_braking_near_position_limit methods…
sachinkum0009 Jun 23, 2026
167ea8a
Refactor clamp_joint_limits method to improve readability and structu…
sachinkum0009 Jun 23, 2026
11756d0
Refactor JointSaturationLimiter to improve limit tracking and logging…
sachinkum0009 Jun 24, 2026
763310b
Enhance documentation for clamp_joint_limits and handle_braking_near_…
sachinkum0009 Jun 24, 2026
886bb9c
Add jerk limits support to JointSaturationLimiter with corresponding …
sachinkum0009 Jun 24, 2026
e75ee32
Fix typos in test names and update expected results for JointSaturati…
sachinkum0009 Jun 24, 2026
4a9acd5
pre commit fix
sachinkum0009 Jun 24, 2026
3051238
Add tests for jerk limit enforcement in JointSaturationLimiter
sachinkum0009 Jun 24, 2026
7f2ecf9
Refactor parameter passing for current_joint_velocities to use const …
sachinkum0009 Jun 26, 2026
54a9c5c
Add warning for implicit velocity violations and re-clamp velocity af…
sachinkum0009 Jun 26, 2026
2ac2b0f
Add test for velocity re-clamping when acceleration limits are exceeded
sachinkum0009 Jun 26, 2026
d3fccd6
test added for pos and acc when jerk exceeds
sachinkum0009 Jun 27, 2026
9653d5b
Merge branch 'master' into feat/jtc-jerk-limits
sachinkum0009 Jun 29, 2026
cc204f6
Refine joint saturation limiting with post-jerk checks
sachinkum0009 Jun 29, 2026
98f03d1
Refine joint saturation velocity clamping
sachinkum0009 Jul 1, 2026
b53bf25
Merge branch 'master' into feat/jtc-jerk-limits
sachinkum0009 Jul 3, 2026
bf25ba0
Refactor joint limit clamping logic
sachinkum0009 Jul 3, 2026
57c1353
Refactor joint velocity clamping logic
sachinkum0009 Jul 3, 2026
3a5d31e
Add current velocity check to saturation limiter
sachinkum0009 Jul 3, 2026
b61a15a
Refactor: Use const for stopping duration calculation
sachinkum0009 Jul 4, 2026
cb7e3f0
Refactor: Simplify joint position and velocity clamping logic
sachinkum0009 Jul 4, 2026
89d71c5
Add safety checks for joint position and velocity limits
sachinkum0009 Jul 6, 2026
f96151e
Merge branch 'master' into feat/jtc-jerk-limits
sachinkum0009 Jul 7, 2026
735a1f2
Merge branch 'master' into feat/jtc-jerk-limits
sachinkum0009 Jul 13, 2026
b6442a6
Merge branch 'master' into feat/jtc-jerk-limits
sachinkum0009 Jul 17, 2026
947bac0
Clamp for final position added when handle brake
sachinkum0009 Jul 19, 2026
ee8960b
Merge branch 'master' into feat/jtc-jerk-limits
sachinkum0009 Jul 20, 2026
4334f2d
Merge branch 'master' into feat/jtc-jerk-limits
sachinkum0009 Jul 23, 2026
b2c4751
todo added
sachinkum0009 Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions joint_limits/include/joint_limits/data_structures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ DEFINE_LIMIT_STRUCT(PositionLimits)
DEFINE_LIMIT_STRUCT(VelocityLimits)
DEFINE_LIMIT_STRUCT(EffortLimits)
DEFINE_LIMIT_STRUCT(AccelerationLimits)
DEFINE_LIMIT_STRUCT(JerkLimits)

struct JointControlInterfacesData
{
Expand Down
65 changes: 65 additions & 0 deletions joint_limits/include/joint_limits/joint_saturation_limiter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ class JointSaturationLimiter : public JointLimiterInterface<JointLimitsStateData
bool on_configure(const JointLimitsStateDataType & current_joint_states) override
{
prev_command_ = current_joint_states;
const size_t num_joints = this->number_of_joints_;

desired_pos_.assign(num_joints, 0.0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very good catch! I would like to see this in a separate PR, as this seems to be merged very fast.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate PR created for this.

desired_vel_.assign(num_joints, 0.0);
desired_acc_.assign(num_joints, 0.0);
expected_pos_.assign(num_joints, 0.0);
expected_vel_.assign(num_joints, 0.0);

pos_limit_hit_.assign(num_joints, false);
vel_limit_hit_.assign(num_joints, false);
acc_limit_hit_.assign(num_joints, false);
dec_limit_hit_.assign(num_joints, false);
jerk_limit_hit_.assign(num_joints, false);
return true;
}

Expand Down Expand Up @@ -91,6 +104,42 @@ class JointSaturationLimiter : public JointLimiterInterface<JointLimitsStateData
rclcpp::Clock::SharedPtr clock_;
JointLimitsStateDataType prev_command_;
std::mutex mutex_;

private:
// Cached vectors to eliminate dynamic memory allocation (malloc) in the real-time execution loop

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saikishor is this true that we had the memory allocations previously? Can this be?

std::vector<double> desired_pos_;
std::vector<double> desired_vel_;
std::vector<double> desired_acc_;
std::vector<double> expected_vel_;
std::vector<double> expected_pos_;

// Pre-allocation boolean flags for tracking limits
std::vector<bool> pos_limit_hit_;
std::vector<bool> vel_limit_hit_;
std::vector<bool> acc_limit_hit_;
std::vector<bool> dec_limit_hit_;
std::vector<bool> jerk_limit_hit_;

/**
* @brief
* Clamps the joint limits
*/
void clamp_joint_limits(
const bool has_desired_position, const bool has_desired_velocity,
const bool has_desired_acceleration, const bool has_current_velocity,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be part of the restructuring. I would like to see this in a separate PR. This is hard to figure out what is important and why.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate PR created for restructuring.

const trajectory_msgs::msg::JointTrajectoryPoint & current_joint_states,
trajectory_msgs::msg::JointTrajectoryPoint & desired_joint_states, bool & limits_enforced,
const std::vector<double> & current_joint_velocities,
bool & braking_near_position_limit_triggered, const double dt_seconds);

/**
* @brief
* Handles the braking near position limit
*/
void handle_braking_near_position_limit(
const std::vector<double> & current_joint_velocities, double dt_seconds,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why only "position" and "velocity" input?

bool has_desired_position, bool has_desired_velocity,
const trajectory_msgs::msg::JointTrajectoryPoint & current_joint_states);
};

template <typename JointLimitsStateDataType>
Expand All @@ -114,6 +163,22 @@ bool JointSaturationLimiter<JointLimitsStateDataType>::on_init()
template <>
bool JointSaturationLimiter<JointControlInterfacesData>::on_init();

template <>
void JointSaturationLimiter<trajectory_msgs::msg::JointTrajectoryPoint>::clamp_joint_limits(
const bool has_desired_position, const bool has_desired_velocity,
const bool has_desired_acceleration, const bool has_current_velocity,
const trajectory_msgs::msg::JointTrajectoryPoint & current_joint_states,
trajectory_msgs::msg::JointTrajectoryPoint & desired_joint_states, bool & limits_enforced,
const std::vector<double> & current_joint_velocities,
bool & braking_near_position_limit_triggered, const double dt_seconds);

template <>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is template for what exactly?

void JointSaturationLimiter<trajectory_msgs::msg::JointTrajectoryPoint>::
handle_braking_near_position_limit(
const std::vector<double> & current_joint_velocities, double dt_seconds,
bool has_desired_position, bool has_desired_velocity,
const trajectory_msgs::msg::JointTrajectoryPoint & current_joint_states);

} // namespace joint_limits

#endif // JOINT_LIMITS__JOINT_SATURATION_LIMITER_HPP_
Loading
Loading