Skip to content

Instantly share code, notes, and snippets.

@Apsu
Last active February 14, 2019 13:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Apsu/b77c7e8f8c7c9ad64ed24964022e5afb to your computer and use it in GitHub Desktop.
Save Apsu/b77c7e8f8c7c9ad64ed24964022e5afb to your computer and use it in GitHub Desktop.
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