Skip to content

Conversation

moreheadm
Copy link
Member

No description provided.

leftLeader.setSmartCurrentLimit(60);
rightLeader.setSmartCurrentLimit(60);
applytoAllMotors((motor) -> {motor.setOpenLoopRampRate(0.2);});
// applytoAllMotors((motor) -> {motor.setOpenLoopRampRate(0.2);});
Copy link
Member Author

@moreheadm moreheadm Mar 20, 2024

Choose a reason for hiding this comment

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

I realized you should do


applytoAllMotors((motor) -> {motor.setOpenLoopRampRate(0);});

because the previous setting of 0.2 is saved in flash on the SparkMax.

// There is a different system used than previous years because MotorControlGroup is deprecated :(.
// We set a motor to a leader, and make followers follow the leader in the constructor.
// Front wheels are leaders for no reason because its redundant
BetterSlewRateLimiter slewRateLimiter = new BetterSlewRateLimiter(60, 0, 0);
Copy link
Member Author

@moreheadm moreheadm Mar 20, 2024

Choose a reason for hiding this comment

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

I realized two things. One, we calculate 60 in terms of volts, but when we actually use this function it's in terms of percent output. So, it should be 5, not 60 (1 / 0.2 = 5).

Second, the deceleration limit is currently 0 which means it will never decelerate. You should set it to something high, like 100.

If you want to be better, move these numbers to constants.

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.

2 participants