Add flight controller

Signed-off-by: Arnaud Morin <arnaud.gfpv@mailops.fr>
This commit is contained in:
Arnaud Morin
2026-09-05 14:47:42 +02:00
parent 61025489a4
commit bfb87fbee8
5 changed files with 117 additions and 16 deletions

83
fc.py Normal file
View File

@@ -0,0 +1,83 @@
# @author Arnaud Morin <arnaud.gfpv@mailops.fr>
# SPDX-License-Identifier: Apache-2.0
#
import cadquery as cq
# A flight controller is not a material, it is a stack: two boards, their
# spacers, and everything soldered to them. This models only the envelope, as
# one solid, so the density is FR4's -- bare PCB -- and the dense parts (FETs,
# inductors, connectors) stand in for the air between the boards. It lands the
# block at about 12 g, which is what a real 25.5 mm FC plus 4-in-1 ESC weighs.
PCB_DENSITY = 1.85e-3 # g/mm3, FR4
def fc():
box = (cq.Workplane("XY")
.box(33, 33, 8, centered=(True, True, True))
.edges('Z')
.fillet(5)
)
# Remove extra for standoff
cut = (cq.Workplane("XY")
.pushPoints([
(25.5/2, 25.5/2),
(25.5/2, -25.5/2),
(-25.5/2, 25.5/2),
(-25.5/2, -25.5/2),
])
.circle(7)
.extrude(5)
.translate((0,0,1.6/2))
)
box = box.cut(cut).cut(cut.mirror("XY"))
# Standoff
sta = (cq.Workplane("XY")
.pushPoints([
(25.5/2, 25.5/2),
(25.5/2, -25.5/2),
(-25.5/2, 25.5/2),
(-25.5/2, -25.5/2),
])
.circle(2.5)
.extrude(5, both=True)
.translate((0,0,-2))
)
box = box.union(sta)
# holes in standoff
cut = (cq.Workplane("XY")
.pushPoints([
(25.5/2, 25.5/2),
(25.5/2, -25.5/2),
(-25.5/2, 25.5/2),
(-25.5/2, -25.5/2),
])
.circle(1.2)
.extrude(10, both=True)
)
box = box.cut(cut)
# Make Z 0
box = box.translate((0,0,7))
return box
result = fc()
assert result.solids().size() == 1, "fc is not one solid"
if "show_object" not in globals(): # running outside CQ-editor
def show_object(*args, **kwargs):
pass
show_object(result)
if __name__ == "__main__":
print("fc %.2f g" % (result.val().Volume() * PCB_DENSITY))