建立方向盘项目初始版本

This commit is contained in:
2026-10-29 22:04:55 +08:00
commit 9962cbfbce
834 changed files with 1519203 additions and 0 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,70 @@
from pathlib import Path
import math, json, os, traceback, time
import FreeCAD as A, FreeCADGui as G, Part, Mesh, MeshPart, Import
V=A.Vector
root=Path(r'C:\projects\wheel')
out=root/'models'/'encoder_standoff_plate_print'
try:
src=A.openDocument(str(root/'models'/'symmetric_corner_18_concept'/'Assembly_对称角码装配_概念.FCStd'))
src.recompute()
plate=src.getObject('EncoderPlateConcept').Shape.copy()
assert plate.isValid() and len(plate.Solids)==1 and plate.Volume>1
# 10mm standoff with 1mm shim -> support face at z=11, rear motor z=0.
plate.translate(V(0,0,0.1))
hit=[]; distances=[]
for o in src.Objects:
if not hasattr(o,'Shape') or o.Shape.isNull() or not o.ViewObject.Visibility or o.Name=='EncoderPlateConcept': continue
if o.Name.startswith(('EncoderHex','EncoderSpacer')): continue
v=plate.common(o.Shape).Volume if plate.BoundBox.intersect(o.Shape.BoundBox) else 0
if v>0.001: hit.append((o.Name,round(v,6)))
if o.Name.startswith(('NewMotorCorner','Rail')):
distances.append((o.Name,round(plate.distToShape(o.Shape)[0],5)))
# Test panel has four complete M4 clear bores, as in the source design.
bore=[]
for k in range(4):
angle=math.radians(45+90*k)
x=25*math.cos(angle);y=10+25*math.sin(angle)
probe=Part.makeCylinder(2.19,3.3,V(x,y,10.95))
bore.append(round(probe.common(plate).Volume,6))
assert max(bore)<1e-5
# The old PCB rests against the lower face of this 3.2 mm slab. Verify
# each 1.8 mm pilot and surrounding pads match the old original panel.
pcb_centres=[(0,13.49),(-11.71,-6.76),(11.71,-6.76)]
pcb_probes=[]; pcb_pad=[]
for x,y in pcb_centres:
y+=10
probe=Part.makeCylinder(.89,3.3,V(x,y,10.95))
pcb_probes.append(round(probe.common(plate).Volume,6))
pad=Part.makeCylinder(3.1,3.2,V(x,y,11))
pcb_pad.append(round(pad.common(plate).Volume,6))
assert max(pcb_probes)<1e-5 and min(pcb_pad)>50
orig=src.getObject('OpenPillarBracket').Shape.common(Part.makeBox(120,120,3.2,V(-60,-60,10.9)))
compare=plate.copy();compare.translate(V(0,0,-.1))
panel_diff=[orig.cut(compare).Volume,compare.cut(orig).Volume]
assert max(panel_diff)<1e-5
# Put support face flat on build plate and centre the source motor axis.
printed=plate.copy();printed.translate(V(0,-10,-11))
assert abs(printed.BoundBox.ZMin)<1e-5
doc=A.newDocument('EncoderStandoffPlate')
obj=doc.addObject('PartDesign::Feature','EncoderPlate')
obj.Label='PCD50 encoder panel - four metal stand-offs'
obj.Shape=printed;obj.ViewObject.ShapeColor=(.15,.4,.85)
doc.recompute();doc.saveAs(str(out/'EncoderPlate.FCStd'))
Import.export([obj],str(out/'EncoderPlate.step'))
mesh=MeshPart.meshFromShape(Shape=printed,LinearDeflection=0.05,AngularDeflection=math.radians(15),Relative=False)
mesh.write(str(out/'EncoderPlate.stl'))
mesh2=Mesh.Mesh(str(out/'EncoderPlate.stl'))
assert mesh2.isSolid() and mesh2.Volume>0
step=Part.read(str(out/'EncoderPlate.step'))
assert step.isValid() and len(step.Solids)==1
G.activateWorkbench('PartWorkbench');G.activeDocument().activeView().viewAxonometric();G.updateGui();time.sleep(.6);view=G.activeDocument().activeView();view.fitAll();G.updateGui();time.sleep(.6);view.saveImage(str(out/'EncoderPlate.png'),1400,1000,'White')
report={'solid_valid':printed.isValid(),'solids':len(printed.Solids),'volume_mm3':printed.Volume,'dimensions_mm':[printed.BoundBox.XLength,printed.BoundBox.YLength,printed.BoundBox.ZLength],'mesh_closed':mesh2.isSolid(),'mesh_volume_mm3':mesh2.Volume,'bore_probe_intersections_mm3':bore,'pcb_pilot_probe_intersections_mm3':pcb_probes,'pcb_pad_material_mm3':pcb_pad,'original_panel_two_way_difference_mm3':panel_diff,'tested_position':'10 mm standoffs + 1 mm shim, panel bottom at z=11 mm','positive_intersections_mm3':hit,'angle_rail_clearances_mm':distances,'warning':'All geometry and PCB dimensions assumed; tool access and physical assembly unverified.'}
(out/'验证.json').write_text(json.dumps(report,ensure_ascii=False,indent=2),encoding='utf8')
A.closeDocument(doc.Name)
reopened=A.openDocument(str(out/'EncoderPlate.FCStd'));reopened.recompute()
assert reopened.getObject('EncoderPlate').Shape.isValid();A.closeDocument(reopened.Name)
A.closeDocument(src.Name)
(out/'完成.txt').write_text('ok',encoding='utf8')
except Exception:
(out/'错误.txt').write_text(traceback.format_exc(),encoding='utf8')
os._exit(0)

View File

@@ -0,0 +1 @@
ok

View File

@@ -0,0 +1,11 @@
# MT6826S 编码器支架:金属柱试装版
`EncoderPlate.stl` 为单个整件,打印 1 件;`EncoderPlate.step` 和 `EncoderPlate.FCStd` 为对应模型。支架为 49 × 49 × 3.2 mm 的面板,不带塑料立柱,打印时平面贴平台。PCB 圆孔、三个局部支撑耳、三个直径 1.8 mm 的自攻导孔和 PCD50 四个直径 4.4 mm 的通孔完整保留自原支架;PCB Ø33 mm、三孔位置均为既有图像估算,须按实物试装。导孔可试配 M2 小自攻螺丝,避免拧裂 PCB 或支架,按实际孔深和螺钉头复核。
支架用 **4 根 M4 公母六角金属柱,柱身长 10 mm、对边约 7 mm** 固定到电机的 PCD50 孔。柱身长度不包含公牙。柱体旋入电机之前,必须确认公牙长度、盲孔实际深度和足够有效啮合;M4×8 螺丝规格不能证明电机孔深。顶部另用 4 颗 M4 螺丝和合适平垫,实际长度按面板 3.2 mm、调整垫片及柱内螺纹深度选取,不得顶底。
柱顶和支架之间放 4 片等厚非磁性金属垫片,调整 PCB 到磁铁的距离。开始试装可选每处 1 mm:断电慢转检查磁铁与芯片不能碰擦,再检查编码器角度与磁场状态。减少垫片使间隙变小,增加则变大,四处保持同厚。
以下只是原近似几何推算:PCB 厚按 1.6 mm、芯片凸起 0.8 mm、磁铁表面距电机背面 7.5 mm。若铜柱不额外垫高,板面距电机背面 = 10 + 垫片厚度,名义间隙 = 板面距离 − 1.6 − 0.8 − 7.5 = 垫片厚度 + 0.1 mm。实物 PCB、芯片、磁铁及轴向跳动未测,不能据此保证实际间隙。磁铁座可靠固定并确认同轴后再转动测试。
验证记录见 `验证.json`:STL 为单一闭合网格;STEP 为单实体,FCStd 重新打开后有效;三处 PCB 导孔和四处 M4 孔均做了探针检查,原面板双向实体差为零。以 10 mm 柱加 1 mm 垫片的示意位置检查面板,与装配内可见零件无正体积相交;实际五金、螺丝头、工具、PCB 背面元件、线束、完整工作运动和实物尺寸仍需试装。对边 7 mm 的铜柱与新角码仅按近似模型评估,需实物确认。

View File

@@ -0,0 +1,77 @@
{
"solid_valid": true,
"solids": 1,
"volume_mm3": 4906.512274176155,
"dimensions_mm": [
49.0,
49.0,
3.200000000000001
],
"mesh_closed": true,
"mesh_volume_mm3": 4910.2578125,
"bore_probe_intersections_mm3": [
0.0,
0.0,
0.0,
0.0
],
"pcb_pilot_probe_intersections_mm3": [
0.0,
0.0,
0.0
],
"pcb_pad_material_mm3": [
88.467249,
88.467249,
88.467249
],
"original_panel_two_way_difference_mm3": [
0.0,
0.0
],
"tested_position": "10 mm standoffs + 1 mm shim, panel bottom at z=11 mm",
"positive_intersections_mm3": [],
"angle_rail_clearances_mm": [
[
"Rail0",
16.37006
],
[
"Rail1",
16.37006
],
[
"NewMotorCorner00",
9.2
],
[
"RailWasher00",
14.37063
],
[
"NewMotorCorner01",
9.2
],
[
"RailWasher01",
14.37063
],
[
"NewMotorCorner10",
9.2
],
[
"RailWasher10",
14.37063
],
[
"NewMotorCorner11",
9.2
],
[
"RailWasher11",
14.37063
]
],
"warning": "All geometry and PCB dimensions assumed; tool access and physical assembly unverified."
}