Easy Navigation
Toggle main menu visibility
Loading...
Searching...
No Matches
easynav_controller
include
easynav_controller
VelocitySmoother.hpp
Go to the documentation of this file.
1
// Copyright 2025 Intelligent Robotics Lab
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
17
18
#ifndef EASYNAV_CONTROLLER__VELOCITYSMOOTHER_HPP_
19
#define EASYNAV_CONTROLLER__VELOCITYSMOOTHER_HPP_
20
21
#include "geometry_msgs/msg/twist.hpp"
22
23
#include "easynav_core/RobotLimits.hpp"
24
25
namespace
easynav
26
{
27
37
class
VelocitySmoother
38
{
39
public
:
41
void
set_limits
(
const
RobotLimits & limits) {limits_ = limits;}
42
44
[[nodiscard]]
const
RobotLimits &
get_limits
()
const
{
return
limits_;}
45
50
const
geometry_msgs::msg::Twist &
step
(
const
geometry_msgs::msg::Twist & target,
double
dt);
51
53
void
reset
(
const
geometry_msgs::msg::Twist &
current
= geometry_msgs::msg::Twist());
54
56
[[nodiscard]]
const
geometry_msgs::msg::Twist &
current
()
const
{
return
current_;}
57
59
[[nodiscard]]
bool
reached
(
const
geometry_msgs::msg::Twist & target)
const
;
60
62
[[nodiscard]]
double
time_to_stop
()
const
;
63
64
private
:
65
[[nodiscard]] geometry_msgs::msg::Twist clamp(
const
geometry_msgs::msg::Twist & target)
const
;
66
67
RobotLimits limits_;
68
geometry_msgs::msg::Twist current_;
69
};
70
71
}
// namespace easynav
72
73
#endif
// EASYNAV_CONTROLLER__VELOCITYSMOOTHER_HPP_
easynav::VelocitySmoother
Brings the commanded velocity towards a target within the robot limits.
Definition
VelocitySmoother.hpp:38
easynav::VelocitySmoother::reset
void reset(const geometry_msgs::msg::Twist ¤t=geometry_msgs::msg::Twist())
Makes current the current command, e.g. after a command that bypassed smoothing.
Definition
VelocitySmoother.cpp:73
easynav::VelocitySmoother::get_limits
const RobotLimits & get_limits() const
Limits being enforced.
Definition
VelocitySmoother.hpp:44
easynav::VelocitySmoother::current
const geometry_msgs::msg::Twist & current() const
The current (last) command.
Definition
VelocitySmoother.hpp:56
easynav::VelocitySmoother::set_limits
void set_limits(const RobotLimits &limits)
Sets the limits to enforce.
Definition
VelocitySmoother.hpp:41
easynav::VelocitySmoother::step
const geometry_msgs::msg::Twist & step(const geometry_msgs::msg::Twist &target, double dt)
Next command towards target, dt seconds after the previous one.
Definition
VelocitySmoother.cpp:58
easynav::VelocitySmoother::time_to_stop
double time_to_stop() const
Seconds needed to stop from the current command at the maximum deceleration.
Definition
VelocitySmoother.cpp:91
easynav::VelocitySmoother::reached
bool reached(const geometry_msgs::msg::Twist &target) const
Whether the current command already equals target, clamped to the limits.
Definition
VelocitySmoother.cpp:82
easynav
Definition
CircularBuffer.hpp:24
Generated by
1.18.0