Skip to content
Open
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions control_toolbox/include/control_toolbox/rate_limiter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,19 @@ void RateLimiter<T>::set_params(
}
if (has_first_derivative_limits_)
{
bool asym_given =
!std::isnan(min_first_derivative_pos) ||
!std::isnan(max_first_derivative_neg);
if (std::isnan(max_first_derivative_neg_))
{
max_first_derivative_neg_ = max_first_derivative_pos_;
max_first_derivative_neg_ = -max_first_derivative_pos_;
}
if (std::isnan(min_first_derivative_pos_))
{
min_first_derivative_pos_ = min_first_derivative_neg_;
min_first_derivative_pos_ = -min_first_derivative_neg_;
}
if (has_first_derivative_limits_ && min_first_derivative_pos_ > max_first_derivative_neg_)
if (has_first_derivative_limits_ && asym_given &&
Copy link
Author

Choose a reason for hiding this comment

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

I didn't removed it, instead I patched it.

But I suggest this is redundant. As we already has set the min_first_derivative_pos_ and, max_first_derivative_neg_.

This is just my opinion, and I welcome yours too.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the new criterion is necessary?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (has_first_derivative_limits_ && asym_given &&
if (asym_given &&

Isn't this redundant, too? (L208)

min_first_derivative_pos_ > max_first_derivative_neg_)
{
throw std::invalid_argument("Invalid first derivative limits");
}
Expand Down
Loading