Joystick In New Command Based Programming

So, this is our first year in FRC. We started to work with a practice board but now the format of the whole command-based programming changed. We are unsure, where is the proper place to declare the Joystick now? Before it was in an OI file.
Tucker M

1 Like

Welcome to FRC and Chief Delphi! :smiley:
Joystick declarations should come in the RobotContainer file.

1 Like

Would the Joystick declaration go into the RobotContainer? Or, would you just declare it inside the class?

Hey there. Here’s a good place to get started with the new command based framework:

Or the more common domain:

Alright, I have finished reading through the new Command Systems again. I am still confused because they mentioned buttons executing commands but never Joystick declarations. Am I just mis reading something or am I not understanding the new Java file structure?

Hang on a sec

The way you do it is you create a new joystick object in the RobotContainer class and pass in its value when you want to use it in a runCommand.

1 Like

Or any command type you like.

I’d also consider taking a look at the Command Based Framework Examples. They show setting up joysticks, buttons triggering commands, default commands (drivetrain joystick command), ect. and are generally a good source to see what the expected practices are for the framework:

In particular, I’ve been looking at the HatchbotTraditional and Gearsbot examples when showing things to students.


How would you use a double supplier here?

Do you want to get the value of the joystick?

yes and return it to a drive command

Well in the screenshot l posted the values are passed in to the command driveRobot in the drivebase subsystem which takes two doubles which refer back to each joystick. Is this what you need?

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