Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Add a prioritize rotation flag to the swerve drive method #65

Open
varun7654 opened this issue Mar 13, 2022 · 9 comments · May be fixed by #91
Open

Add a prioritize rotation flag to the swerve drive method #65

varun7654 opened this issue Mar 13, 2022 · 9 comments · May be fixed by #91
Assignees
Labels
enhancement New feature or request

Comments

@varun7654
Copy link
Collaborator

This should ensure that the outputted rotation speed is equal to what the commanded input is. When this is true we should reduce the commanded robot speed to make sure we hit the commanded angular velocity (if needed).

@varun7654 varun7654 added the enhancement New feature or request label Mar 14, 2022
@varun7654 varun7654 self-assigned this Mar 14, 2022
@Matthew-Kasper
Copy link
Contributor

You might be able to tell if the commanded robot speed needs to be reduced by checking to see if the current to the drive motors is at the current limit and checking to see if the rotation has not met its setpoint. I don't know if this would work properly though.

@varun7654
Copy link
Collaborator Author

I plan to just do a binary search to ensure that no individual wheel is above a max set speed

@varun7654 varun7654 reopened this Mar 17, 2022
@Matthew-Kasper
Copy link
Contributor

How would that solve this problem?

@Matthew-Kasper
Copy link
Contributor

I assume the purpose of lowering the allowed speed is so the wheels still have room to spin faster to achieve a specific turn.

@Matthew-Kasper
Copy link
Contributor

I honestly don't know anymore

@varun7654
Copy link
Collaborator Author

We call SwerveDriveKinematics#desaturateWheelSpeeds before setting the wheel speeds. It ensures that no single module is going is set above the max speed that it can achieve. If a wheel is requested to spin faster than the max speed it reduces the speed of all the other wheels so that the ratio of speeds between all the wheels stay the same. The consequence is that you won't be moving at the requested velocity or rotation speed. This may cause issues with our turnpid if we run it while we're moving, so I wanted to make a method that instead sacrifices robot velocity to ensure that we're always turning at our requested rate.

@Matthew-Kasper
Copy link
Contributor

When would we call it? If we see that the turn setpoint isn't being reached? We shouldn't have it active all of the time.

@varun7654
Copy link
Collaborator Author

whenever we're using the turnpid

@Matthew-Kasper
Copy link
Contributor

Hmm ok, I hope this doesn't make the driving feel weird due to the speed changes.

@varun7654 varun7654 linked a pull request Jul 27, 2022 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants