From 9ab6a1aa69ce213bbb57f0860497500ad065d0ee Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 21 Jul 2024 21:49:28 -0700 Subject: [PATCH] feat: Actuator mount position rel. to parent --- nhf/touhou/houjuu_nue/electronics.py | 2 +- nhf/touhou/houjuu_nue/joints.py | 16 +++++++++++----- nhf/touhou/houjuu_nue/wing.py | 6 +++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/nhf/touhou/houjuu_nue/electronics.py b/nhf/touhou/houjuu_nue/electronics.py index 26e9386..37c31ac 100644 --- a/nhf/touhou/houjuu_nue/electronics.py +++ b/nhf/touhou/houjuu_nue/electronics.py @@ -261,7 +261,7 @@ class Flexor: """ motion_span: float - actuator: LinearActuator = LINEAR_ACTUATOR_30 + actuator: LinearActuator = LINEAR_ACTUATOR_50 nut: HexNut = LINEAR_ACTUATOR_HEX_NUT bolt: FlatHeadBolt = LINEAR_ACTUATOR_BOLT bracket: MountingBracket = LINEAR_ACTUATOR_BRACKET diff --git a/nhf/touhou/houjuu_nue/joints.py b/nhf/touhou/houjuu_nue/joints.py index 6bc40e4..e3d5595 100644 --- a/nhf/touhou/houjuu_nue/joints.py +++ b/nhf/touhou/houjuu_nue/joints.py @@ -8,7 +8,7 @@ from nhf.parts.springs import TorsionSpring from nhf.parts.fasteners import FlatHeadBolt, HexNut, ThreaddedKnob from nhf.parts.joints import TorsionJoint, HirthJoint from nhf.parts.box import Hole, MountingBox, box_with_centre_holes -from nhf.touhou.houjuu_nue.electronics import Flexor +from nhf.touhou.houjuu_nue.electronics import Flexor, LinearActuator import nhf.utils TOL = 1e-6 @@ -879,15 +879,21 @@ class ElbowJoint(Model): angle_neutral: float = 30.0 + actuator: LinearActuator flexor: Flexor = None - flexor_offset_angle: float = 30.0 - flexor_mount_rot: float = 95.0 + # Rotates the entire flexor + flexor_offset_angle: float = 0 + # Rotates the surface of the mount + flexor_mount_rot: float = 90.0 def __post_init__(self): assert self.child_arm_radius > self.disk_joint.radius_housing assert self.parent_arm_radius > self.disk_joint.radius_housing self.disk_joint.tongue_length = self.child_arm_radius - self.disk_joint.radius_disk - self.lip_thickness / 2 - self.flexor = Flexor(motion_span=self.motion_span) + self.flexor = Flexor( + actuator=self.actuator, + motion_span=self.motion_span + ) @property def total_thickness(self): @@ -934,7 +940,7 @@ class ElbowJoint(Model): loc_mount_orient = Cq.Location.rot2d(self.flexor_mount_rot * (-1 if child else 1)) # Moves the hole to be some distance apart from 0 loc_span = Cq.Location.from2d(self.flexor.mount_loc_r, 0) - r = 0 if child else self.flexor.mount_loc_angle + r = (-self.flexor.mount_loc_angle if child else 0) + 180 loc_rot = Cq.Location.rot2d(r + self.flexor_offset_angle) return loc_rot * loc_span * loc_mount_orient * loc_mount * loc_thickness diff --git a/nhf/touhou/houjuu_nue/wing.py b/nhf/touhou/houjuu_nue/wing.py index 6941bee..f34869a 100644 --- a/nhf/touhou/houjuu_nue/wing.py +++ b/nhf/touhou/houjuu_nue/wing.py @@ -11,8 +11,9 @@ from nhf import Material, Role from nhf.build import Model, TargetKind, target, assembly, submodel from nhf.parts.box import box_with_centre_holes, MountingBox, Hole from nhf.parts.joints import HirthJoint -from nhf.touhou.houjuu_nue.joints import RootJoint, ShoulderJoint, ElbowJoint, DiskJoint from nhf.parts.planar import extrude_with_markers +from nhf.touhou.houjuu_nue.joints import RootJoint, ShoulderJoint, ElbowJoint, DiskJoint +from nhf.touhou.houjuu_nue.electronics import LINEAR_ACTUATOR_10, LINEAR_ACTUATOR_50 import nhf.utils @dataclass(kw_only=True) @@ -45,6 +46,8 @@ class WingProfile(Model): ), hole_diam=6.0, angle_neutral=15.0, + actuator=LINEAR_ACTUATOR_50, + flexor_offset_angle=-15, )) # Distance between the two spacers on the elbow, halved elbow_h2: float = 5.0 @@ -63,6 +66,7 @@ class WingProfile(Model): parent_arm_radius=30.0, hole_diam=4.0, angle_neutral=-30.0, + actuator=LINEAR_ACTUATOR_10, )) # Distance between the two spacers on the elbow, halved wrist_h2: float = 5.0