Help, pleeeease! #noob

Complete noobie to coding. Trying to create a basic tankdrive code. Says build is successful, but when I begin the teleop in driverstation, nothing happens. It’s the basic AndyMark kit with 4 talonsrxs and the logitech controller. All I want is the left stick to control the left two motors and right stick to control the right two motors.

So close.... I think? · GitHub

1 Like

A few things. Is this in a scheduled default command? Perhaps a print statement in the execute will tell you if it is running. Next, are the joysticks properly assigned? I haven’t looked at your other code, but will if I need to.

Edit: According to this, your code uses the old requires method. It seems like it should be addRequirements.

Ummmm… not super sure at this point. I’ve watched so many videos and github examples that I am unsure. I am no where near using any automation.

View my edit in my first reply. Perhaps this is it? Also, if you’re unsure if it’s running, simply add a print statement. I use python, so I don’t know the exact syntax for FRC but in java, System.out.println("Running"); would suffice I’d assume.

Where would I need to add the print statement to?

The execute method. This method loops throughout the duration of the command.

Got this message
“Replace this use of System.out or System.err by a logger.”

Ok, so that’s what I was afraid of. It didn’t crash did it? Are you using the RIOLog?

Um, I don’t think so?

When I go to test the code, it’s no longer wanting to cooperate

Now this popped up:
‘gradlew’ is not recognized as an internal or external command,
operable program or batch file.
The terminal process “cmd.exe /d /c gradlew deploy -PdebugMode -PteamNumber=7 --offline“C:\Users\Public\wpilib\2021\jdk”” failed to launch (exit code: 1).

Sounds to me like Gradle isn’t installed. At this point, that print statement is more of a nuisance. Do you have any other working commands? Also, can you share updated code?

I’m near certain I have Gradle installed. That was a whole other problem! It was working earlier because I was able to build a successful code; the robot just didn’t move.

1 Like

Can I see the current code? It’s probably building successfully cause you are defining the requires method right below it too btw.

So I opened a separate project and it built without a gradle issue

Hahaha, with the System.out.println("Running");?

Ah, yes… Forgot about that important part. Homer Simpson “d’oh!”

1 Like

How are you running this command anyway? Is it a default or is it binded to a button?

The tank drive command? I have attempted to assign joysticks to it, but no buttons

Precisely. It uses joysticks, but there is no way of running the command without a binding or a default (excluding auto). Try binding that command to a button like this, preferably in a robot container file.

JoystickButton(JOYSTICK_OBJECT, BUTTON_ID).whileHeld(TankDrive());

As you might have guessed, try driving while holding the button you assign it to.