Skip to content

Commit

Permalink
Added PID control to steer joint in velocity mode
Browse files Browse the repository at this point in the history
Signed-off-by: Saurabh Kamat <[email protected]>
  • Loading branch information
sauk2 committed Feb 15, 2024
1 parent 839a10a commit 68a81fa
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/systems/ackermann_steering/AckermannSteering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -952,14 +952,17 @@ void AckermannSteeringPrivate::UpdateVelocity(
return;
}

double leftDelta = leftSteeringJointAngle - leftSteeringPos->Data()[0];
double rightDelta = rightSteeringJointAngle - rightSteeringPos->Data()[0];

// Simple proportional control with a gain of 1
// Adding programmable PID values might be a future feature.
// Works as is for tested cases
this->leftSteeringJointSpeed = leftDelta;
this->rightSteeringJointSpeed = rightDelta;
double leftDelta = leftSteeringPos->Data()[0] - leftSteeringJointAngle;
double rightDelta = rightSteeringPos->Data()[0] - rightSteeringJointAngle;

// Simple PID control with settable gains.
this->leftSteeringJointSpeed = this->steerPosPid.Update(
leftDelta, _info.dt);
this->steerPosPid.Reset();

this->rightSteeringJointSpeed = this->steerPosPid.Update(
rightDelta, _info.dt);
this->steerPosPid.Reset();
}

//////////////////////////////////////////////////
Expand Down

0 comments on commit 68a81fa

Please sign in to comment.