Program Listing for File controlvector.hpp¶
↰ Return to documentation for file (include/geometry/controlvector.hpp
)
#ifndef _GEOMETRY_CONTROL_VECTOR_HPP_
#define _GEOMETRY_CONTROL_VECTOR_HPP_
#include <cmath>
#include <string>
#include "pose.hpp"
namespace squiggles {
class ControlVector {
public:
ControlVector(Pose ipose,
double ivel = std::nan(""),
double iaccel = 0.0,
double ijerk = 0.0)
: pose(ipose), vel(ivel), accel(iaccel), jerk(ijerk) {}
ControlVector() = default;
std::string to_string() const {
return "ControlVector: {" + pose.to_string() +
", v: " + std::to_string(vel) + ", a: " + std::to_string(accel) +
", j: " + std::to_string(jerk) + "}";
}
std::string to_csv() const {
return pose.to_csv() + "," + std::to_string(vel) + "," +
std::to_string(accel) + "," + std::to_string(jerk);
}
bool operator==(const ControlVector& other) const {
return pose == other.pose && nearly_equal(vel, other.vel) &&
nearly_equal(accel, other.accel) && nearly_equal(jerk, other.jerk);
}
Pose pose;
double vel;
double accel;
double jerk;
};
} // namespace squiggles
#endif