Intake assist#148
Conversation
codeNinja-1
left a comment
There was a problem hiding this comment.
Looks great! I added some comments for potential improvements to think about.
| double kP = 0.5; // Not tuned | ||
|
|
||
| double maxAssist = 1.0; // Not tuned |
There was a problem hiding this comment.
It would be nice if there were tunables for these.
| double correctedVelocityX = (-velocityY / robotSpeed) * assist; | ||
| double correctedVelocityY = (velocityX / robotSpeed) * assist; |
There was a problem hiding this comment.
These variables' names are a bit confusing, because it sounds like these will be the output of this method, not a vector added to the input velocity. Perhaps call this correctionVelocityX and correctionVelocityY instead?
| // the robot is moving away from the fuel | ||
|
|
||
| double speedScale = | ||
| Math.min(1.0, robotSpeed / 2.0); // 2.0 m/s should be tuned to the speed at where the assist |
There was a problem hiding this comment.
Also a tunable for this would be nice.
| public void setAssistFunction(UnaryOperator<ChassisSpeeds> assistFunction) { | ||
| this.assistFunction = assistFunction; | ||
| } |
There was a problem hiding this comment.
If we expect to typically use this in a startEnd command that sets the assist function to a value at start and sets it to null at end, it could be nice to have a convenience method that wraps this in a command.
| * perpendicular to the robot's current velocity, based on the distance to the fuel clump and how | ||
| * much the robot is moving towards it, and adds that to the robot's velocity output. | ||
| */ | ||
| public ChassisSpeeds calculateAdjustedVelocity(ChassisSpeeds currentVelocity) { |
There was a problem hiding this comment.
You're doing a lot of vector operations in this method. Maybe consider using WPILib's Vector class to simplify the code.
No description provided.