COPP C++ API
C++ interface for COPP trajectory optimization
Loading...
Searching...
No Matches
reach_set2.cpp
Go to the documentation of this file.
1// Tutorial example: inspect second-order reachable intervals.
2//
3// Reach-set APIs are useful for debugging or visualizing feasibility without
4// directly asking for the final TOPP2 profile.
5
6#include <iostream>
7#include <vector>
8
9#include <copp/copp.hpp>
10
11int main()
12{
13 // Step 1: Create a raw one-dimensional constraint buffer. A first-order
14 // bound is already enough for a tiny reachable-set smoke problem.
15 std::vector<double> s{0.0, 0.5, 1.0};
16 std::vector<double> amax{1.0, 1.0, 1.0};
17
18 copp::Constraints constraints(1, s.size());
19 constraints.append_s(s).add_constraint_1st(amax, 0);
20
21 // Step 2: Build a TOPP2/ReachSet2 problem over the closed station interval.
23 constraints.ref(),
24 copp::IndexInterval{0, s.size() - 1},
25 copp::Boundary2{0.0, 0.0},
26 };
27
28 // Step 3: Bidirectional reachability enforces both start and final boundary.
29 auto reach = copp::solver::reach_set2::bidirectional(problem);
30
31 std::cout << "ReachSet2 done.\n";
32 std::cout << "stations = " << reach.len() << "\n";
33 std::cout << "a_max(mid) = " << reach.a_max[1] << "\n";
34
35 return 0;
36}
Owning raw constraint-buffer facade.
Definition robot.hpp:245
Constraints & add_constraint_1st(Span< const double > amax, std::size_t idx_s)
Constraints & append_s(Span< const double > s)
ConstraintsRef ref() noexcept
Borrow this owning object as a solver/constraint reference.
ReachSet bidirectional(const Problem &problem, const Options &options={})
Compute bidirectional TOPP2 reachable intervals, enforcing both boundaries.
copp::solver::topp2_ra::Problem Problem
Definition reach_set2.hpp:9
int main()
Second-order endpoint boundary values.
Definition core.hpp:77
Closed station-index interval used by TOPP/COPP problem descriptors.
Definition core.hpp:67