15 constexpr std::size_t dim = 3;
16 constexpr std::size_t n = 1001;
29 const double pi_local = 3.14159265358979323846;
30 const double freq[3] = {2.0 * pi_local, 3.0 * pi_local, 5.0 * pi_local};
31 const double phase[3] = {0.0, 0.3, 0.7};
33 for (std::size_t j = 0; j < s.
size(); ++j)
35 for (std::size_t axis = 0; axis < 3; ++axis)
37 const double x = freq[axis] * s[j] + phase[axis];
38 q(axis, j) = std::sin(x);
39 dq(axis, j) = freq[axis] * std::cos(x);
40 ddq(axis, j) = -freq[axis] * freq[axis] * std::sin(x);
46 std::vector<double> s(n);
47 for (std::size_t k = 0; k < n; ++k)
49 s[k] =
static_cast<double>(k) /
static_cast<double>(n - 1);
52 const std::vector<double> upper(dim, 1.0);
53 const std::vector<double> lower(dim, -1.0);
67 topp2::Problem problem{
75 auto a = topp2::solve(problem);
79 std::cout <<
"TOPP2-RA done.\n";
80 std::cout <<
"dim = " << dim <<
", N = " << n <<
"\n";
81 std::cout <<
"t_final = " << time.t_final <<
" s\n";
82 std::cout <<
"a_profile.len() = " << a.size() <<
"\n";
83 std::cout <<
"s(t) samples = " << s_t.size() <<
"\n";
Mutable column-major matrix view used by callback APIs.
static Path from_evaluator_2nd(std::size_t dim, double s_min, double s_max, PathEvaluator2nd evaluator)
Build a path from a batch evaluator with explicit derivatives up to second order.
Robot facade backed by Rust Robot<CppRobotModel>.
ConstraintsRef constraints() noexcept
Return a borrowed raw constraint-buffer facade.
Robot & set_q_from_path_2nd(const Path &path, std::size_t idx_s_from, std::size_t idx_s_to)
Sample a path and store derivatives up to second order.
Robot & add_acceleration_limits(Span< const double > upper, Span< const double > lower, std::size_t start_idx_s, std::size_t length=0)
Add acceleration limits from broadcast vectors.
Robot & append_s(Span< const double > s)
Append strictly increasing path station samples.
Robot & add_velocity_limits(Span< const double > upper, Span< const double > lower, std::size_t start_idx_s, std::size_t length=0)
Add velocity limits from broadcast vectors.
Non-owning view of a contiguous one-dimensional array.
constexpr std::size_t size() const noexcept
COPP_API std::vector< double > t_to_s_topp2_uniform(Span< const double > s, Span< const double > a, Span< const double > t_s, double dt, TimeGridOptions options={})
Sample the inverse TOPP2 mapping s(t) on a uniform time grid.
COPP_API TimeProfile s_to_t_topp2(Span< const double > s, Span< const double > a, double t0=0.0)
Convert a second-order path profile a(s) = ds/dt squared to t(s).
Second-order time-optimal reachability-analysis solver plus second-order reachable-set artifacts and ...
Second-order endpoint boundary values.
Closed station-index interval used by TOPP/COPP problem descriptors.