bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
time_scaling.h
Go to the documentation of this file.
1#ifndef BITSIM_TRAJECTORY_TIME_SCALING_H
2#define BITSIM_TRAJECTORY_TIME_SCALING_H
3
5
6#include <memory>
7#include <vector>
8
9namespace bitsim
10{
11namespace trajectory
12{
13
24{
25 public:
26 virtual ~TimeScaling() = default;
27
31 real_t duration() const noexcept { return T_; }
32
36 virtual real_t s(real_t t) const = 0;
37
41 virtual real_t ds(real_t t) const = 0;
42
46 virtual real_t dds(real_t t) const = 0;
47
48 protected:
49 explicit TimeScaling(real_t duration);
50
51 // t clamped to [0, T]
52 real_t clamp_(real_t t) const noexcept;
53
55};
56
66{
67 public:
69
70 real_t s(real_t t) const override;
71 real_t ds(real_t t) const override;
72 real_t dds(real_t t) const override;
73};
74
84{
85 public:
87
88 real_t s(real_t t) const override;
89 real_t ds(real_t t) const override;
90 real_t dds(real_t t) const override;
91};
92
104{
105 public:
111
117
118 real_t s(real_t t) const override;
119 real_t ds(real_t t) const override;
120 real_t dds(real_t t) const override;
121
122 real_t cruise_speed() const noexcept { return v_; }
123 real_t acceleration() const noexcept { return a_; }
124 real_t accel_time() const noexcept { return ta_; }
125
126 private:
127 real_t v_;
128 real_t a_;
129 real_t ta_;
130};
131
138{
139 public:
140 PointToPoint(std::vector<real_t> start, std::vector<real_t> end,
141 std::shared_ptr<const TimeScaling> timing);
142
143 std::vector<real_t> position(real_t t) const;
144 std::vector<real_t> velocity(real_t t) const;
145 std::vector<real_t> acceleration(real_t t) const;
146
147 real_t duration() const noexcept { return timing_->duration(); }
148 const TimeScaling &timing() const noexcept { return *timing_; }
149
150 private:
151 std::vector<real_t> start_;
152 std::vector<real_t> delta_;
153 std::shared_ptr<const TimeScaling> timing_;
154};
155
156} // namespace trajectory
157} // namespace bitsim
158
159#endif // BITSIM_TRAJECTORY_TIME_SCALING_H
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
CubicTimeScaling(real_t duration)
Definition time_scaling.h:68
real_t dds(real_t t) const override
[1/s^2]
Definition time_scaling.cpp:41
real_t ds(real_t t) const override
[1/s]
Definition time_scaling.cpp:31
real_t s(real_t t) const override
s(t); 0 before the start and 1 after the end
Definition time_scaling.cpp:25
std::vector< real_t > acceleration(real_t t) const
Definition time_scaling.cpp:200
real_t duration() const noexcept
Definition time_scaling.h:147
const TimeScaling & timing() const noexcept
Definition time_scaling.h:148
std::vector< real_t > velocity(real_t t) const
Definition time_scaling.cpp:189
PointToPoint(std::vector< real_t > start, std::vector< real_t > end, std::shared_ptr< const TimeScaling > timing)
Definition time_scaling.cpp:160
std::vector< real_t > position(real_t t) const
Definition time_scaling.cpp:178
real_t dds(real_t t) const override
[1/s^2]
Definition time_scaling.cpp:71
QuinticTimeScaling(real_t duration)
Definition time_scaling.h:86
real_t ds(real_t t) const override
[1/s]
Definition time_scaling.cpp:61
real_t s(real_t t) const override
s(t); 0 before the start and 1 after the end
Definition time_scaling.cpp:55
How fast to go along a path: the share s(t) of the path done at time t, from s(0) = 0 to s(T) = 1,...
Definition time_scaling.h:24
real_t clamp_(real_t t) const noexcept
Definition time_scaling.cpp:19
virtual ~TimeScaling()=default
real_t T_
Definition time_scaling.h:54
TimeScaling(real_t duration)
Definition time_scaling.cpp:11
virtual real_t dds(real_t t) const =0
[1/s^2]
real_t duration() const noexcept
The duration T [s].
Definition time_scaling.h:31
virtual real_t s(real_t t) const =0
s(t); 0 before the start and 1 after the end
virtual real_t ds(real_t t) const =0
[1/s]
real_t dds(real_t t) const override
[1/s^2]
Definition time_scaling.cpp:139
real_t accel_time() const noexcept
Definition time_scaling.h:124
real_t ds(real_t t) const override
[1/s]
Definition time_scaling.cpp:122
real_t s(real_t t) const override
s(t); 0 before the start and 1 after the end
Definition time_scaling.cpp:107
TrapezoidalTimeScaling(real_t duration, real_t cruise_speed)
Definition time_scaling.cpp:85
static TrapezoidalTimeScaling with_accel_share(real_t duration, real_t accel_share)
The trapezoid that takes duration and spends a share of it, accel_share, in each of the speeding up a...
Definition time_scaling.cpp:97
real_t cruise_speed() const noexcept
Definition time_scaling.h:122
real_t acceleration() const noexcept
Definition time_scaling.h:123
Definition line_segment_link.h:11
Definition dc_motor_backend_base.h:9
double real_t
real_t
Definition bitsim_types.h:20