refactor: Separate options for Wing{L,R}

This commit is contained in:
Leni Aniva 2024-07-24 22:24:23 -07:00
parent ac6710eeeb
commit a6ddfec552
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
3 changed files with 16 additions and 12 deletions

View File

@ -340,6 +340,7 @@ class Flexor:
"""
motion_span: float
arm_radius: Optional[float] = None
pos_smaller: bool = True
actuator: LinearActuator = LINEAR_ACTUATOR_50
nut: HexNut = LINEAR_ACTUATOR_HEX_NUT
@ -358,6 +359,7 @@ class Flexor:
d_closed=self.actuator.conn_length,
theta=math.radians(self.motion_span),
r=self.arm_radius,
smaller=self.pos_smaller,
)
return r, math.degrees(phi), r_

View File

@ -1074,6 +1074,7 @@ class ElbowJoint(Model):
# Rotates the surface of the mount relative to radially inwards
flexor_mount_angle_parent: float = 0
flexor_mount_angle_child: float = -90
flexor_pos_smaller: bool = True
flexor_child_arm_radius: Optional[float] = None
def __post_init__(self):
@ -1084,6 +1085,7 @@ class ElbowJoint(Model):
self.flexor = Flexor(
actuator=self.actuator,
motion_span=self.motion_span,
pos_smaller=self.flexor_pos_smaller,
arm_radius=self.flexor_child_arm_radius,
)

View File

@ -40,8 +40,6 @@ WRIST_PARAMS = dict(
lip_length=30,
child_arm_radius=23.0,
parent_arm_radius=30.0,
hole_diam=4.0,
angle_neutral=0.0,
actuator=LINEAR_ACTUATOR_10,
flexor_offset_angle=30.0,
flexor_child_arm_radius=None,
@ -116,12 +114,10 @@ class WingProfile(Model):
self.elbow_top_loc = self.elbow_bot_loc * Cq.Location.from2d(0, self.elbow_height)
self.wrist_top_loc = self.wrist_bot_loc * Cq.Location.from2d(0, self.wrist_height)
if self.flip:
self.elbow_axle_pos = 1 - self.elbow_axle_pos
self.elbow_axle_loc = self.elbow_bot_loc * Cq.Location.from2d(0, self.elbow_height * self.elbow_axle_pos)
if self.flip:
self.wrist_axle_pos = 1 - self.wrist_axle_pos
self.wrist_axle_loc = self.wrist_bot_loc * Cq.Location.from2d(0, self.wrist_height * self.wrist_axle_pos)
self.elbow_axle_loc = self.elbow_bot_loc * \
Cq.Location.from2d(0, self.elbow_height * self.elbow_axle_pos)
self.wrist_axle_loc = self.wrist_bot_loc * \
Cq.Location.from2d(0, self.wrist_height * self.wrist_axle_pos)
assert self.elbow_joint.total_thickness < min(self.s1_thickness, self.s2_thickness)
assert self.wrist_joint.total_thickness < min(self.s2_thickness, self.s3_thickness)
@ -1068,6 +1064,7 @@ class WingR(WingProfile):
wrist_height: float = 60.0
wrist_joint: ElbowJoint = field(default_factory=lambda: ElbowJoint(
flip=True,
angle_neutral=0.0,
**WRIST_PARAMS
))
@ -1292,14 +1289,17 @@ class WingL(WingProfile):
elbow_rotate: float = 15.0
elbow_joint: ElbowJoint = field(default_factory=lambda: ElbowJoint(
angle_neutral=30.0,
flexor_mount_angle_child=180,
flexor_mount_angle_child=170,
flexor_mount_angle_parent=-30,
flexor_offset_angle=15,
child_lip_extra_length=5.0,
flexor_child_arm_radius=60.0,
flexor_pos_smaller=False,
flip=True,
**ELBOW_PARAMS
))
wrist_angle: float = -45.0
wrist_angle: float = 0.0
wrist_bot_loc: Cq.Location = Cq.Location.from2d(460.0, -10.0, -45.0)
wrist_height: float = 43.0
wrist_joint: ElbowJoint = field(default_factory=lambda: ElbowJoint(
@ -1316,7 +1316,7 @@ class WingL(WingProfile):
arrow_height: float = 120.0
flip: bool = True
elbow_axle_pos: float = 0.4
elbow_axle_pos: float = 0.5
wrist_axle_pos: float = 0.5
elbow_joint_overlap_median: float = 0.5
wrist_joint_overlap_median: float = 0.5
@ -1326,7 +1326,7 @@ class WingL(WingProfile):
assert self.wrist_height <= self.shoulder_joint.height
self.wrist_bot_loc = self.wrist_bot_loc.with_angle_2d(self.wrist_angle)
self.wrist_joint.angle_neutral = self.wrist_bot_loc.to2d_rot() + 30.0
self.wrist_joint.angle_neutral = self.wrist_bot_loc.to2d_rot() + 50.0
self.wrist_rotate = -self.wrist_joint.angle_neutral
self.shoulder_joint.flip = True