mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-26 12:27:45 +08:00
@@ -58,6 +58,7 @@ float TrapezoidalTrajectory::planTrapezoidal(float Xf, float Xi,
|
||||
}
|
||||
|
||||
// Populate object's values
|
||||
|
||||
Xf_ = Xf;
|
||||
Xi_ = Xi;
|
||||
Vi_ = Vi;
|
||||
@@ -73,23 +74,7 @@ float TrapezoidalTrajectory::planTrapezoidal(float Xf, float Xi,
|
||||
yAccel_ = (Ar * Ta * Ta) / 2.0f + (Vi * Ta) + Xi;
|
||||
Tav_ = Ta + Tv;
|
||||
|
||||
// If it's an overshoot trajectory, we need to re-do our process
|
||||
// to generate the second-half of the trajectory
|
||||
if (fabs(dX) <= dx_stop) {
|
||||
TrapTrajStep_t traj;
|
||||
traj = evalTrapTraj(Td_);
|
||||
planTrapezoidal(Xf, traj.Y, traj.Yd, Vmax, Amax, Dmax);
|
||||
|
||||
// Fix initial points
|
||||
Xi_ = Xi;
|
||||
Vi_ = Vi;
|
||||
|
||||
// Fix time points
|
||||
Ta_ += Td;
|
||||
yAccel_ = (Ar_ * Ta_ * Ta_) / 2.0f + (Vi_ * Ta_) + Xi_;
|
||||
Tav_ = Ta_ + Tv_;
|
||||
}
|
||||
return Ta_ + Tv_ + Td_;
|
||||
return Ta + Tv + Td;
|
||||
}
|
||||
|
||||
TrapTrajStep_t TrapezoidalTrajectory::evalTrapTraj(float t) {
|
||||
|
||||
Reference in New Issue
Block a user