LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
constraints.hpp
Go to the documentation of this file.
1
7#ifndef _SQUIGGLES_CONSTRAINTS_HPP_
8#define _SQUIGGLES_CONSTRAINTS_HPP_
9
10#include <cmath>
11#include <string>
12
13namespace squiggles {
30 Constraints(double imax_vel,
31 double imax_accel = std::numeric_limits<double>::max(),
32 double imax_jerk = std::numeric_limits<double>::max(),
33 double imax_curvature = 1000,
34 double imin_accel = std::nan(""))
35 : max_vel(imax_vel),
36 max_accel(imax_accel),
37 max_jerk(imax_jerk),
38 max_curvature(imax_curvature) {
39 if (imax_accel == std::numeric_limits<double>::max()) {
40 min_accel = std::numeric_limits<double>::lowest();
41 } else {
42 min_accel = std::isnan(imin_accel) ? -imax_accel : imin_accel;
43 }
44 }
45
51 std::string to_string() const {
52 return "Constraints: {max_vel: " + std::to_string(max_vel) +
53 ", max_accel: " + std::to_string(max_accel) +
54 ", max_jerk: " + std::to_string(max_jerk) +
55 ", min_accel: " + std::to_string(min_accel) + "}";
56 }
57
58 double max_vel;
59 double max_accel;
60 double max_jerk;
61 double min_accel;
63};
64} // namespace squiggles
65#endif
Copyright 2020 Jonathan Bayless.
std::string to_string() const
Serializes the Constraints data for debugging.
Constraints(double imax_vel, double imax_accel=std::numeric_limits< double >::max(), double imax_jerk=std::numeric_limits< double >::max(), double imax_curvature=1000, double imin_accel=std::nan(""))
Defines the motion constraints for a path.