Skip to content

fix: move derived actuator constants to calculated properties instead… - #489

Merged
senthurayyappan merged 8 commits into
mainfrom
487-updating-the-motor-torque-constant-does-not-propagate-to-other-constants-in-dephypy
Oct 13, 2025
Merged

fix: move derived actuator constants to calculated properties instead…#489
senthurayyappan merged 8 commits into
mainfrom
487-updating-the-motor-torque-constant-does-not-propagate-to-other-constants-in-dephypy

Conversation

@tkevinbest

Copy link
Copy Markdown
Member

… of redundant hard-coded vals.

This PR fixes #487.

Comment on lines +699 to +701
@MOTOR_CONSTANTS.setter
def MOTOR_CONSTANTS(self, value: MOTOR_CONSTANTS) -> None:
"""

@senthurayyappan senthurayyappan Sep 19, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Requires validation for the incoming MOTOR_CONSTANTS data class value

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Got it! Fixed in 7a9e677

@senthurayyappan senthurayyappan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great! The MOTOR_CONSTANTS setter requires some validation to preserve the structure/attributes of the initial MOTOR_CONSTANTS dataclass, as it is possible to miss an attribute and overwrite it.

misc: add unit tests for dephy actuator
@tkevinbest

Copy link
Copy Markdown
Member Author

Done - I also added some unit tests to make sure the validation worked, as well as the constants calculation. Fixed a copilot bug too.

@tkevinbest

Copy link
Copy Markdown
Member Author

@senthurayyappan great, I pulled in the latest main and all the checks pass finally. I'm marking this completed on my end :)

@senthurayyappan senthurayyappan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me!

@senthurayyappan
senthurayyappan merged commit 136799b into main Oct 13, 2025
5 checks passed
@senthurayyappan
senthurayyappan deleted the 487-updating-the-motor-torque-constant-does-not-propagate-to-other-constants-in-dephypy branch October 13, 2025 14:56
@tkevinbest

Copy link
Copy Markdown
Member Author

@senthurayyappan I found an issue with how I did this. The setter method is only called when assigning entirely new motor_constants objects. If you try to just write to one of them like osl.ankle.MOTOR_CONSTANTS.NM_PER_AMP = .1, the setter logic doesn't get called. I think we can fix this with __setattr__ overloads or something like that...

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.

Updating the motor torque constant does not propagate to other constants in dephy.py

2 participants