kinematicwolves / KinematicWolves-2020

0 stars 1 forks source link

Implement controls to work with additional ball indexing #38

Open mikedennis2 opened 3 years ago

mikedennis2 commented 3 years ago

New system will contain three more sensors in the conveyor system (one in place already).

mikedennis2 commented 3 years ago

There are many ways this could be implemented. Here is an idea I had:

Changes to the ConveyorSubsystem class

  1. Add three new public member variables for the three new sensors.

    • It may be wise to change the naming of the current sensor, they should all be the same name except for their sensor number.
    • I suggest naming them ballIndexSensor1, ballIndexSensor2, ballIndexSensor3, and ballIndexSensor4.
  2. Add three new public member booleans to keep track of whether or not a ball is detected at a sensor.

    • It may also be wise here to update the naming of the current boolean variable that tracks whether or not a ball is detected.
    • I suggest ballNotDetectedSensor1, ballNotDetectedSensor2, ballNotDetectedSensor3, and ballNotDetectedSensor4.
  3. Add calls to retrieve the reading from the new sensors in the periodic method.

    • Hint: this involves the .get() method for the DIO sensors.
  4. Add a member variable to keep track of the next ball position.

    • Note how these ALWAYS get filled in the order of: 2, 3, 4.
    • We can increment this each time a ball gets collected. Ex: when a ball is collected and stops in position 2, increment the next position to be position 3 for the next ball.
  5. Add a method to get the next ball position.

    • This can be used in commands to see where the ball needs to go (or if the system is full).
  6. Move the upper conveyor (Vertical one) to the ConveyorSubsystem class from the ShooterSubsystem.

    • This will involve moving an attribute and a method, then doing some renaming.
  7. Update the method to move the lower conveyor.

    • Where will this method be called?
  8. Add a method to move the upper conveyor.

  9. Add a method to increment the next ball position.

    • We will need this for when we write the command to intake the ball.
  10. Add a method to reset the next ball position variable after the balls have been shot. (This is not in commit e294259)

Modifications to the ball intake command

The current intake command is done in SequentialIntakeBall.java. This runs a few commands in sequence. We need to modify this to apply the new scheme as described in the attached document. Sequence of Operations for Collecting and Shooting Power Cells.docx

  1. Let's change InitCommandUntilBallFound to be call RunIntakeUntilBallFound.

    • This will run the intake until a ball is detected at sensor 1.
    • Note, the conveyors do not need to move here.
    • This command should end when either a ball is found at sensor 1 or the conveyor system is full.
    • Started in commit e294259
  2. Modify the IntakeBall command to take into account a desired next ball position.

    • We will need to get the next ball position from the ConveyorSubsytem.
    • The command should end when the ball reaches the desired next position.
    • When the command ends, the next ball position should be incremented using the method that has already been written with the ConveyorSubystem.

This should be enough to get started...

kinematicwolves commented 3 years ago

Commit e294259 provides some skeleton and comments on the next steps.