Preserve installed operator workspace before consolidation

Local preservation snapshot, not a new deployment or simulation acceptance.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-08 09:59:51 +03:00
parent 97614742bb
commit d0e5f90952
368 changed files with 129172 additions and 1856 deletions
+90 -40
View File
@@ -1,37 +1,25 @@
"""Metric 1 x 1 m, four-wheel differential laboratory chassis.
"""DCD-006 geometry with a provisional four-wheel differential contact proxy.
Geometry is explicit. Mass/friction/drive gains are provisional simulation
parameters, NOT a calibrated braking or terrain model of the owner's vehicles.
CAD dimensions and the owner's working mass are explicit. The mass split,
friction and joint drives remain an unqualified contact approximation.
"""
PROFILE = {
"schema_version": "missioncore.virtual-rover/v1",
"length_m": 1.0,
"width_m": 1.0,
"wheel_radius_m": 0.25,
"wheel_collision": "physx-convex-cylinder",
"wheelbase_m": 0.5,
"body_contact_height_m": 0.37,
"track_width_m": 0.9,
"camera_forward_m": 0.38, # Lens ahead of the mast's front face (x=0.33).
"camera_pitch_degrees": -10.0,
"rear_range_forward_m": -0.38,
"range_sensor_profile": "front-360-rear-160-first-hit-v2",
"camera_focal_length_mm": 14.0, # Wide pinhole view retains ground on slopes.
"camera_horizontal_aperture_mm": 36.0,
"mass_kg": 24.0,
"calibration": "geometry-only",
"max_step_m": 0.10,
"max_slope_degrees": 25.0,
"stop_tilt_degrees": 30.0,
"drive_damping": 1000.0,
"brake_stiffness": 2000.0,
"brake_damping": 100.0,
"solver_position_iterations": 32,
"solver_velocity_iterations": 8,
"contact_offset_m": 0.005,
"wheel_names": ["front_left", "rear_left", "front_right", "rear_right"],
}
import json
from pathlib import Path
ROBOT_DOCUMENT = json.loads((Path(__file__).parent / "robots/dcd006-v020.json").read_text())
PROFILE = ROBOT_DOCUMENT["physics"]
def mass_distribution(profile=PROFILE):
"""One total mass, with an explicitly assumed split for this contact proxy."""
import math
total, wheel = profile["mass_kg"], profile["wheel_mass_kg"]
chassis = total - len(profile["wheel_names"]) * wheel
if not all(math.isfinite(value) and value > 0 for value in (total, wheel, chassis)):
raise ValueError("Invalid rover mass distribution")
return chassis, wheel
class DifferentialDrive:
@@ -43,6 +31,7 @@ class DifferentialDrive:
def __init__(self, articulation):
self.robot = articulation
self.body = articulation
self.indices = articulation.get_dof_indices(PROFILE["wheel_names"])
self.holding = None
@@ -63,8 +52,57 @@ class DifferentialDrive:
right = (velocity + yaw_rate * half_track) / radius
self.robot.set_dof_velocity_targets([[left, left, right, right]], dof_indices=self.indices)
def step(self, dt):
pass # Native joint drives are integrated by PhysX.
def create_rover(stage, spawn, heading, ground_normal=(0, 0, 1), root_path="/World/Rover"):
def side_speeds(self):
rates = self.robot.get_dof_velocities(dof_indices=self.indices).numpy()[0]
return [float((rates[i] + rates[i + 1]) * 0.5 * PROFILE["wheel_radius_m"]) for i in (0, 2)]
@property
def metrics(self):
return {"model": "four-wheel-proxy", "belt_mps": self.side_speeds()}
def open_drive(root_path="/World/Rover", *, model=None, contact_filter_paths=None, document=None):
document = document or ROBOT_DOCUMENT
model = model or document["physics"].get("contact_model", "wheels")
if model == "tracks":
from tracked_rover import TrackedDrive
if not contact_filter_paths:
raise ValueError("Tracked drive requires explicit terrain contact filters")
return TrackedDrive(document, root_path, contact_filter_paths)
if model != "wheels":
raise ValueError("Unknown rover contact model")
from isaacsim.core.experimental.prims import Articulation
return DifferentialDrive(Articulation(root_path))
def create_rover(
stage,
spawn,
heading,
ground_normal=(0, 0, 1),
root_path="/World/Rover",
visual_asset=None,
*,
model=None,
document=None,
):
document = document or ROBOT_DOCUMENT
profile = document["physics"]
model = model or profile.get("contact_model", "wheels")
if model == "tracks":
from tracked_rover import create_tracked_rover
create_tracked_rover(
stage, document, spawn, heading, ground_normal, root_path, visual_asset
)
return profile
if model != "wheels":
raise ValueError("Unknown rover contact model")
import carb.settings
from omni.physx.bindings._physx import SETTING_COLLISION_APPROXIMATE_CYLINDERS
from pxr import Gf, PhysxSchema, UsdGeom, UsdPhysics, UsdShade
@@ -76,8 +114,8 @@ def create_rover(stage, spawn, heading, ground_normal=(0, 0, 1), root_path="/Wor
tire = UsdShade.Material.Define(stage, "/World/Materials/RoverTire")
tire_physics = UsdPhysics.MaterialAPI.Apply(tire.GetPrim())
tire_physics.CreateStaticFrictionAttr(1.0)
tire_physics.CreateDynamicFrictionAttr(0.9)
tire_physics.CreateStaticFrictionAttr(PROFILE["static_friction"])
tire_physics.CreateDynamicFrictionAttr(PROFILE["dynamic_friction"])
tire_physics.CreateRestitutionAttr(0)
root = UsdGeom.Xform.Define(stage, root_path)
@@ -101,10 +139,13 @@ def create_rover(stage, spawn, heading, ground_normal=(0, 0, 1), root_path="/Wor
body.AddTranslateOp().Set(Gf.Vec3d(0, 0, 0.12))
UsdPhysics.RigidBodyAPI.Apply(body.GetPrim())
PhysxSchema.PhysxRigidBodyAPI.Apply(body.GetPrim()).CreateMaxDepenetrationVelocityAttr(1.0)
UsdPhysics.MassAPI.Apply(body.GetPrim()).CreateMassAttr(20)
chassis_mass, wheel_mass = mass_distribution()
UsdPhysics.MassAPI.Apply(body.GetPrim()).CreateMassAttr(chassis_mass)
hull = UsdGeom.Cube.Define(stage, root_path + "/chassis/hull")
hull.CreateSizeAttr(1)
hull.AddScaleOp().Set(Gf.Vec3f(0.8, 0.78, 0.24))
hull.AddScaleOp().Set(
Gf.Vec3f(PROFILE["length_m"], PROFILE["width_m"] - 2 * PROFILE["wheel_width_m"], 0.24)
)
hull.CreateDisplayColorAttr([Gf.Vec3f(0.65, 0.67, 0.61)])
contact(hull.GetPrim())
# Mast is visual geometry under the rigid chassis (not a separate body).
@@ -115,12 +156,12 @@ def create_rover(stage, spawn, heading, ground_normal=(0, 0, 1), root_path="/Wor
sensor.CreateDisplayColorAttr([Gf.Vec3f(0.12, 0.13, 0.13)])
for name in PROFILE["wheel_names"]:
x = PROFILE["wheelbase_m"] / 2 * (1 if name.startswith("front") else -1)
y = 0.45 if name.endswith("left") else -0.45
y = PROFILE["track_width_m"] / 2 * (1 if name.endswith("left") else -1)
path = root_path + "/" + name
wheel = UsdGeom.Cylinder.Define(stage, path)
wheel.CreateAxisAttr("Y")
wheel.CreateRadiusAttr(PROFILE["wheel_radius_m"])
wheel.CreateHeightAttr(0.1)
wheel.CreateHeightAttr(PROFILE["wheel_width_m"])
wheel.AddTranslateOp().Set(Gf.Vec3d(x, y, 0))
wheel.CreateDisplayColorAttr([Gf.Vec3f(0.08, 0.08, 0.08)])
UsdPhysics.RigidBodyAPI.Apply(wheel.GetPrim())
@@ -129,7 +170,7 @@ def create_rover(stage, spawn, heading, ground_normal=(0, 0, 1), root_path="/Wor
UsdShade.MaterialBindingAPI.Apply(wheel.GetPrim()).Bind(
tire, UsdShade.Tokens.weakerThanDescendants, "physics"
)
UsdPhysics.MassAPI.Apply(wheel.GetPrim()).CreateMassAttr(1)
UsdPhysics.MassAPI.Apply(wheel.GetPrim()).CreateMassAttr(wheel_mass)
joint = UsdPhysics.RevoluteJoint.Define(stage, root_path + "/joints/" + name)
joint.CreateBody0Rel().SetTargets([body.GetPath()])
joint.CreateBody1Rel().SetTargets([wheel.GetPath()])
@@ -140,6 +181,15 @@ def create_rover(stage, spawn, heading, ground_normal=(0, 0, 1), root_path="/Wor
drive.CreateTypeAttr("force")
drive.CreateStiffnessAttr(0)
drive.CreateDampingAttr(PROFILE["drive_damping"])
drive.CreateMaxForceAttr(50)
drive.CreateMaxForceAttr(PROFILE["joint_max_force_nm"])
drive.CreateTargetVelocityAttr(0)
if visual_asset is not None:
# Only renderables are hidden. Joint bodies and contacts remain active.
hull.CreateVisibilityAttr(UsdGeom.Tokens.invisible)
sensor.CreateVisibilityAttr(UsdGeom.Tokens.invisible)
for name in PROFILE["wheel_names"]:
UsdGeom.Imageable(stage.GetPrimAtPath(root_path + "/" + name)).MakeInvisible()
visual = UsdGeom.Xform.Define(stage, root_path + "/chassis/DCD006")
visual.GetPrim().GetReferences().AddReference(str(visual_asset))
visual.AddTranslateOp().Set(Gf.Vec3d(0, 0, -PROFILE["body_contact_height_m"]))
return PROFILE