Repository navigation
gym twin: nav@1's plant arm (GymTwin(plant_arm=True)) and its gate - #190
Merged
Merged
Conversation
On a vehicle plant libcvc's drive gives its command through the plant arm (plant_drive), after the control law: the stopping governor with the latency and the vehicle's braking, braking down to -a_brake, the steering actuator's slew and lock, the vehicle's own envelope and footprint, and the park brake at the goal. sdf_nav.bike_control takes it as plant= (a PlantArm) and steer_now=; GymTwin(gym, plant_arm=True) reads it from plants()' plan (transfix/libcvc#1286) and parks rows in rollout, drive_gym and tick_residuals as nav@1 parks an agent. The default is the control law alone, unchanged. Gate 5 (tests/test_gym_twin.py): nav@1 drives three Humvees on dynamic4w; the twin's command from the drive the gym reports against the command the gym's plant took. Departing agent-ticks, plant arm against the control law alone: en route 0 % against 0.9 %, arriving 0.5 % (one tick) against 10.5 %, parked (acceleration) 0 % against 99.2 %. Gate 3 runs with the plant arm too. docs/gym-twin.md has the numbers.
…es it transfix/libcvc#1297 makes nav@1 come to rest at its goals: the drive's speed toward a stop point is held to the speed it stops there from (a_max, or on the plant arm the latency and a_brake). sdf_nav.bike_control takes it as stop_at=, and GymTwin(plant_arm=True) applies it at each row's goal where fields()["navigator"]["stop_at_goal"] is set (older libcvc: no stop). Gate 5 against #1297: plant arm 0 % departing en route, arriving and parked (accel), against 0.9 / 77.8 / 98.4 % for the control law alone; the gate now steps past the gym's end of the episode until the agents are at rest. Gate 3's plant-arm case starts below ~5 m/s, where beta and gamma act: above it the stop sets the braking and their gradients are zero.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gym twin gets nav@1's plant arm, behind an option:
GymTwin(gym, plant_arm=True). The default is unchanged. Write-up: docs/gym-twin.md, gate 5. It needs transfix/libcvc#1286 (plants()'plan), stacked on transfix/libcvc#1284. The second commit mirrors transfix/libcvc#1297 (stacked on #1286), with which nav@1 comes to rest at its goals.Why. On a vehicle plant, libcvc's drive gives its command through the plant arm (
plant_drive), after the control law. The twin had only the control law (bike_control). Replaying nav@1's ticks from the drive the gym reports (its coefficients and carrot), the twin's command departed from the plant's on most agent-ticks within 60 m of a goal: 61 % in gate 5, parked ticks included.What changed:
sdf_nav.bike_control(..., plant=PlantArm(...), steer_now=)is libcvc's plant arm (veh_params::plant):a_brakeanda_max;-a_brake(6 m/s² on the Humvee, where the law stopped ata_max, 2 m/s²);steer_rate × dtof the actuator's angle now;[sp_min, vmax].plant=Noneis the old path, op for op.GymTwin(gym, plant_arm=True)readsplants()'plan:a_max,vmaxand corneringa_lat, its wheelbase and its footprint discs replace the navigator's in the drive's settings;a_brake, the slew and the lock go into aPlantArm;Parking.
control(..., parked=)brakes those rows to a stop within the tick, at most ata_brake, as nav@1 parks an agent at its goal.GymTwin.parked(gym)reads which agents the next tick parks.rollout,drive_gymandtick_residualspark a row from the tick that ends within the reach of its goal.controltakesext_steer=, asbike_controldoes.The stop at the goal (second commit):
bike_control(..., stop_at=)is libcvc#1297'sveh_params::stop_at. The speed toward each row's goal is held to the speed it stops there from (with the plant arm's latency and braking), over the motion that closes on it.GymTwin(plant_arm=True)applies it wherefields()["navigator"]["stop_at_goal"]is set; a libcvc without the key gets no stop.Gate 5. nav@1 drives three Humvees on
dynamic4won the flat square, 85–115 m to their goals. Each tick the twin is given the gym's state before the tick, the drive the gym reports, and whether the tick parks the agent. Its command is compared with the one the gym's plant took (steer_command,accel_command). An agent-tick departs at more than 1e-4 rad of steering or 0.01 m/s² of acceleration.Against libcvc #1297 (nav@1 stops at its goals; the final stack):
plant_arm=True(after)Against #1286 alone (nav@1 overshoots):
a_maxwhen the stopping governor binds against the square's edge;What it is not:
Tests.
test_gate5_the_plant_arm_is_the_command_the_plant_tookandtest_the_plant_arm_parks_a_rollout_at_its_goalare new, and gate 3's gradients now also run with the plant arm (they match central differences).pytest tests/test_gym_twin.py: 10 passed. The first commit was checked the same way against #1286 alone (10 passed). The second commit was not re-run against #1286 alone, where the twin reads nostop_at_goal.pytestover every test that usesbike_control,bicycle_rollout,ext_rollout,dyn4or the twin): 157 passed, 1 skipped (no CUDA).test_gym_twin.pyskips there.