-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shooter distances #13
base: main
Are you sure you want to change the base?
Conversation
Also implementation in the subsystem. Actual speeds still need to be tested.
I would actually make a class that stores a double distance and two int RPMs, and have a single ArrayList with all of them in it. You could define this in its own file or as a static class in the ShooterDistances class. We need to be able to enter and interpolate between arbitrary distances instead of each having a constant offset, because we'll probably only be able to enter like three or four, and they will likely be the set locations we've decided on. In order to get the two distances it's between, you would want a fori loop over every element until you reach one where its distance is greater than the one Gloworm is calculating. You can store the element at that index and the one before it, and those are the two distances and sets of RPMs that you'll have to interpolate between. You would figure out how far between the distances the robot is by dividing the robot distance minus the lower distance by the upper distance minus the lower distance. Then to interpolate between the sets of RPMs, you can take the one for the smaller distance and add it to the difference between the smaller and larger distance ones times that percent you calculated earlier. However, WPILib provides the Using an ArrayList for this helps as well, because it scales dynamically as you add elements to it, and you can declare one easily by saying
or
assuming your class is called ShooterData and takes in the distance, top RPM, and bottom RPM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to review changes
No description provided.