Files
NODEDC_MISSION_CORE/tools/rover-scene/source/track_detail.py
T
DCCONSTRUCTIONS d0e5f90952 Preserve installed operator workspace before consolidation
Local preservation snapshot, not a new deployment or simulation acceptance.
2026-10-08 09:59:51 +03:00

177 lines
8.6 KiB
Python

"""Photo-reconstructed Composit Muravey tread and visible wheel surfaces.
All units are metres. Does not reset/open/save the scene.
add_track(ctx): collection, materials {rubber, metal[, tread]},
sample(s) -> (position, tangent, outward_normal), length=2.222,
width=.220, pitch=.0505, side_label. The path is the belt NEUTRAL line.
Position contains the global track Y centre; transverse offsets use global Y.
Optional parameters: belt_thickness=.006, lug_height=.020, phase=0,
direction=1, include_inner_lugs=True. Exact mould dimensions are NOT known.
add_wheel(ctx): collection, materials {rubber,metal[, painted]}, center,
radius, width, side_label, kind='roller' or 'sprocket'. Rotation axis Y.
A roller is one wheel; call twice for the two running lanes if required.
Sprocket external diameter defaults to .160, independently of roller radius.
Return a list of created objects. Parameters retain evidence-status properties.
"""
import math
import bpy
import bmesh
from mathutils import Vector
class Geometry:
def __init__(self):
self.vertices=[]
self.faces=[]
def prism(self, lower, upper):
"""Matching polygon rings, including concave chevron footprints."""
n=len(lower); k=len(self.vertices)
self.vertices.extend(lower); self.vertices.extend(upper)
self.faces.append(tuple(k+i for i in reversed(range(n))))
self.faces.append(tuple(k+n+i for i in range(n)))
self.faces.extend((k+i,k+(i+1)%n,k+n+(i+1)%n,k+n+i) for i in range(n))
def loft(self, rings):
n=len(rings[0]);k=len(self.vertices)
for ring in rings:self.vertices.extend(ring)
self.faces.append(tuple(k+i for i in reversed(range(n))))
for j in range(len(rings)-1):
self.faces.extend((k+j*n+i,k+j*n+(i+1)%n,
k+(j+1)*n+(i+1)%n,k+(j+1)*n+i) for i in range(n))
self.faces.append(tuple(k+(len(rings)-1)*n+i for i in range(n)))
def object(self, name, collection, material, bevel=0, smooth=False):
mesh=bpy.data.meshes.new(name)
mesh.from_pydata(self.vertices,[],self.faces);mesh.update()
bm=bmesh.new();bm.from_mesh(mesh)
bmesh.ops.recalc_face_normals(bm,faces=bm.faces)
bm.to_mesh(mesh);bm.free()
ob=bpy.data.objects.new(name,mesh);collection.objects.link(ob)
if material:mesh.materials.append(material)
if smooth:
for p in mesh.polygons:p.use_smooth=True
if bevel:
mod=ob.modifiers.new('Mould edge radii — photo estimate','BEVEL')
mod.width=bevel;mod.segments=2
return ob
def add_track(ctx):
col=ctx['collection'];mats=ctx['materials'];sample=ctx['sample']
length=ctx.get('length',2.222);width=ctx.get('width',.220)
pitch=ctx.get('pitch',.0505);count=round(length/pitch)
if abs(count*pitch-length)>.00001:
raise ValueError('Track length must contain an integer number of nominal pitches')
thick=ctx.get('belt_thickness',.006);height=ctx.get('lug_height',.020)
phase=ctx.get('phase',0);direction=ctx.get('direction',1)
prefix=ctx.get('side_label','TRACK')
belt=Geometry();lugs=Geometry();ribs=Geometry();clips=Geometry();inner=Geometry()
# Catalog frontal image: opening ~22 mm / 220 mm total width.
half_window=.011;half_open_length=.015
def point(s,y,h):
p,t,n=sample((s+phase)%length)
return Vector(p)+Vector((0,y,0))+Vector(n)*h
def patch(g,s0,s1,y0,y1,h0,h1,steps=1):
for j in range(steps):
a=s0+(s1-s0)*j/steps;b=s0+(s1-s0)*(j+1)/steps
p=[(a,y0),(b,y0),(b,y1),(a,y1)]
g.prism([point(s,y,h0) for s,y in p],[point(s,y,h1) for s,y in p])
def footprint(g, s, coords, h0, h1, taper=.82):
# coords in (transverse, longitudinal) axes. Top narrows slightly.
cy=sum(p[0] for p in coords)/len(coords)
cs=sum(p[1] for p in coords)/len(coords)
low=[point(s+direction*d,y,h0) for y,d in coords]
high=[point(s+direction*(cs+(d-cs)*taper),cy+(y-cy)*taper,h1) for y,d in coords]
g.prism(low,high)
# Two continuous side bands. Central bridges leave genuine through-windows.
for i in range(count):
s=i*pitch
for sign in (-1,1):
a,b=sorted((sign*half_window,sign*width/2))
patch(belt,s,s+pitch,a,b,-thick/2,thick/2,12)
bridge=pitch/2-half_open_length
patch(belt,s-bridge,s+bridge,-half_window,half_window,-thick/2,thick/2,6)
# Actual repeated pattern: TWO small chevrons per half and one diagonal
# guide beside the window. No single oversized chevron across a half.
for sign in (-1,1):
for centre in (.050,.087):
# Trace of sharp Muravey (v1) V footprint, mirrored across Y.
p=[(centre-.016,-.012),(centre-.018,-.007),
(centre-.004,.011),(centre,.014),
(centre+.004,.011),(centre+.018,-.007),
(centre+.016,-.012),(centre,.005)]
p=[(sign*y,d) for y,d in p]
if sign<0:p.reverse()
footprint(lugs,s,p,thick/2-.0004,thick/2+height,.81)
diag=[(.017,.013),(.023,.014),(.035,-.015),(.028,-.016)]
diag=[(sign*y,d) for y,d in diag]
if sign<0:diag.reverse()
footprint(lugs,s,diag,thick/2-.0004,thick/2+height,.86)
# Lower continuous shoulder behind the V row, and edge mould rail.
a,b=sorted((sign*.014,sign*(width/2-.002)))
patch(ribs,s-.005,s+.004,a,b,thick/2,thick/2+.0020,3)
a,b=sorted((sign*(width/2-.008),sign*(width/2)))
patch(ribs,s-.015,s+.035,a,b,thick/2,thick/2+.0013,12)
# Fine grooves/ribs are visible between every pair of tread rows.
a,b=sorted((sign*.015,sign*(width/2-.008)))
for j in range(11):
r=s+.016+j*.00185
patch(ribs,r-.00034,r+.00034,a,b,thick/2,thick/2+.00065,1)
# One pressed metal U clip wraps EACH inter-window rubber bridge.
# Width and bend radii are photo-derived; article110200149 not proved.
clip_width=.026;clip_half=.0083;sheet=.00115
# U in (longitudinal,normal) section, extruded across Y.
profile=[(-clip_half-sheet,-thick/2-.001),
(-clip_half-sheet,thick/2+.0005),
(-clip_half,thick/2+.0020),
(clip_half,thick/2+.0020),
(clip_half+sheet,thick/2+.0005),
(clip_half+sheet,-thick/2-.001),
(clip_half,-thick/2-.001),
(clip_half,thick/2+.0006),
(-clip_half,thick/2+.0006),
(-clip_half,-thick/2-.001)]
clips.prism([point(s+ds,-clip_width/2,h) for ds,h in profile],
[point(s+ds,clip_width/2,h) for ds,h in profile])
if ctx.get('include_inner_lugs',True):
# Internal trapezoidal drive/guide bosses visible along bottom run.
# Native IMG_2405 crop: height about 0.61 of the 50.5 mm pitch.
# These tall guides were missing from the initial visual blockout.
for sign in (-1,1):
# Several shoulders capture the rounded narrow crown in the
# photograph, rather than a rectangular truncated cube.
h=ctx.get('inner_lug_height',.031);rings=[]
for hh,ss,ww in [(0,.019,.019),(.32*h,.016,.0165),
(.84*h,.008,.012), (h,.0045,.010)]:
corners=[(sign*(.033-ww),-ss),(sign*(.033+ww),-ss),
(sign*(.033+ww),ss),(sign*(.033-ww),ss)]
if sign<0:corners.reverse()
rings.append([point(s+ds,y,-thick/2-hh) for y,ds in corners])
inner.loft(rings)
result=[]
specs=[(belt,'continuous perforated rubber carcass',mats['rubber'],0),
(lugs,'44 rows • four small V lugs and two centre diagonals',mats.get('tread',mats['rubber']),.00065),
(ribs,'fine transverse mould ribs and edge rails',mats.get('tread',mats['rubber']),0),
(clips,'44 pressed inter-window clips',mats['metal'],.00025),
(inner,'inner guide bosses • photo estimate',mats['rubber'],.0012)]
for geom,label,mat,bev in specs:
ob=geom.object(prefix+' | '+label,col,mat,bev)
ob['source']='Composit Muravey catalog frontal image; DCD-006 IMG_2407 / IMG_2405'
ob['nominal_width_mm']=width*1000;ob['nominal_length_mm']=length*1000
ob['nominal_pitch_mm']=pitch*1000;ob['pitch_count']=count
ob['nominal_lug_height_mm']=height*1000
ob['geometry_status']='Mould and clip contours photo reconstructed; not toleranced production geometry'
result.append(ob)
return result