feat: Actuator mount position rel. to parent

This commit is contained in:
Leni Aniva 2024-07-21 21:49:28 -07:00
parent 71da0c10a7
commit 9ab6a1aa69
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
3 changed files with 17 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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