Preserve installed operator workspace before consolidation
Local preservation snapshot, not a new deployment or simulation acceptance.
This commit is contained in:
@@ -21,16 +21,17 @@ parser.add_argument("--output", type=Path, required=True)
|
||||
parser.add_argument("--mode", choices=("straight", "replay"), default="straight")
|
||||
parser.add_argument("--seconds", type=float, default=40)
|
||||
args = parser.parse_args()
|
||||
if not 2 <= args.seconds <= 120 or args.output.exists():
|
||||
raise ValueError("Expected a new report and 2–120 seconds of simulation")
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "src"))
|
||||
|
||||
app = SimulationApp({"headless": True, "hide_ui": True})
|
||||
try:
|
||||
import omni.timeline
|
||||
import omni.usd
|
||||
from isaacsim.core.experimental.prims import Articulation
|
||||
from isaacsim.core.simulation_manager import SimulationManager
|
||||
from pxr import UsdGeom
|
||||
from rover_profile import PROFILE, DifferentialDrive, create_rover
|
||||
from rover_profile import PROFILE, ROBOT_DOCUMENT, create_rover, open_drive
|
||||
from terrain import install_terrain
|
||||
|
||||
from k1link.simulation.ai_polygon.mission_policy import inclination
|
||||
@@ -51,8 +52,8 @@ try:
|
||||
omni.timeline.get_timeline_interface().play()
|
||||
for _ in range(30):
|
||||
app.update()
|
||||
robot = Articulation("/World/Rover")
|
||||
drive = DifferentialDrive(robot)
|
||||
drive = open_drive(contact_filter_paths=["/World/Terrain"])
|
||||
robot = drive.body
|
||||
playback = []
|
||||
if args.mode == "replay":
|
||||
playback = [
|
||||
@@ -61,6 +62,8 @@ try:
|
||||
trace, cursor, stopped = [], 0, False
|
||||
started = time.monotonic()
|
||||
for step in range(round(args.seconds * 60)):
|
||||
if time.monotonic() - started > 180:
|
||||
raise TimeoutError("Scene-contact qualification exceeded its wall deadline")
|
||||
p, q = robot.get_world_poses()
|
||||
p, q = p.numpy()[0].tolist(), q.numpy()[0].tolist()
|
||||
pose = p + q[1:] + q[:1]
|
||||
@@ -74,9 +77,27 @@ try:
|
||||
):
|
||||
cursor += 1
|
||||
v, w = playback[cursor]["applied_speed_mps"], playback[cursor]["applied_yaw_rate_rps"]
|
||||
drive.command(0 if stopped else v, 0 if stopped else w)
|
||||
# End with two seconds of the ordinary zero-command hold on this mesh.
|
||||
holding = step / 60 >= args.seconds - 2
|
||||
drive.command(0 if stopped or holding else v, 0 if stopped or holding else w)
|
||||
drive.step(1 / 60)
|
||||
if step % 10 == 0:
|
||||
trace.append(dict(time_s=step / 60, pose=pose, tilt_degrees=tilt, stopped=stopped))
|
||||
trace.append(
|
||||
dict(
|
||||
time_s=step / 60,
|
||||
pose=pose,
|
||||
tilt_degrees=tilt,
|
||||
stopped=stopped,
|
||||
holding=holding,
|
||||
side_actual_mps=drive.side_speeds(),
|
||||
held_sides=drive.metrics.get("held_sides"),
|
||||
drivetrain={key: drive.metrics.get(key) for key in (
|
||||
"normal_load_n", "motor_force_n", "native_normal_force_n",
|
||||
"reported_normal_force_n", "force_n", "torque_nm", "native_contact_count")},
|
||||
loaded_native_contacts=[c for c in drive.metrics.get("native_contacts", [])
|
||||
if c["load_n"] > 1],
|
||||
)
|
||||
)
|
||||
SimulationManager.step(steps=1)
|
||||
report = dict(
|
||||
schema_version="missioncore.scene-contact-qualification/v1",
|
||||
@@ -85,6 +106,26 @@ try:
|
||||
elapsed_wall_s=time.monotonic() - started,
|
||||
run_sha256=hashlib.sha256(args.run.read_bytes()).hexdigest(),
|
||||
mode=args.mode,
|
||||
contact_model=PROFILE.get("contact_model", "wheels"),
|
||||
source_sha256={
|
||||
str(path.relative_to(Path(__file__).resolve().parents[2])): hashlib.sha256(
|
||||
path.read_bytes()
|
||||
).hexdigest()
|
||||
for path in [
|
||||
Path(__file__),
|
||||
*[
|
||||
Path(__file__).parent / name
|
||||
for name in (
|
||||
"rover_profile.py",
|
||||
"tracked_rover.py",
|
||||
"track_dynamics.py",
|
||||
"terrain.py",
|
||||
"robots/dcd006-v020.json",
|
||||
)
|
||||
],
|
||||
]
|
||||
},
|
||||
robot=ROBOT_DOCUMENT,
|
||||
wheel_collision=PROFILE["wheel_collision"],
|
||||
seconds=args.seconds,
|
||||
profile=PROFILE,
|
||||
|
||||
Reference in New Issue
Block a user