You are browsing as a guest. Sign up (or log in) to start making projects!

1h 52m 27s logged

Working on a new pipeline!
Input –> Wall Reconstruction      (holds, wall angle, topology) –>   Initial Climber State       (current stance + body model) –>  Context Analyzer (Cheap)         • Hold distances      • Wall angle      • Reach estimate      • Body orientation      • Route direction –>  Relevant Movement Primitives –> Static Reach Generator              Dyno Generator      Match Generator     Foot Swap Generator    Cross Through Generator  Heel Hook Generator       –> Generate transitions to get to that specific stance –> Lazy A* search –> Inverse Kinematics finds torso orientation (roll, pitch, yaw etc) –> Statics resolves forces to determine if it is feasible without falling –> Cost evaluation scores the routes –> Optimal beta returned

from models.climber import Climber
from models.pose import Pose
from models.stance import Stance
from models.wall 
import Wall
class IKSolver:    def solve(        self,        stance: Stance,        wall: Wall,        climber: Climber,    ) -> Pose | None:             
 # ----------------------------        
# Retrieve holds        
# ----------------------------       
 lh = wall.get_hold(stance.left_hand)        
rh = wall.get_hold(stance.right_hand)        
lf = wall.get_hold(stance.left_foot)        
rf = wall.get_hold(stance.right_foot)        
# ----------------------------        
# Initial torso estimate        
# ----------------------------       
 torso_x = (lh.x + rh.x + lf.x + rf.x) / 4       
 torso_y = (lh.y + rh.y + lf.y + rf.y) / 4        
torso_z = (lh.z + rh.z + lf.z + rf.z) / 4       
 # ----------------------------        
# Reach limits        
# ----------------------------        
arm_reach = climber.upper_arm + climber.forearm        leg_reach = climber.thigh + climber.shin        
# Approximate shoulder locations        
left_shoulder = (            torso_x - climber.shoulder_width / 2,            torso_y,            torso_z,        )        
right_shoulder = (            torso_x + climber.shoulder_width / 2,            torso_y,            torso_z,        )        
# Approximate hip locations        
left_hip = (            torso_x - climber.hip_width / 2,            torso_y,            torso_z,        )        
right_hip = (            torso_x + climber.hip_width / 2,            torso_y,            torso_z,        )       
 # ----------------------------        
# Distance helper       
 # ----------------------------        
def distance(a, b):            return sqrt(                (a[0] - b[0]) ** 2                + (a[1] - b[1]) ** 2                + (a[2] - b[2]) ** 2            )        
# ----------------------------        
# Check each limb       
 # ----------------------------        
if distance(left_shoulder, (lh.x, lh.y, lh.z)) > arm_reach:            return None        
if distance(right_shoulder, (rh.x, rh.y, rh.z)) > arm_reach:            return None        
if distance(left_hip, (lf.x, lf.y, lf.z)) > leg_reach:            return None        
if distance(right_hip, (rf.x, rf.y, rf.z)) > leg_reach:            return None        
# ----------------------------        
# Valid pose        
# ----------------------------        
return Pose(            torso_x=torso_x,            torso_y=torso_y,            torso_z=torso_z,            roll=0.0,            pitch=0.0,            yaw=0.0,        )```
0
3

Comments 0

No comments yet. Be the first!