Team2168 / 2016_Main_Robot

Code for the 2016 season
0 stars 0 forks source link

Investigate Additional DriveWithJoystick Methods #65

Open NotInControl opened 7 years ago

NotInControl commented 7 years ago

This enhancement will allow for the driver to select from multiple different drivetrain joystick configurations in real time for a drop down menu on the smart dashboard.

Here is the idea:

  1. A single Command called DriveWithJoystickMultiple

In the new file we add methods for

A. Tank Drive Method

In the init method we create a smartdashboard sendable chooser object and use that to allow the operator to select which drive mode they want.

Then we can use a switch statement in the execute mode to call into the proper method depending on which item is selected from the dash.

This will allow real time changing of the drive modes for testing purposes. We can then infinitely add more modes by simply adding more methods to the class.

Once we have the file set up for the default tank drive, we can then talk about the actual algorithms related to the other drive methods.

For example

public void init() {
    chooser = new SendableChooser();
    chooser.addDefault("Tank Drive", 1);
    chooser.addObject("GTA Drive", 2);
    chooser.addObject("Arcade Drive", 3);
    SmartDashboard.putData("Autonomous Selector", chooser);
}

public void execute() {
    switch(mode) {
        case 1:
        ...
    }
}
NotInControl commented 7 years ago

@Benmw99 This is what I was thinking, not exactly sure if it will work as written, but something close to it will. Let me know what you think

2869_001.pdf

NotInControl commented 7 years ago

So I reviewed the latest commit. Good start, but we can do some quick things to clean it up. No need to have the buttons in OI.java either.

For example, convert each of the switch statements to method calls such that:

case1: tankDrive();

case2: gtaDrive();

etc, Calls the method inside that class. Delete the ControllerSwitcher class and move all the code over to DriveWithJoysticks so that it becomes the class that allows you to switch classes. If you guys will be at the school tonight, we can talk more about it.

ImSovietBear commented 7 years ago

I'msetting up the pancake breakfast tonight, but if you can excuse me from that either way I'll be there tonight. I was planning on deploying the main branch as it should be like you said last night.

NotInControl commented 7 years ago

Helping with the pancake breakfast is priority, so I can't excuse you from that, but master does need to be deployed to the robot if you guys deployed your own test code to the robot, but that deployment should only take seconds. We can talk about mods to the code after the pancake breakfast tomorrow

NotInControl commented 7 years ago

@Benmw99 when you have a chance please commit and push the code. Make sure to say in the commit is for "working on #65" so it can be linked to this issue