Commit 347daa1
committed
feat(sim,training): actuator-keyed policies, vertical-camera fix, RL parity (evaluate/vec/gym/staged_reward)
Sim bug fixes (found by running policies across embodiments, each pinned):
- robot_action_keys(): policies were keyed by ALL joint names incl. passive/
mimic followers and missed tendon actuators, so g1/aloha/xarm7/stretch/hands
silently no-op'd. Now keyed by the robot's actuators (what send_action
resolves). MuJoCo override + SimEngine ABC default (other backends unchanged).
- spec_builder._target_quat: returned None for top-down/vertical cameras
(forward parallel to world +Z -> degenerate cross). Falls back to +Y up.
- mujoco render(output_path=...): persist PNG for verifiable renders, with
path-traversal / shell-metachar guard on the LLM-supplied path.
- eval_policy: auto-resolves the single robot (API parity with run_policy).
- DeclarativeBenchmark.on_episode_start: reset stateful reward terms (no phase
leak across episodes).
RL training parity (4 gaps closed, CPU-tested, no new required deps):
- predicates.staged_reward: declarative monotonic phase-machine reward
(StatefulRewardTerm). Curricula authored as DATA via the closed predicate
registry - never eval, never shipped task code.
- base_algo.evaluate()/load_checkpoint()/_deterministic_action(): deterministic
eval peer of train(), frozen normalizer, success_rate; works for PPO + SAC.
- SimEnv.n_substeps (default 5): position-target PD needs substeps to track;
n_substeps=1 was the "nothing learns" bug. Resets stateful reward terms.
- PpoTrainer: vectorized rollout path; num_envs>1 now accepted (was hard-
rejected). N=1 path byte-identical (dispatch on _vectorized).
- VecSimEnv: N independent SimEnv, one reused thread pool, autoreset with
terminal_obs capture (load-bearing for GAE bootstrap), homogeneity guard.
- GymSimEnv: gymnasium adapter with correct terminated-vs-truncated split
(the SB3 TimeLimit footgun fixed at the source) + critic-obs passthrough.
Tests: 38 new CPU tests (vec_env, evaluate, vectorized-ppo, gym_env,
staged_reward) + SO-101 e2e wiring/convergence integ. Updated 3 existing tests
that encoded the old contracts (num_envs==1 rejection, eval_policy robot_name).1 parent c991151 commit 347daa1
16 files changed
Lines changed: 2024 additions & 11 deletions
File tree
- strands_robots
- simulation
- mujoco
- training/rl
- tests_integ/training
- tests
- simulation
- training
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
239 | 246 | | |
240 | 247 | | |
241 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
574 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
575 | 579 | | |
576 | 580 | | |
577 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
578 | 589 | | |
579 | 590 | | |
580 | 591 | | |
| |||
662 | 673 | | |
663 | 674 | | |
664 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
665 | 700 | | |
666 | 701 | | |
667 | 702 | | |
668 | | - | |
| 703 | + | |
669 | 704 | | |
670 | | - | |
| 705 | + | |
671 | 706 | | |
672 | 707 | | |
673 | 708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
557 | 713 | | |
558 | 714 | | |
559 | 715 | | |
| |||
574 | 730 | | |
575 | 731 | | |
576 | 732 | | |
| 733 | + | |
| 734 | + | |
577 | 735 | | |
578 | 736 | | |
579 | 737 | | |
| |||
634 | 792 | | |
635 | 793 | | |
636 | 794 | | |
| 795 | + | |
637 | 796 | | |
638 | 797 | | |
639 | 798 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
0 commit comments