-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixes DCMotor clipping for negative power and adds actuator tests #2300
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
base: main
Are you sure you want to change the base?
Fixes DCMotor clipping for negative power and adds actuator tests #2300
Conversation
hmm looks like the DC motor and environment tests are both failing, along with a few others, but not sure if they are all related to this change |
It seems there is something happening with the ActuatorNetLSTM actuators in AnymalC that is producing nan values. Will continue investigating. @Mayankm96 anything about this spark ideas? |
Signed-off-by: James Tigue <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
@@ -90,7 +90,9 @@ def compute( | |||
self.computed_effort = torques.reshape(self._num_envs, self.num_joints) | |||
|
|||
# clip the computed effort based on the motor limits | |||
self.applied_effort = self._clip_effort(self.computed_effort) | |||
self.applied_effort = torch.clip( |
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.
Hm is there a reason why the actuator net doing an additional clipping? It should just use the DC motor characteristics
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.
This is trying to handle the added torque speed curve outside the effort limit that is interacting with the Anymal-C net actuator. I fixed the environment tests but its causing issues in the benchmarking. (see other comment in DC motor)
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.
@Mayankm96 I can't seem to get the benchmarking for Anymal-C to resolve with the new DCMotor. Do you know how that environment's ActuatorNetLSTM network was trained? Will we ever get agreement if the DCMotor clipping has changed?
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.
maybe @pascal-roth or @ClemensSchwarke might know as well?
gt_vel_at_effort_lim = self._joint_vel > self._vel_at_effort_lim | ||
lt_vel_at_neg_effort_lim = self._joint_vel < -self._vel_at_effort_lim | ||
clamped[gt_vel_at_effort_lim] = torque_speed_top[gt_vel_at_effort_lim] | ||
clamped[lt_vel_at_neg_effort_lim] = torque_speed_bottom[lt_vel_at_neg_effort_lim] |
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.
I don't think we need to do recomputation here since (torque_speed_bottom, torque_speed_top) shouldn't lie outside (-effort_limit, effort_limit) for cases where velocity is higher than the actual velocity limits.
Maybe I misunderstand a bit, but shouldn't just the clipping once be sufficient?
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.
what this handles is the event that the joint if forced to higher velocities from outside forces like gravity when landing after a jump. A motor will provide resistivity torque regardless of an "Effort limit". It may damage circuits, motors, or mechanical components when it does it but the actuator will try to resist.
It a pretty specific use case so i could see having this be configurable if people want to model that.
It is likely a cause of the issues I am seeing with the Anymal-C LSTM net actuators in benchmarking.
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.
ah might make sense to also draw -satuation_effort and also only shade the region within the velocity limit? Otherwise it may not get confusing that shaded region lays outside the bounds of the 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.
Description
This PR adds tests for actuator initialization, configuration, and computation for Implicit, IdealPD, and DC motor actuators.
This PR also updates the DCMotor model to clip based on a four quadrant DC motor model. This will fix improper clipping in the negative power regions (i.e. positive torque and negative velocity or negative torque and positive velocity).
NOTE: This PR is dependant on the pytest migration in: 2034
This PR includes changes made in 2291 and would be an alternate candidate.
Fixes #2139
Type of change
Screenshots
Checklist
pre-commit
checks with./isaaclab.sh --format
config/extension.toml
fileCONTRIBUTORS.md
or my name already exists there