def _add_casters(self): from parts import Capsule, Cylinder, Joint, Limits hips = self.hips wheel = self.wheel_left support = Cylinder((0.9 * self.hips.radius, 0.02, wheel.radii[0]), name='support') support.add_joint( Joint((0, 0, 0), rot=(0, 1, 0, 0), limits=Limits.zero(), name='hips')) hips.add_joint( Joint(hips.end_pos(-1), rot=(0, 1, 0, 0), limits=Limits.zero(), name='support')) hips.attach(support) # Automate caster position to same bottom level as wheels. offset_y = wheel.pos[1] - support.pos[1] for side_z in (-1, 1): caster = Capsule(0.49 * offset_y, 0, material=wheel.material, name='caster_' + side_z_name(side_z)) support.add_joint( Joint((0, 0, side_z * support.radii[2]), name=caster.name)) caster.add_joint(Joint((0, 0, 0), name=support.name)) support.attach(caster)
def _add_casters(self): from parts import Capsule, Cylinder, Joint, Limits hips = self.hips wheel = self.wheel_left support = Cylinder( (0.9*self.hips.radius,0.02,wheel.radii[0]), name='support') support.add_joint(Joint( (0,0,0), rot=(0,1,0,0), limits=Limits.zero(), name='hips')) hips.add_joint(Joint( hips.end_pos(-1), rot=(0,1,0,0), limits=Limits.zero(), name='support')) hips.attach(support) # Automate caster position to same bottom level as wheels. offset_y = wheel.pos[1] - support.pos[1] for side_z in (-1,1): caster = Capsule( 0.49*offset_y, 0, material=wheel.material, name='caster_'+side_z_name(side_z)) support.add_joint(Joint( (0,0,side_z*support.radii[2]), name=caster.name)) caster.add_joint(Joint((0,0,0), name=support.name)) support.attach(caster)
def __init__(self, side_x): from parts import A, Capsule, Joint, Limits, pi self.name = 'hand' self.wrist = wrist = Capsule(0.03, 0, name='wrist') wrist.add_joint( Joint(wrist.end_pos(0.3), rot=(0, 1, 0, 0), name='lower')) # Fingers for f in xrange(3): wrist.add_joint( Joint(wrist.end_pos(axis=(-side_x, -2, 2 * (f - 1))), rot=(side_x, 0, 0, 0), name='finger' + str(f))) finger = Finger(3) finger.name += str(f) wrist.attach(finger) # Thumb wrist.add_joint( Joint(wrist.end_pos(axis=(-side_x, 0, 1), half_spread_ratio=0), rot=(0, -side_x, 0, 0), limits=Limits.rot_x(A(-0.8, 0) * pi), name='thumbTwist')) thumbTwist = Capsule(0.015, 0.005, name='thumbTwist') thumbTwist.add_joint( Joint(thumbTwist.end_pos(0.2), rot=(0, 0, -side_x, 0), name='wrist')) thumbTwist.add_joint( Joint(thumbTwist.end_pos(-1, axis=(0, 0, -1), half_spread_ratio=-1), rot=(side_x, 0, 0, 0), name='thumb')) wrist.attach(thumbTwist) thumb = Finger(2, parent='thumbTwist') thumb.name = 'thumb' thumbTwist.attach(thumb)
def __init__(self, side_x): from parts import A, Capsule, Joint, Limits, pi self.name = 'hand' self.wrist = wrist = Capsule(0.03, 0, name='wrist') wrist.add_joint(Joint( wrist.end_pos(0.3), rot=(0,1,0,0), name='lower')) # Fingers for f in xrange(3): wrist.add_joint(Joint( wrist.end_pos(axis=(-side_x,-2,2*(f-1))), rot=(side_x,0,0,0), name='finger'+str(f))) finger = Finger(3) finger.name += str(f) wrist.attach(finger) # Thumb wrist.add_joint(Joint( wrist.end_pos(axis=(-side_x,0,1), half_spread_ratio=0), rot=(0,-side_x,0,0), limits=Limits.rot_x(A(-0.8,0)*pi), name='thumbTwist')) thumbTwist = Capsule(0.015, 0.005, name='thumbTwist') thumbTwist.add_joint(Joint( thumbTwist.end_pos(0.2), rot=(0,0,-side_x,0), name='wrist')) thumbTwist.add_joint(Joint( thumbTwist.end_pos(-1, axis=(0,0,-1), half_spread_ratio=-1), rot=(side_x,0,0,0), name='thumb')) wrist.attach(thumbTwist) thumb = Finger(2, parent='thumbTwist') thumb.name = 'thumb' thumbTwist.attach(thumb)
def __init__(self): from parts import A, Capsule, Joint, Limits, pi self.name = 'head' neck = Capsule(0.04, 0, name='neck') neck.add_joint( Joint(neck.end_pos(-0.3), rot=(0, 1, 0, 0), name='chest', limits=Limits.rot_x(A(-0.5, 0.5) * pi))) neck.add_joint( Joint(neck.end_pos(0.3), name='skull', limits=Limits.rot_x(A(-0.5, 0.1) * pi))) skull = Capsule(0.06, 0.01, name='skull') skull.add_joint(Joint(skull.end_pos(-1), name='neck')) neck.attach(skull) self.neck = neck self.skull = skull self._add_eye(-1) self._add_eye(1)
def __init__(self): from parts import A, Capsule, Joint, Limits, pi self.name = 'head' neck = Capsule(0.04, 0, name='neck') neck.add_joint(Joint( neck.end_pos(-0.3), rot=(0,1,0,0), name='chest', limits=Limits.rot_x(A(-0.5,0.5)*pi))) neck.add_joint(Joint( neck.end_pos(0.3), name='skull', limits=Limits.rot_x(A(-0.5,0.1)*pi))) skull = Capsule(0.06, 0.01, name='skull') skull.add_joint(Joint(skull.end_pos(-1), name='neck')) neck.attach(skull) self.neck = neck self.skull = skull self._add_eye(-1) self._add_eye(1)
def __init__(self, phalanx_count, parent='wrist'): from parts import A, Capsule, Joint, Limits, pi self.name = 'finger' # Phalanx 0 really is more of a metacarpal spread thing. # Just that the naming convention makes this code simpler. self.spread = current = Capsule(0.01, 0, name='spread') current.add_joint( Joint(current.end_pos(0.5), limits=Limits.rot_x(A(-1, 1) * 0.2 * pi), name=parent)) for n in xrange(phalanx_count): next = Capsule(0.01, 0.01, name='phalanx' + str(n)) next.add_joint( Joint(next.end_pos(0.5), rot=(0, 0, 1, 0), limits=Limits.rot_x(A(-0.01, 0.5) * pi), name=current.name)) current.add_joint( Joint(current.end_pos(-0.5), rot=(0, 0, 1, 0), name=next.name)) current.attach(next) current = next
def __init__(self, phalanx_count, parent='wrist'): from parts import A, Capsule, Joint, Limits, pi self.name = 'finger' # Phalanx 0 really is more of a metacarpal spread thing. # Just that the naming convention makes this code simpler. self.spread = current = Capsule(0.01, 0, name='spread') current.add_joint(Joint( current.end_pos(0.5), limits=Limits.rot_x(A(-1,1)*0.2*pi), name=parent)) for n in xrange(phalanx_count): next = Capsule(0.01, 0.01, name='phalanx'+str(n)) next.add_joint(Joint( next.end_pos(0.5), rot=(0,0,1,0), limits=Limits.rot_x(A(-0.01,0.5)*pi), name=current.name)) current.add_joint(Joint( current.end_pos(-0.5), rot=(0,0,1,0), name=next.name)) current.attach(next) current = next
def __init__(self): from mat import A, pi from parts import Capsule, Joint, Limits chest = Capsule(0.1, 0.0725, name='chest') chest.add_joint(Joint(chest.end_pos(0.5), name='head')) chest.add_joint(Joint( chest.end_pos(-0.5), name='abdomen', limits=Limits.rot_x(A(-0.1,0.5)*pi) )) abdomen = Capsule(0.08, 0.05, name='abdomen') abdomen.add_joint(Joint(abdomen.end_pos(0.5), name='chest')) abdomen.add_joint( Joint(abdomen.end_pos(-0.5), (0,1,0,0), name='base')) chest.attach(abdomen) chest.add_joint( Joint(chest.end_pos(1.4,(2.5,1,0)), (0,0,-1,0), name='arm_right')) chest.add_joint( Joint(chest.end_pos(1.4,(-2.5,1,0)), (0,0,1,0), name='arm_left')) chest.add_joint(Joint(chest.end_pos(), (0,1,0,0), name='head')) self.chest = chest self.abdomen = abdomen
def __init__(self): from mat import A, pi from parts import Capsule, Joint, Limits chest = Capsule(0.1, 0.0725, name='chest') chest.add_joint(Joint(chest.end_pos(0.5), name='head')) chest.add_joint( Joint(chest.end_pos(-0.5), name='abdomen', limits=Limits.rot_x(A(-0.1, 0.5) * pi))) abdomen = Capsule(0.08, 0.05, name='abdomen') abdomen.add_joint(Joint(abdomen.end_pos(0.5), name='chest')) abdomen.add_joint( Joint(abdomen.end_pos(-0.5), (0, 1, 0, 0), name='base')) chest.attach(abdomen) chest.add_joint( Joint(chest.end_pos(1.4, (2.5, 1, 0)), (0, 0, -1, 0), name='arm_right')) chest.add_joint( Joint(chest.end_pos(1.4, (-2.5, 1, 0)), (0, 0, 1, 0), name='arm_left')) chest.add_joint(Joint(chest.end_pos(), (0, 1, 0, 0), name='head')) self.chest = chest self.abdomen = abdomen