LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
controlvector.hpp
Go to the documentation of this file.
1
7#ifndef _GEOMETRY_CONTROL_VECTOR_HPP_
8#define _GEOMETRY_CONTROL_VECTOR_HPP_
9
10#include <cmath>
11#include <string>
12
13#include "pose.hpp"
14
15namespace squiggles {
17 public:
27 double ivel = std::nan(""),
28 double iaccel = 0.0,
29 double ijerk = 0.0)
30 : pose(ipose), vel(ivel), accel(iaccel), jerk(ijerk) {}
31
32 ControlVector() = default;
33
39 std::string to_string() const {
40 return "ControlVector: {" + pose.to_string() +
41 ", v: " + std::to_string(vel) + ", a: " + std::to_string(accel) +
42 ", j: " + std::to_string(jerk) + "}";
43 }
44
45 std::string to_csv() const {
46 return pose.to_csv() + "," + std::to_string(vel) + "," +
47 std::to_string(accel) + "," + std::to_string(jerk);
48 }
49
50 bool operator==(const ControlVector& other) const {
51 return pose == other.pose && nearly_equal(vel, other.vel) &&
52 nearly_equal(accel, other.accel) && nearly_equal(jerk, other.jerk);
53 }
54
56 double vel;
57 double accel;
58 double jerk;
59};
60} // namespace squiggles
61
62#endif
ControlVector(Pose ipose, double ivel=std::nan(""), double iaccel=0.0, double ijerk=0.0)
A vector used to specify a state along a hermite spline.
std::string to_string() const
Serializes the Control Vector data for debugging.
std::string to_csv() const
bool operator==(const ControlVector &other) const
std::string to_csv() const
Definition pose.hpp:51
std::string to_string() const
Serializes the Pose data for debugging.
Definition pose.hpp:46
Copyright 2020 Jonathan Bayless.
bool nearly_equal(const double &a, const double &b, double epsilon=1e-5)
Definition utils.hpp:25