Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Added a fake DriveTrainVariant and a constant to disable the DriveTrain. #6

Merged
merged 2 commits into from
Feb 2, 2022

Conversation

glowkate
Copy link
Contributor

I would like a review on this pull request, if somebody is able to do so.
I will merge this in two days if nobody reviews it.

@Dangosaurus
Copy link
Contributor

Dangosaurus commented Jan 31, 2022

LGTM. It should probably be documented along the likes of DriveTrainVariant(#3)and LazySolenoid(#2). Not sure if that should be part of this PR or should be it's own issue.

@Dangosaurus Dangosaurus self-requested a review January 31, 2022 16:26
Copy link
Contributor

@Dangosaurus Dangosaurus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I realized now I probably should have left a review comment.

driveTrainVariant = variant;
}
else{
driveTrainVariant = new LazyDriveTrainVariant();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider pushing this up to the caller, which is this line in robotInit()

    System.out.println("Hello me is robit!");

    DriveTrain.setVariant(new FalconDriveTrainVariant());

    scheduler = CommandScheduler.getInstance();

The problem that I see is that if we don't have the drivetrain hardware then I think the new FalconDriveTrainVariant() will trigger the FalconDriverTrainVariant constructor, which will try to connect to the non-existent motors and gear box solenoids. My guess is that it'll generate a bunch of CAN bus warnings on the console output and it'll work fine, but that's a guess.

Another thought is to just make the driveTrainVariant in the constructor for DriveTrain() and remove the setVariant method completely. driveTrainVariant becomes a non-static member of DriveTrain, but I think that's okay... The only way to create a DriveTrain appears to be DriveTrain's getInstance method; the DriveTrain constructor is private. DriveTrain is a classic singleton.

}
else{
driveTrainVariant = new LazyDriveTrainVariant();
}
}

private final LazySolenoid shifterSolenoid =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LazySolenoid here also needs a be tied into the kEnableDriveTrain

Also, are we missing something like a kEnableDriveTrainShifter constant? i.e., should this be

new LazySolenoid(kDriveShifterID, kEnableSolenoids && kEnableDriveTrain && kEnableDriveTrainShifter);

@glowkate glowkate merged commit eda7891 into Team865:main Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants