kalee1 / ftc_app_8668_RoverRuckus

FTC Android Studio project to create FTC Robot Controller app.
2 stars 0 forks source link

Develop "named positions" for arm #17

Closed kalee1 closed 5 years ago

kalee1 commented 5 years ago

Develop a list of "named positions" for the arm which captures the elbow and shoulder encoder values for those positions. I recommend creating an enum type. Some information on enum types can be found here: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html

On that page, there is an example that is similar to what I'm suggesting. The Planet enum type contains a list of planets where each planet in the list has 2 values associated with it (the mass and the radius). Ours would be called ArmPositions or something similar and would contain the list of positions that we think are important for the arm. I can think of 3 positions so far: HOME, AUTONOMOUS_END, and DRIVE. Each of these would have a pair of elbow and shoulder encoder values associated with it. HOME would be (0,0). AUTONOMOUS_END would be the values we used for Deploy, (9165, -5630), and DRIVE would be the values which puts the arm in a good position for driving back to the lander for putting minerals in the cargo holds.

Once our ArmPositions enum type is developed, we can begin using it in our autonomous and teleop code to make moving the arm to set positions easier.

kalee1 commented 5 years ago

The elbowHome and shoulderHome variables are no longer needed if you can set the ARM_HOME.elbow and ARM_HOME.shoulder values with the current positions in the int() method.

Something like:

ArmPositions.ARM_HOME.elbow = elbow.getCurrentPosition();
ArmPositions.ARM_HOME.shoulder = shoulder.getCurrentPosition();

If you get rid of elbowHome and shoulderHome, then they can be replaced by ArmPositions.ARM_HOME.elbow and ArmPositions.ARM_HOME.shoulder.