Skip to content

Instantly share code, notes, and snippets.

@Apsu Apsu/cotript.py
Last active Feb 14, 2019

Embed
What would you like to do?
Coplanar Tripteron Inverse Kinematics
#!/usr/bin/env python
from __future__ import print_function
import math
angle = math.radians(35) # Arm offset angle
t = math.tan(angle) # Store tangent
# Tower rotations
beta_a = math.radians(120)
gamma_a = math.radians(240)
# Actuator coefficients
alpha_x = 0 # sin(0) = 0 * t = 0
alpha_y = t # cos(0) = 1 * t = t
beta_x = math.sin(beta_a) * t
beta_y = math.cos(beta_a) * t
gamma_x = math.sin(gamma_a) * t
gamma_y = math.cos(gamma_a) * t
# Platform movement vector
x = 0
y = 0
z = 1
# Inverse Kinematics
alpha = x*alpha_x - y*alpha_y + z
beta = x*beta_x - y*beta_y + z
gamma = x*gamma_x - y*gamma_y + z
print("alpha: {}; beta: {}; gamma: {}".format(alpha, beta, gamma))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.