Skip to content

Added dual policy mode to toggle default locomotion policy#73

Merged
kingb merged 3 commits intomainfrom
dev/csf/dual_mode
Mar 12, 2026
Merged

Added dual policy mode to toggle default locomotion policy#73
kingb merged 3 commits intomainfrom
dev/csf/dual_mode

Conversation

@carlosferrazza
Copy link
Copy Markdown
Contributor

@carlosferrazza carlosferrazza commented Mar 10, 2026

This PR adds as a default inference config the option to switch to a robust locomotion policy by pressing X on the joystick (or x on keyboard), which is convenient for the robot to recover while testing experimental policies. The implementation is even more general than that, as the way it works is by introducing a dual mode setup that allows switching between any two policies at runtime.


from holosoma_inference.config.config_types.task import TaskConfig

_MODELS_DIR = Path(__file__).parent.parent.parent / "models"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a comment clarifying where this should point to? Seems like src/holosoma_inference/holosoma_inference/models


def main(annotated_config=None):
"""Main entry point. Extensions can pass their own AnnotatedInferenceConfig."""
import argparse
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not import at the top of the file?

@clayrosenthal clayrosenthal added the enhancement New feature or request label Mar 10, 2026
Copy link
Copy Markdown
Contributor

@tomasz-lewicki tomasz-lewicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM aside from the config. I think it should be pretty easy to skip all of this argparse logic, and let tyro handle this.

restore_terminal_settings()


def _split_secondary_args(argv: list[str]) -> tuple[list[str], list[str]]:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't tyro handle this out-of-the box once you've defined TaskConfig.secondary? Maybe I'm missing something, but I think you can do:

run_policy.py --task.secondary.task.model-path weights.onnx

We can also just have a secondary optional InferenceConfig.

run_policy.py  --task.model-path weights_dance.onnx  --fallback_task.model-path weights_loco.onnx

id(self.secondary): self.secondary.handle_keyboard_button,
}

def patched_joy(cur_key):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully we refactor joystick/input handling soon so doing simple things doesn't have to be so convoluted.

Copy link
Copy Markdown
Contributor

@asetapen asetapen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice improvements and dual mode will be extremely helpful for testing.

I'm not too familiar with tyro so can't comment on the config issue.

@kingb kingb merged commit a0e229f into main Mar 12, 2026
9 checks passed
@kingb kingb deleted the dev/csf/dual_mode branch March 12, 2026 23:40
@kingb kingb restored the dev/csf/dual_mode branch March 13, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants