Team2168 / 2015_Main_Robot

Source code for the 2015 season
2 stars 0 forks source link

Modify the F310 class #34

Closed jcorcoran closed 9 years ago

jcorcoran commented 9 years ago

Update the F310 class to format outputs to signs we expect.

For example axis outputs should be positive when you push up on the sticks. This inversion should take place within this class, otherwise we end up doing it everywhere else in the code.

Also, add comments to all the methods to identify the type and range of returned values. For example, I'm not sure if the methods that get the trigger values return values that are only positive from 1.0 - 0.0 or if they are full range 1.0 - -1.0 or if one trigger is positive and the other is negative... The javadoc comments for each method should define this.

Test this on a robot and all the buttons work as documented.

NotInControl commented 9 years ago

@Dustin-Garner how are we doing with this?

Dustin-Garner commented 9 years ago

Should be done. Sorry it took so long I have been sick for the past couple of days

NotInControl commented 9 years ago

While the intent of this issue is closed, I do not think it is complete. Because we inverted the joysticks we also need to invert the subsystem methods. If I look at the drivetrain, it looks like tank drive was swapped, while this works, if someone were to call the drive motors individually i.e DriveMotorLeft1, negative would be fwd and pos would be rev.

In order to solve this problem, the fix should be implemeneted in each of those calls, not in tank drive. I recommend adding a Boolean in RobotMap for each drive to determine if it needs to be reversed.

For example:

//Robot Map
public static boolean invertLeftDrive = false;
public static Boolean invertRightDrive = true;

Then in each of the drive commands you use that Boolean to determine if you should invert the value or not, so that positive drives fwd, and negative drives in reverse

For example:

public void driveLeft1(double speed) {
         double tempSpeed;
         if(RobotMap.invertLeftDrive )
                tempSpeed = -speed;
        else
                tempSpeed = speed;

        leftMotor1.set(tempSpeed); 
    leftMotor1Voltage = Robot.pdp.getBatteryVoltage() * tempSpeed; 
 }

//do similar for all other methods, then tank drive does not need to be inverted

Write the fix, and we can test on the robot later to determine how the Booleans in RobotMap should be set.