Program Listing for File smooth_control_law.hpp
↰ Return to documentation for file (include/nav2_graceful_controller/smooth_control_law.hpp
)
// Copyright (c) 2023 Alberto J. Tudela Roldán
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef NAV2_GRACEFUL_CONTROLLER__SMOOTH_CONTROL_LAW_HPP_
#define NAV2_GRACEFUL_CONTROLLER__SMOOTH_CONTROL_LAW_HPP_
#include <algorithm>
#include <string>
#include "geometry_msgs/msg/pose.hpp"
#include "geometry_msgs/msg/twist.hpp"
namespace nav2_graceful_controller
{
class SmoothControlLaw
{
public:
SmoothControlLaw(
double k_phi, double k_delta, double beta, double lambda, double slowdown_radius,
double v_linear_min, double v_linear_max, double v_angular_max);
~SmoothControlLaw() = default;
void setCurvatureConstants(
const double k_phi, const double k_delta, const double beta, const double lambda);
void setSlowdownRadius(const double slowdown_radius);
void setSpeedLimit(
const double v_linear_min, const double v_linear_max, const double v_angular_max);
geometry_msgs::msg::Twist calculateRegularVelocity(
const geometry_msgs::msg::Pose & target,
const geometry_msgs::msg::Pose & current,
const bool & backward = false);
geometry_msgs::msg::Twist calculateRegularVelocity(
const geometry_msgs::msg::Pose & target, const bool & backward = false);
geometry_msgs::msg::Pose calculateNextPose(
const double dt,
const geometry_msgs::msg::Pose & target,
const geometry_msgs::msg::Pose & current,
const bool & backward = false);
protected:
double calculateCurvature(double r, double phi, double delta);
double k_phi_;
double k_delta_;
double beta_;
double lambda_;
double slowdown_radius_;
double v_linear_min_;
double v_linear_max_;
double v_angular_max_;
};
} // namespace nav2_graceful_controller
#endif // NAV2_GRACEFUL_CONTROLLER__SMOOTH_CONTROL_LAW_HPP_