Skip to content

Commit

Permalink
Fix wheel power constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Jul 13, 2024
1 parent a0cddec commit 9d95bbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion trajoptlib/examples/Differential/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ int main() {

path.WptConstraint(0, zeroLinearVelocity);
path.WptConstraint(1, zeroLinearVelocity);
path.ControlIntervalCounts({40});
path.ControlIntervalCounts({50});

trajopt::DifferentialTrajectoryGenerator generator{path};
[[maybe_unused]]
Expand Down
4 changes: 2 additions & 2 deletions trajoptlib/src/DifferentialTrajectoryGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ DifferentialTrajectoryGenerator::DifferentialTrajectoryGenerator(
double r = path.drivetrain.trackwidth / 2.0;
auto tau_net = r * FR.at(index) - r * FL.at(index);

// Apply module power constraints
// Apply wheel power constraints
{
auto vWrtRobot = v.RotateBy(-theta);
const auto& [wheelRadius, wheelMaxAngularVelocity, wheelMaxTorque] =
path.drivetrain.left;

Translation2v vWheelWrtRobot{
vWrtRobot.X() - path.drivetrain.trackwidth / 2.0 * angularVelocity,
0.0};
vWrtRobot.Y()};
double maxWheelVelocity = wheelRadius * wheelMaxAngularVelocity;
problem.SubjectTo(vWheelWrtRobot.SquaredNorm() <=
maxWheelVelocity * maxWheelVelocity);
Expand Down

0 comments on commit 9d95bbe

Please sign in to comment.