Gazebo Math

API Reference

8.0.0~pre1
SpeedLimiter.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17
18#ifndef GZ_MATH_SYSTEMS_SPEEDLIMITER_HH_
19#define GZ_MATH_SYSTEMS_SPEEDLIMITER_HH_
20
21#include <chrono>
22#include <gz/math/config.hh>
23#include "gz/math/Helpers.hh"
24#include <gz/utils/ImplPtr.hh>
25
26namespace gz::math
27{
28 // Inline bracket to help doxygen filtering.
29 inline namespace GZ_MATH_VERSION_NAMESPACE {
32 {
35 public: SpeedLimiter();
36
39 public: void SetMinVelocity(double _lim);
40
43 public: double MinVelocity() const;
44
47 public: void SetMaxVelocity(double _lim);
48
51 public: double MaxVelocity() const;
52
55 public: void SetMinAcceleration(double _lim);
56
59 public: double MinAcceleration() const;
60
63 public: void SetMaxAcceleration(double _lim);
64
67 public: double MaxAcceleration() const;
68
71 public: void SetMinJerk(double _lim);
72
75 public: double MinJerk() const;
76
79 public: void SetMaxJerk(double _lim);
80
83 public: double MaxJerk() const;
84
91 public: double Limit(double &_vel,
92 double _prevVel,
93 double _prevPrevVel,
94 std::chrono::steady_clock::duration _dt) const;
95
99 public: double LimitVelocity(double &_vel) const;
100
107 public: double LimitAcceleration(
108 double &_vel,
109 double _prevVel,
110 std::chrono::steady_clock::duration _dt) const;
111
119 public: double LimitJerk(
120 double &_vel,
121 double _prevVel,
122 double _prevPrevVel,
123 std::chrono::steady_clock::duration _dt) const;
124
126 GZ_UTILS_IMPL_PTR(dataPtr)
127 };
128 } // namespace GZ_MATH_VERSION_NAMESPACE
129} // namespace gz::math
130#endif // GZ_MATH_SYSTEMS_SPEEDLIMITER_HH_