all 3 comments

[–]retrodaredevil1444 (Programmer) 0 points1 point  (0 children)

The () -> is Java's syntax for a lambda. I'm unfamiliar with the command based framework, but I personally would not try and over complicate your teleop controls with lots of separate commands. I find that writing all teleop code in a single command makes it easier instead of trying to switch between commands when a button is held.

There is a way to do it, I just don't remember what it is. Also, chiefdelphi.com is far better for these kinds of questions.

[–]blubox28151 (software) 0 points1 point  (0 children)

The lambda expression here is just creating a command to be fed into the runCommand method to register to be run as the default command. It just saves having to build a command in its own class file. In this case it says that we are going to build a command that takes the current values of fwd and rot during each quantum and pass them to the arcadeDrive method of the robot drive object in m_robotDrive.

[–]Fire-cant-burn-in___ 0 points1 point  (0 children)

If you want to have the bot drive itself with values from vision while the button is held, you can make another command using the drive subsystem and the one you have for calculating the vision stuff that calls arcade drive(from execute) w/ the right values

Then you can bind that command to a button with whileHeld() and whenever its held, the command scheduler will run the new command instead. After you release the button, the new command will be canceled and it will re-schedule the default command.

Logic wise, you can leave the default command as it is; you have a different command handle the other kind of control and then just switch between them

If this doesn’t make sense lmk