Local preservation snapshot, not a new deployment or simulation acceptance.
44 lines
1.8 KiB
Python
44 lines
1.8 KiB
Python
"""Metric terrain fixtures for the selected tracked chassis, independent of maps.
|
|
|
|
These are engineering samples, not claims of ASTM conformity or building-code
|
|
stair dimensions. NIST's separation of stairs, ramps and gaps informs the cases.
|
|
Fixtures are simulation truth; planners must receive sensor observations only.
|
|
"""
|
|
import math
|
|
|
|
|
|
def fixtures():
|
|
rows = []
|
|
def add(name, profile, goal, kind):
|
|
rows.append(dict(name=name, kind=kind, profile_xz_m=profile,
|
|
goal_x_m=goal, start_z_m=profile[0][1], target_mps=.3))
|
|
add('level', [(-4, 0), (8, 0)], 3.5, 'control')
|
|
for rise, tread, count in ((.15, .30, 6), (.18, .30, 5), (.15, .60, 4)):
|
|
for sign in (1, -1):
|
|
z = 0 if sign > 0 else rise * count
|
|
points = [(-4, z), (1, z)]
|
|
for i in range(count):
|
|
x = 1 + i*tread
|
|
points.extend([(x, z), (x, z+sign*rise), (x+tread, z+sign*rise)])
|
|
z += sign*rise
|
|
points.append((8, z))
|
|
add(f'stairs_{round(rise*100)}_{round(tread*100)}_' + ('up' if sign>0 else 'down'),
|
|
points, 1+count*tread+.7, 'stairs')
|
|
for angle in (15, 25, 35, 45):
|
|
rise = 2*math.tan(math.radians(angle))
|
|
add(f'ramp_{angle}', [(-4,0),(1,0),(3,rise),(8,rise)], 3.7, 'ramp')
|
|
add('depression_30_ramped', [(-4,0),(1,0),(2,-.3),(3,-.3),(4,0),(8,0)], 4.7, 'depression')
|
|
return rows
|
|
|
|
|
|
def surface_mesh(profile, width=3):
|
|
points, faces = [], []
|
|
for a, b in zip(profile, profile[1:]):
|
|
if a == b:
|
|
continue
|
|
offset = len(points)
|
|
points.extend([(a[0],-width/2,a[1]), (b[0],-width/2,b[1]),
|
|
(b[0],width/2,b[1]), (a[0],width/2,a[1])])
|
|
faces.extend([offset,offset+1,offset+2,offset,offset+2,offset+3])
|
|
return points, faces
|