Created
December 11, 2020 22:40
-
-
Save RicoJia/7b5755aa7a556a613839120602e8aaed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pybullet as p | |
| #This is essential, as this disables the default motor imposed by bullet. These default motors prevent overspeeding, and functions as | |
| #friction drives. | |
| p.setJointMotorControl2(self.model_unique_id, self.secondary_joint_id, | |
| controlMode=p.VELOCITY_CONTROL, force=0) | |
| spring_angle = self.get_joint_angle() | |
| torque = spring_angle * self.torque_k | |
| #apply external force | |
| self.apply_external_force(force= torque * self.scaled_force_axis_c, link_index=self.child_link_id, position=self.force_pos_c) | |
| self.apply_external_force(force= torque * self.scaled_force_axis_p, link_index=self.parent_link_id, position=self.force_pos_p) | |
| # print("torque: ", torque) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment