12#include <sleipnir/autodiff/variable.hpp>
13#include <sleipnir/optimization/problem.hpp>
14#include <sleipnir/optimization/solver/exit_status.hpp>
16#include "trajopt/path/path.hpp"
17#include "trajopt/path/path_builder.hpp"
18#include "trajopt/util/symbol_exports.hpp"
49 std::vector<double>
dt;
52 std::vector<double>
x;
55 std::vector<double>
y;
61 std::vector<double>
vl;
64 std::vector<double>
vr;
71 std::vector<double>
al;
74 std::vector<double>
ar;
81 std::vector<double>
Fl;
84 std::vector<double>
Fr;
88class TRAJOPT_DLLEXPORT DifferentialTrajectorySample {
126 DifferentialTrajectorySample() =
default;
162class TRAJOPT_DLLEXPORT DifferentialTrajectory {
165 std::vector<DifferentialTrajectorySample>
samples;
167 DifferentialTrajectory() =
default;
173 std::vector<DifferentialTrajectorySample>
samples)
181 for (
size_t sample = 0; sample < solution.
x.size(); ++sample) {
183 ts, solution.
x[sample], solution.
y[sample], solution.
heading[sample],
184 solution.
vl[sample], solution.
vr[sample],
187 solution.
Fl[sample], solution.
Fr[sample]);
188 ts += solution.
dt[sample];
194using DifferentialPath = Path<DifferentialDrivetrain, DifferentialSolution>;
199using DifferentialPathBuilder =
200 PathBuilder<DifferentialDrivetrain, DifferentialSolution>;
220 std::expected<DifferentialSolution, slp::ExitStatus>
generate(
221 bool diagnostics =
false);
225 DifferentialPath path;
228 std::vector<slp::Variable<double>> x;
229 std::vector<slp::Variable<double>> y;
230 std::vector<slp::Variable<double>> θ;
231 std::vector<slp::Variable<double>> vl;
232 std::vector<slp::Variable<double>> vr;
233 std::vector<slp::Variable<double>> al;
234 std::vector<slp::Variable<double>> ar;
237 std::vector<slp::Variable<double>> Fl;
238 std::vector<slp::Variable<double>> Fr;
241 std::vector<slp::Variable<double>> dts;
244 std::vector<size_t> Ns;
246 slp::Problem<double> problem;
DifferentialTrajectoryGenerator(DifferentialPathBuilder path_builder, int64_t handle=0)
std::expected< DifferentialSolution, slp::ExitStatus > generate(bool diagnostics=false)
double velocity_r
The right wheel's velocity.
Definition differential_trajectory_generator.hpp:106
double x
The x coordinate.
Definition differential_trajectory_generator.hpp:94
double force_l
The left wheel's force.
Definition differential_trajectory_generator.hpp:121
double y
The y coordinate.
Definition differential_trajectory_generator.hpp:97
double force_r
The right wheel's force.
Definition differential_trajectory_generator.hpp:124
double heading
The heading.
Definition differential_trajectory_generator.hpp:100
double angular_acceleration
The chassis angular acceleration.
Definition differential_trajectory_generator.hpp:118
double velocity_l
The left wheel's velocity.
Definition differential_trajectory_generator.hpp:103
double acceleration_l
The left wheel's acceleration.
Definition differential_trajectory_generator.hpp:112
double timestamp
The timestamp.
Definition differential_trajectory_generator.hpp:91
DifferentialTrajectorySample(double timestamp, double x, double y, double heading, double velocity_l, double velocity_r, double angular_velocity, double acceleration_l, double acceleration_r, double angular_acceleration, double force_l, double force_r)
Definition differential_trajectory_generator.hpp:141
double angular_velocity
The chassis angular velocity.
Definition differential_trajectory_generator.hpp:109
double acceleration_r
The right wheel's acceleration.
Definition differential_trajectory_generator.hpp:115
DifferentialTrajectory(std::vector< DifferentialTrajectorySample > samples)
Definition differential_trajectory_generator.hpp:172
DifferentialTrajectory(const DifferentialSolution &solution)
Definition differential_trajectory_generator.hpp:179
std::vector< DifferentialTrajectorySample > samples
The samples that make up the trajectory.
Definition differential_trajectory_generator.hpp:165
A differential drivetrain physical model.
Definition differential_trajectory_generator.hpp:23
double moi
The moment of inertia of the robot about the origin (kg−m²).
Definition differential_trajectory_generator.hpp:28
double mass
The mass of the robot (kg).
Definition differential_trajectory_generator.hpp:25
double trackwidth
Distance between the two driverails (m).
Definition differential_trajectory_generator.hpp:43
double wheel_max_torque
Maximum torque applied to the wheels (N−m).
Definition differential_trajectory_generator.hpp:37
double wheel_radius
Radius of the wheels (m).
Definition differential_trajectory_generator.hpp:31
double wheel_max_angular_velocity
Maximum angular velocity of the wheels (rad/s).
Definition differential_trajectory_generator.hpp:34
double wheel_cof
The Coefficient of Friction (CoF) of the wheels.
Definition differential_trajectory_generator.hpp:40
The holonomic trajectory optimization solution.
Definition differential_trajectory_generator.hpp:47
std::vector< double > vl
The left velocities.
Definition differential_trajectory_generator.hpp:61
std::vector< double > y
Y positions.
Definition differential_trajectory_generator.hpp:55
std::vector< double > Fr
The force of the right driverail wheels.
Definition differential_trajectory_generator.hpp:84
std::vector< double > vr
The right velocities.
Definition differential_trajectory_generator.hpp:64
std::vector< double > ar
The right acceleration.
Definition differential_trajectory_generator.hpp:74
std::vector< double > angular_velocity
Definition differential_trajectory_generator.hpp:68
std::vector< double > heading
Heading.
Definition differential_trajectory_generator.hpp:58
std::vector< double > dt
Times between samples.
Definition differential_trajectory_generator.hpp:49
std::vector< double > al
The left accelerations.
Definition differential_trajectory_generator.hpp:71
std::vector< double > Fl
The force of the left driverail wheels.
Definition differential_trajectory_generator.hpp:81
std::vector< double > angular_acceleration
Definition differential_trajectory_generator.hpp:78
std::vector< double > x
X positions.
Definition differential_trajectory_generator.hpp:52