Skip to content

Instantly share code, notes, and snippets.

@RicoJia
Created December 11, 2020 22:40
Show Gist options
  • Select an option

  • Save RicoJia/7b5755aa7a556a613839120602e8aaed to your computer and use it in GitHub Desktop.

Select an option

Save RicoJia/7b5755aa7a556a613839120602e8aaed to your computer and use it in GitHub Desktop.
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