Skip to content

Conversation

lizlooney
Copy link
Collaborator

Added components for ExpansionHubServo and ExpansionHubMotor.

Added start and update methods to components.

Added code to run_opmode to print stacktrace if an error occurs.

Added start and update methods to components.

Added code to run_opmode to print stacktrace if an error occurs.
@lizlooney lizlooney requested a review from alan412 August 5, 2025 05:19
def isHubConnected(self) -> bool:
return self.expansion_hub_motor.isHubConnected()

def getEncoder(self) -> float:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought encoder ticks were int instead of float

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's float in the class from Thad. See

def getEncoderVelocity(self) -> float:
return self.expansion_hub_motor.getEncoderVelocity()

def setReversed(self, reversed: bool):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need a getReversed as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably, but it will need to be added here

def resetEncoder(self):
self.expansion_hub_motor.resetEncoder()

def getVelocityPidConstants(self) -> expansion_hub.ExpansionHubPidConstants:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need a set as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe. It will need to be added here as well. We should talk to Thad.

def getVelocityPidConstants(self) -> expansion_hub.ExpansionHubPidConstants:
return self.expansion_hub_motor.getVelocityPidConstants()

def getPositionPidConstants(self) -> expansion_hub.ExpansionHubPidConstants:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need a set as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe. It will need to be added here as well. We should talk to Thad.

def set(self, value: float):
self.expansion_hub_servo.set(value)

def setAngle(self, degrees: float):
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this takes degrees, should it be setAngleDegrees?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's just setAngle here. We can talk about changing it with Thad and others.

Removed empty start, update, and stop methods from component subclasses.
@lizlooney lizlooney requested a review from alan412 August 6, 2025 01:30
Copy link
Collaborator

@alan412 alan412 left a comment

Choose a reason for hiding this comment

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

I put a question out to thad on slack. We can fix those items in a later PR after he responds.

@alan412 alan412 merged commit c4e4e89 into wpilibsuite:main Aug 6, 2025
1 check passed
@lizlooney lizlooney deleted the pr_expansion_hub_components branch August 6, 2025 02:21
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