-
Notifications
You must be signed in to change notification settings - Fork 0
Added wristcontroller subsystem #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a-mishmash
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probbly fine
The docs say setVoltage is preferred:
And in their doc on combining FeedForward with PID controls, WPILib uses setVoltage in their example: public void tankDriveWithFeedforwardPID(double leftVelocitySetpoint, double rightVelocitySetpoint) {
leftMotor.setVoltage(feedforward.calculate(leftVelocitySetpoint)
+ leftPID.calculate(leftEncoder.getRate(), leftVelocitySetpoint));
rightMotor.setVoltage(feedForward.calculate(rightVelocitySetpoint)
+ rightPID.calculate(rightEncoder.getRate(), rightVelocitySetpoint));
}https://docs.wpilib.org/en/stable/docs/software/advanced-controls/controllers/feedforward.html |
84c9201
|
the problem with that is that setVoltage() expects a voltage as the input, while the PID controller is solving assuming a 0-1 range. So you would be putting 0-1 volts into the motor which would not work for obvious reasons. You could try multiplying by 12, but that is basically just what the set() method does anyway.
…-------- Original Message --------
On Wednesday, 01/28/26 at 11:00 Iprobablydontknowwhatimdoing ***@***.***> wrote:
Iprobablydontknowwhatimdoing left a comment [(IronRiders/rebuilt#25)](#25 (comment))
> wristMotor.setVoltage() should be wristMotor.set()
The docs say setVoltage is preferred:
> Since feedforward voltages are physically meaningful, it is best to use the setVoltage() ([Java](https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/wpilibj/motorcontrol/MotorController.html#setVoltage(double)), [C++](https://github.wpilib.org/allwpilib/docs/release/cpp/classfrc_1_1_motor_controller.html#a613c23a3336e103876e433bcb8b5ad3e), [Python](https://robotpy.readthedocs.io/projects/robotpy/en/stable/wpilib.interfaces/MotorController.html#wpilib.interfaces.MotorController.setVoltage)) method when applying them to motors to compensate for “voltage sag” from the battery.
And in their doc on combining FeedForward with PID controls, WPILib uses setVoltage in their example:
public void tankDriveWithFeedforwardPID(double leftVelocitySetpoint, double rightVelocitySetpoint) { leftMotor.setVoltage(feedforward.calculate(leftVelocitySetpoint) + leftPID.calculate(leftEncoder.getRate(), leftVelocitySetpoint)); rightMotor.setVoltage(feedForward.calculate(rightVelocitySetpoint) + rightPID.calculate(rightEncoder.getRate(), rightVelocitySetpoint)); }
https://docs.wpilib.org/en/stable/docs/software/advanced-controls/controllers/feedforward.html
—
Reply to this email directly, [view it on GitHub](#25 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AZ2JPANJCUBUCQVAM2A5S434JEBK7AVCNFSM6AAAAACTDCRPU2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQMJTGI3TONBVG4).
You are receiving this because you commented.Message ID: ***@***.***>
|
|
and feed forward also compenstates some what for voltage sag, and it's just not a very big deal anyway. Even if you compensate for it, if more than like 3 motors are running you will not be able to avoid sag
…-------- Original Message --------
On Wednesday, 01/28/26 at 13:54 isabelle901 ***@***.***> wrote:
the problem with that is that setVoltage() expects a voltage as the input, while the PID controller is solving assuming a 0-1 range. So you would be putting 0-1 volts into the motor which would not work for obvious reasons. You could try multiplying by 12, but that is basically just what the set() method does anyway.
-------- Original Message --------
On Wednesday, 01/28/26 at 11:00 Iprobablydontknowwhatimdoing ***@***.***> wrote:
> Iprobablydontknowwhatimdoing left a comment [(IronRiders/rebuilt#25)](#25 (comment))
>
>> wristMotor.setVoltage() should be wristMotor.set()
>
> The docs say setVoltage is preferred:
>
>> Since feedforward voltages are physically meaningful, it is best to use the setVoltage() ([Java](https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/wpilibj/motorcontrol/MotorController.html#setVoltage(double)), [C++](https://github.wpilib.org/allwpilib/docs/release/cpp/classfrc_1_1_motor_controller.html#a613c23a3336e103876e433bcb8b5ad3e), [Python](https://robotpy.readthedocs.io/projects/robotpy/en/stable/wpilib.interfaces/MotorController.html#wpilib.interfaces.MotorController.setVoltage)) method when applying them to motors to compensate for “voltage sag” from the battery.
>
> And in their doc on combining FeedForward with PID controls, WPILib uses setVoltage in their example:
>
> public void tankDriveWithFeedforwardPID(double leftVelocitySetpoint, double rightVelocitySetpoint) { leftMotor.setVoltage(feedforward.calculate(leftVelocitySetpoint) + leftPID.calculate(leftEncoder.getRate(), leftVelocitySetpoint)); rightMotor.setVoltage(feedForward.calculate(rightVelocitySetpoint) + rightPID.calculate(rightEncoder.getRate(), rightVelocitySetpoint)); }
>
> https://docs.wpilib.org/en/stable/docs/software/advanced-controls/controllers/feedforward.html
>
> —
> Reply to this email directly, [view it on GitHub](#25 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AZ2JPANJCUBUCQVAM2A5S434JEBK7AVCNFSM6AAAAACTDCRPU2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQMJTGI3TONBVG4).
> You are receiving this because you commented.Message ID: ***@***.***>
|
|
I like the new constant names though! |
Amber-leaf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pona
No description provided.