Skip to content

Instantly share code, notes, and snippets.

@philipptempel
Created September 23, 2019 13:35
Show Gist options
  • Save philipptempel/a79bf79355a76900c6dc52b402d2d5a8 to your computer and use it in GitHub Desktop.
Save philipptempel/a79bf79355a76900c6dc52b402d2d5a8 to your computer and use it in GitHub Desktop.
import cdpyr
from sample import robots
import timeit
def main():
# sample robot to use
r = robots.ipanema_cuboid()
# a sample pose to use
pose = cdpyr.motion.Pose()
# our kinematics solver using the pulley-based kinematics
kinsolver = cdpyr.algorithms.kinematics.KinematicsSolver.STANDARD
structmatsolver = cdpyr.algorithms.structurematrix.StructureMatrixSolver
# and solve it
cable_length, cable_direction, unit_direction = kinsolver.backward(robot=r, pose=pose)
# timeit.timeit(
# 'kinsolver.backward(robot=r, pose=pose)',
# globals={
# 'r': r,
# 'pose': pose,
# 'kinsolver': kinsolver
# }
# )
print(cable_length)
print(cable_direction)
print(unit_direction)
if __name__ == "__main__":
main()
@philipptempel
Copy link
Author

Create directory sandbox and place this content into file kinematics.py
Then just run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment