-
Notifications
You must be signed in to change notification settings - Fork 416
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
Exposed function get_joint_motor_torques with unit tests #1585
Conversation
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.
Thanks for contributing this! A couple of doc comments and a test suggestion:
* | ||
* @return Array of torques on each joint | ||
*/ | ||
std::vector<float> getJointMotorTorques(double fixedTimeStep); |
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.
Also add the param documentation here so the web doc generation will pick it up.
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.
@aclegg3 We would need to add these two new calls to the JS binding then as well.
src/esp/physics/ArticulatedObject.h
Outdated
/** | ||
* @brief Get the torques on each joint | ||
* | ||
* @return Array of torques on each joint |
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.
Technically returns a vector of torques. You can return an array and it will be converted by PyBind11 as a numpy array
I think I've addressed all the issues! Lmk what you think. (For some reason this pylint is failing on GitHub but is fine locally) |
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.
Looking good overall. A couple minor corrections:
Co-authored-by: Alexander Clegg <alexanderwclegg@gmail.com>
Co-authored-by: Alexander Clegg <alexanderwclegg@gmail.com>
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.
clang-tidy resolutions
Co-authored-by: Alexander Clegg <alexanderwclegg@gmail.com>
Co-authored-by: Alexander Clegg <alexanderwclegg@gmail.com>
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.
New clang-tidy clean-up
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.
You actually want to throw an exception here, not a string right?
Co-authored-by: Alexander Clegg <alexanderwclegg@gmail.com>
Co-authored-by: Alexander Clegg <alexanderwclegg@gmail.com>
Co-authored-by: Alexander Clegg <alexanderwclegg@gmail.com>
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.
Looks good. Thanks for your contribution, @SimarKareer!
When the tests pass, good to squash-merge. 🎉
Motivation and Context
This change allows a user in python to get the torques applied by each joint motor. Currently only implemented for non-spherical joints. I exposed this so I could implement a reward function which relies on joint torques.
How Has This Been Tested
I added test cases in tests/test_physics.py. Specifically I moved motors and ensured that the torque values were sufficiently high. Then after the motors reached their target I ensured that torques were sufficiently low.
Types of changes
Checklist