Seeking help implementing default commands in java (Was: Help)

Hi guys, since my team is new with Java, we are having some problems with it, specially with constant commands, such as those in the chassis, or sensors. We’ll be really grateful if there is someone who can help us to detect the error, here you can find our code

https://drive.google.com/open?id=17iO93zxbTBZwEk46DK-4hmrGhrSrLmif

What you are looking for is called a “Default Command”. The documentation about default commands is located here: https://docs.wpilib.org/en/latest/docs/software/old-commandbased/commands/default-commands.html#setting-the-default-command

So summarize the documentation (but you really should take a look at it): You need to modify the subsystems you want to have a default command by implemented the initDefaultCommand method like so:

public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        setDefaultCommand(new MyDefaultCommand());
}

In the case of the Chassis, MyDefaultCommand looks like it would be replaced with a chasis_drive command.

1 Like

Hi Eric,
While I may not be able to help you directly with your code, you may also want to look into using GitHub. I’m not sure if you are just having it on Google Drive for Chief Delphi, but if you are using it for general code storage, it is not reccomended. GitHub allows you to easily use version control and other cool stuff. Info on how to get started is located here:https://docs.wpilib.org/en/latest/docs/software/basic-programming/git-getting-started.html

2 Likes

Okey, a will try it. Thanks!!

Really well, thanks!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.