Easy Navigation
Loading...
Searching...
No Matches
VelocitySmoother Class Reference

Brings the commanded velocity towards a target within the robot limits. More...

#include <VelocitySmoother.hpp>

Public Member Functions

const geometry_msgs::msg::Twist & current () const
 The current (last) command.
const RobotLimits & get_limits () const
 Limits being enforced.
bool reached (const geometry_msgs::msg::Twist &target) const
 Whether the current command already equals target, clamped to the limits.
void reset (const geometry_msgs::msg::Twist &current=geometry_msgs::msg::Twist())
 Makes current the current command, e.g. after a command that bypassed smoothing.
void set_limits (const RobotLimits &limits)
 Sets the limits to enforce.
const geometry_msgs::msg::Twist & step (const geometry_msgs::msg::Twist &target, double dt)
 Next command towards target, dt seconds after the previous one.
double time_to_stop () const
 Seconds needed to stop from the current command at the maximum deceleration.

Detailed Description

Brings the commanded velocity towards a target within the robot limits.

Each step clamps the target to the velocity limits and moves the current command towards it by at most acceleration * dt (speeding up) or deceleration * dt (slowing down), per axis (linear x and y, angular z). A change of direction stops at zero first. So a command never jumps, e.g. from full speed to zero, which would make the robot brake harder than it can.

Member Function Documentation

◆ current()

const geometry_msgs::msg::Twist & current ( ) const
nodiscard

The current (last) command.

◆ get_limits()

const RobotLimits & get_limits ( ) const
nodiscard

Limits being enforced.

◆ reached()

bool reached ( const geometry_msgs::msg::Twist & target) const
nodiscard

Whether the current command already equals target, clamped to the limits.

◆ reset()

void reset ( const geometry_msgs::msg::Twist & current = geometry_msgs::msg::Twist())

Makes current the current command, e.g. after a command that bypassed smoothing.

◆ set_limits()

void set_limits ( const RobotLimits & limits)

Sets the limits to enforce.

◆ 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.

Returns
The new current command.

◆ time_to_stop()

double time_to_stop ( ) const
nodiscard

Seconds needed to stop from the current command at the maximum deceleration.


The documentation for this class was generated from the following files: