Skip to content
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

Wrist initial code #27

Merged
merged 4 commits into from
Jan 24, 2024
Merged

Wrist initial code #27

merged 4 commits into from
Jan 24, 2024

Conversation

nmp2965
Copy link
Collaborator

@nmp2965 nmp2965 commented Jan 22, 2024

Here it is. Enjoy :)

amb2127 and others added 2 commits January 14, 2024 00:07
…rom yesterday. also added motor and encoder ports to the list
@nmp2965 nmp2965 linked an issue Jan 22, 2024 that may be closed by this pull request
BaseStatusSignal.refreshAll(wristPosition, wristVelocity, wristCurrent,
wristTemp, wristVoltage);
//Not sure if this is the fastest way to get encoder pos
//needs optimization!!!!!!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Split this into wristRelativePosition and wristAbsolutePosition, and then update accordingly

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you set the different positions to? Is relativePosition relative to the ground, and if so would you then set that to its position + the arm's position and keep absolute as wristMotor.getPosition()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nvm I think I can figure it out based on the arm class

public double getWristDegrees() {
//may need to add arm degrees here
return inputs.wristPosition;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This returns wrist rotations


BaseStatusSignal.setUpdateFrequencyForAll(50, wristPosition, wristVelocity, wristVoltage, wristCurrent, wristTemp);

wristMotor.optimizeBusUtilization();
Copy link
Collaborator

Choose a reason for hiding this comment

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

do this for the encoder as well

}

public void setPosition(double position){
wristMotor.setControl(motionMagicControl.withPosition(position).withSlot(0));
Copy link
Collaborator

Choose a reason for hiding this comment

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

.withEnableFOC(true).withOverrideBrakeDurNeutral(true) 😉

//may need to add arm degrees here
return inputs.wristPosition;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

you need to add a way to call the IO methods since WristIO is private (and should stay that way)

double currentTime = Timer.getFPGATimestamp();
io.setPosition(positionInDegrees);
Logger.recordOutput("Wrist target position", positionInDegrees);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe do this in superstructure

Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't want any subsystem specific functions to be intrinsically reliant on another subsystem, aside from vision processing

Copy link
Collaborator

@amb2127 amb2127 left a comment

Choose a reason for hiding this comment

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

just a couple nitpicks but they're pretty important

-fixed getWristDegrees method to actually get degrees instead of rotations
-split position status signal into absolutePosition and relativePosition
-made other changes amber suggested (thanks amber!)
-deleted setWristVoltage bc it didn't do anything and wasn't used
Copy link
Collaborator

@amb2127 amb2127 left a comment

Choose a reason for hiding this comment

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

Good!

@amb2127 amb2127 merged commit b1e4309 into main Jan 24, 2024
1 check passed
@amb2127 amb2127 deleted the wrist branch February 10, 2024 03:02
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.

Wrist - Write and merge initial code
2 participants