PSA: Balance in auto

Hello,

I am trying to implement this into a command based project, but I am not entirely sure how. I saw your comment here that says to create the auto balance object in the command and then execute it. So we create a new java class “AutoBalance” and then call it in an AutoBalance command?

Thank you so much

The Java Math module is your friend.

Math.toRadians(degrees)

You don’t need to create a Java class for autoBalance, you can take that class from the github link. But yes, you create your command for balancing that just calls the autoBalance::autoBalanceRoutine() or autoBalance::scoreAndBalance() in the command’s execute(), and sets the result to the motors.

1 Like

Thank you! I was able to get it to work for our robot using the navX accelerometer.

3 Likes