ros2_control - rolling
Loading...
Searching...
No Matches
joint_limits_helpers.hpp
1// Copyright 2024 PAL Robotics S.L.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
16
17#ifndef JOINT_LIMITS__JOINT_LIMITS_HELPERS_HPP_
18#define JOINT_LIMITS__JOINT_LIMITS_HELPERS_HPP_
19
20#include <optional>
21#include <string>
22#include <utility>
23#include "joint_limits/data_structures.hpp"
24#include "joint_limits/joint_limits.hpp"
25
26namespace joint_limits
27{
28namespace internal
29{
30constexpr double POSITION_BOUNDS_TOLERANCE = 0.002;
31}
32
40bool is_limited(double value, double min, double max);
41
50PositionLimits compute_position_limits(
51 const joint_limits::JointLimits & limits, const std::optional<double> & act_vel,
52 const std::optional<double> & act_pos, const std::optional<double> & prev_command_pos, double dt);
53
63VelocityLimits compute_velocity_limits(
64 const std::string & joint_name, const joint_limits::JointLimits & limits,
65 const double & desired_vel, const std::optional<double> & act_pos,
66 const std::optional<double> & prev_command_vel, double dt);
67
76EffortLimits compute_effort_limits(
77 const joint_limits::JointLimits & limits, const std::optional<double> & act_pos,
78 const std::optional<double> & act_vel, double /*dt*/);
79
88AccelerationLimits compute_acceleration_limits(
89 const JointLimits & limits, double desired_acceleration, std::optional<double> actual_velocity);
90
91} // namespace joint_limits
92
93#endif // JOINT_LIMITS__JOINT_LIMITS_HELPERS_HPP_
Definition data_structures.hpp:37
VelocityLimits compute_velocity_limits(const std::string &joint_name, const joint_limits::JointLimits &limits, const double &desired_vel, const std::optional< double > &act_pos, const std::optional< double > &prev_command_vel, double dt)
Computes the velocity limits based on the position and acceleration limits.
Definition joint_limits_helpers.cpp:62
EffortLimits compute_effort_limits(const joint_limits::JointLimits &limits, const std::optional< double > &act_pos, const std::optional< double > &act_vel, double)
Computes the effort limits based on the position and velocity limits.
Definition joint_limits_helpers.cpp:120
bool is_limited(double value, double min, double max)
Checks if a value is limited by the given limits.
Definition joint_limits_helpers.cpp:38
AccelerationLimits compute_acceleration_limits(const JointLimits &limits, double desired_acceleration, std::optional< double > actual_velocity)
Computes the acceleration limits based on the change in velocity and acceleration and deceleration li...
Definition joint_limits_helpers.cpp:153
PositionLimits compute_position_limits(const joint_limits::JointLimits &limits, const std::optional< double > &act_vel, const std::optional< double > &act_pos, const std::optional< double > &prev_command_pos, double dt)
Computes the position limits based on the velocity and acceleration limits.
Definition joint_limits_helpers.cpp:40
Definition joint_limits.hpp:35