feat: Add mount for onboard electronics

This commit is contained in:
Leni Aniva 2024-07-21 23:34:02 -07:00
parent d898df6165
commit f665d0d53e
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
3 changed files with 55 additions and 23 deletions

View File

@ -52,26 +52,38 @@ class Parameters(Model):
wing_r1: MW.WingR = field(default_factory=lambda: MW.WingR(
name="r1",
shoulder_angle_bias = 15.0,
s0_top_hole=False,
s0_bot_hole=True,
))
wing_r2: MW.WingR = field(default_factory=lambda: MW.WingR(
name="r2",
s0_top_hole=True,
s0_bot_hole=True,
))
wing_r3: MW.WingR = field(default_factory=lambda: MW.WingR(
name="r3",
shoulder_angle_bias = 15.0,
s0_top_hole=True,
s0_bot_hole=False,
))
wing_l1: MW.WingL = field(default_factory=lambda: MW.WingL(
name="l1",
wrist_angle=-60.0,
s0_top_hole=False,
s0_bot_hole=True,
))
wing_l2: MW.WingL = field(default_factory=lambda: MW.WingL(
name="l2",
wrist_angle=-30.0,
shoulder_angle_bias = 15.0,
s0_top_hole=True,
s0_bot_hole=True,
))
wing_l3: MW.WingL = field(default_factory=lambda: MW.WingL(
name="l3",
wrist_angle=-0.0,
s0_top_hole=True,
s0_bot_hole=False,
))
trident: MT.Trident = field(default_factory=lambda: MT.Trident())

View File

@ -421,3 +421,9 @@ class Flexor:
a.constrain(tag_hole_back, f"{name_bracket_back}?conn_side", "Plane")
if tag_dir:
a.constrain(tag_dir, f"{name_bracket_front}?conn_mid", "Axis", param=0)
@dataclass
class ElectronicBoard:
hole_diam: float = 4.0

View File

@ -13,7 +13,7 @@ from nhf.parts.box import box_with_centre_holes, MountingBox, Hole
from nhf.parts.joints import HirthJoint
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
from nhf.touhou.houjuu_nue.electronics import LINEAR_ACTUATOR_10, LINEAR_ACTUATOR_50, ElectronicBoard
import nhf.utils
@dataclass(kw_only=True)
@ -38,6 +38,13 @@ class WingProfile(Model):
shoulder_mid_x: float = -125.0
shoulder_mid_y: float = 75.0
s0_hole_loc: Cq.Location = Cq.Location.from2d(-25, 33)
s0_hole_diam: float = 15.0
s0_top_hole: bool = False
s0_bot_hole: bool = True
electronic_board: ElectronicBoard = field(default_factory=lambda: ElectronicBoard())
s1_thickness: float = 25.0
elbow_joint: ElbowJoint = field(default_factory=lambda: ElbowJoint(
@ -171,7 +178,7 @@ class WingProfile(Model):
return result
@target(name="profile-s0", kind=TargetKind.DXF)
def profile_s0(self) -> Cq.Sketch:
def profile_s0(self, top: bool = True) -> Cq.Sketch:
tip_x = self.shoulder_tip_x
tip_y = self.shoulder_tip_y
mid_x = self.shoulder_mid_x
@ -197,6 +204,14 @@ class WingProfile(Model):
.circle(self.shoulder_joint.radius, mode='a')
.circle(self.shoulder_joint.bolt.diam_head / 2, mode='s')
)
top = top == self.flip
if (self.s0_top_hole and top) or (self.s0_bot_hole and not top):
sketch = (
sketch
.reset()
.push([self.s0_hole_loc.to2d_pos()])
.circle(self.s0_hole_diam / 2, mode='s')
)
return sketch
def outer_shell_s0(self) -> Cq.Workplane:
@ -260,19 +275,20 @@ class WingProfile(Model):
centred=(True, True),
flip_y=self.flip,
)
@submodel(name="spacer-s0-mid3")
def spacer_s0_mid3(self) -> MountingBox:
@submodel(name="spacer-s0-electronic")
def spacer_s0_electronic(self) -> MountingBox:
holes = [
Hole(x=30, y=80),
Hole(x=30, y=-80),
Hole(x=-30, y=80),
Hole(x=-30, y=-80),
]
return MountingBox(
holes=holes,
hole_diam=self.electronic_board.hole_diam,
length=self.root_height,
width=40,
thickness=self.spacer_thickness,
flip_y=self.flip
)
@submodel(name="spacer-s0-mid2")
def spacer_s0_mid2(self) -> MountingBox:
return MountingBox(
length=self.root_height,
width=60,
width=170,
centred=(True, True),
thickness=self.spacer_thickness,
flip_y=self.flip
)
@ -281,22 +297,21 @@ class WingProfile(Model):
base_dx = -(self.base_width - self.root_joint.child_width) / 2 - 10
base_dy = self.root_joint.hirth_joint.joint_height
loc_tip = Cq.Location(0, -self.shoulder_joint.parent_lip_width / 2)
mid_spacer_loc = (
Cq.Location.from2d(0, -self.shoulder_width/2) *
self.shoulder_axle_loc *
Cq.Location.rot2d(self.shoulder_joint.angle_neutral)
)
#mid_spacer_loc = (
# Cq.Location.from2d(0, -self.shoulder_width/2) *
# self.shoulder_axle_loc *
# Cq.Location.rot2d(self.shoulder_joint.angle_neutral)
#)
tags = [
("shoulder",
self.shoulder_axle_loc *
self.shoulder_joint.parent_arm_loc() *
loc_tip),
("base", Cq.Location.from2d(base_dx, base_dy, 90)),
("mid3", mid_spacer_loc * Cq.Location.from2d(90, 0)),
("mid2", mid_spacer_loc * Cq.Location.from2d(150, 0)),
("electronic", Cq.Location.from2d(-55, 75, 64)),
]
result = extrude_with_markers(
self.profile_s0(),
self.profile_s0(top=top),
self.panel_thickness,
tags,
reverse=not top,
@ -326,8 +341,7 @@ class WingProfile(Model):
for o, tag in [
(self.spacer_s0_shoulder().generate(), "shoulder"),
(self.spacer_s0_base().generate(), "base"),
(self.spacer_s0_mid3().generate(), "mid3"),
(self.spacer_s0_mid2().generate(), "mid2"),
(self.spacer_s0_electronic().generate(), "electronic"),
]:
top_tag, bot_tag = "top", "bot"
if self.flip: