Skip to content

Conversation

Jetblackdragon
Copy link
Contributor

No description provided.

}

// if the solo controller is connected, use it for driving
boolean soloCC = soloController.isConnected();
Copy link
Member

Choose a reason for hiding this comment

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

I think this will result in soloCC only being set when the robot code starts running, so changing to or from soloCC will require a restart of the robot code. Consider instead making this a boolean class member variable and then updating it ever second or so based on whether the solo controller is connected (via adding a new update method in this class that Robot.robotPeriodic() calls, and have the update method do the soloCC update every second or so).

Copy link
Contributor

@RobototesProgrammers RobototesProgrammers Oct 6, 2025

Choose a reason for hiding this comment

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

it worked fine at drive practice we can check again at the meeting on monday
-Aarya (I forgot what account im on)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you think it actually matter is we just call soloController.isConnected() instead of soloCC for the drive request (changing it back to what is was before)?

Copy link
Member

Choose a reason for hiding this comment

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

Looking at what isConnected does, it's similar to what driverController.getLeftX() does by looking at DriverStation.getStickAxis() vs DriverStation.isJoystickConnected

I wouldn't go back to the original change which did .withVelocityX(soloController.isConnected() ? getSoloDriveX() : getDriveX()), since it ends up reading from the HID four times (three times to check if the controller is connected & once to get that axis value), but instead have a class variable that's updated every loop to cache the result of soloController.isConnected() and then switch off of that: .withVelocityX(soloCC ? getSoloDriveX() : getDriveX()). To ensure the commands are run with the most up-to-date value, I'd sequence the new Command class periodic update in Robot.robotPeriodic to happen before the call to CommandScheduler.getInstance().run();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants