From 8a280410a02c7a7d57758b211d2bc3777034d199 Mon Sep 17 00:00:00 2001 From: Marcus Grieger Date: Mon, 5 Feb 2024 22:36:53 +0100 Subject: [PATCH] Moved ik.py to python package --- CMakeLists.txt | 4 ---- python/ik.py | 42 ------------------------------------------ 2 files changed, 46 deletions(-) delete mode 100644 python/ik.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a22b66..596874d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,10 +77,6 @@ install( DESTINATION share/${PROJECT_NAME} ) -install( - FILES .setup_assistant DESTINATION share/${PROJECT_NAME} -) - install(TARGETS hexapod_robot_ik_server DESTINATION lib/${PROJECT_NAME} diff --git a/python/ik.py b/python/ik.py deleted file mode 100644 index 4e6d98e..0000000 --- a/python/ik.py +++ /dev/null @@ -1,42 +0,0 @@ -import math - - -def ik(side, x, y, z): - - c = 20 - f = 80 - t = 130 - - ff = f*f - tt = t*t - - print() - print(f"ik {side} {x} {y} {z}") - - if side == 'l': - x = -x - - coxa_angle = math.atan2(y,x) - - r = math.sqrt(x*x + y * y) - c - print(f"r: {r}") - - rr = r*r - zz = z*z - dd = rr + zz - d = math.sqrt(dd) - - print(f"coxa_angle: {coxa_angle}") - - femur_angle = math.acos((ff + dd - tt) / (2 * f * d)) + math.acos(-z/d) - math.pi/2 - print(f"femur_angle: {femur_angle}") - tibia_angle = math.acos((tt + ff - dd) / (2 * t * f)) - math.pi/2 - print(f"tibia_angle: {tibia_angle}") - - return(coxa_angle, femur_angle, tibia_angle) - -print(ik('l', -100, 0, -130)) -print(ik('r', 100, 0, -130)) - -print(ik('l', -120, 0, -130)) -print(ik('r', 120, 0, -130))