Policy is the component that controls the robot. It receives the env_data from the environment, ctrl_data from the controller, organize the observation and infer the action fo robot.
Policy is the base class for all policies. It defines the interface for the policy, as in base_policy.py
We provide the following policies:
- UnitreePolicy
- AMOPolicy
- H2HStudentPolicy
- HugWBCPolicy
- BeyondMimicPolicy
- ASAPPolicy
- KungfuBotGeneralPolicy
- TwistPolicy
UnitreePolicy is the policy that controls the robot using the Unitree official policy.
script: unitree_policy.py
To control the robot using UnitreePolicy, you can refer _get_commands():
commands:
commands[0], [-1, 1], control the robot to walk forward and backwardcommands[1], [-1, 1], control the robot to walk left and rightcommands[2], [-1, 1], control the robot to turn left and right
for instance, use JoystickCtrl to control:
def _get_commands(self, ctrl_data: dict) -> list[float]:
commands = np.zeros(3)
for key in ctrl_data.keys():
if key in ["JoystickCtrl", "UnitreeCtrl"]:
axes = ctrl_data[key]["axes"]
lx, ly, rx, ry = axes["LeftX"], axes["LeftY"], axes["RightX"], axes["RightY"]
commands[0] = command_remap(ly, self.commands_map[0])
commands[1] = command_remap(lx, self.commands_map[1])
commands[2] = command_remap(rx, self.commands_map[2])
break
return commandsFor Unitree G1, we also provide UnitreeWoGaitPolicy, which supports the new Unitree-G1-29dof-Velocity conig from unitree_rl_lab.
The difference is that UnitreeWoGaitPolicy does not include gait in the observation, so the robot will not keep stepping when standing.
script: unitree_policy.py
AMOPolicy is the policy that controls the robot using the AMO.
script: amo_policy.py
To control the robot using AMOPolicy, you can refer _get_commands():
commands:
commands[0], [-1, 1], control the robot to walk forward and backwardcommands[1], [-1, 1], control the robot to turn left and rightcommands[2], [-1, 1], control the robot to walk left and rightcommands[3], [-0.5, 0.8], control the robot torso heightcommands[4], [-1.57, 1.57], control the robot torso yawcommands[5], [-0.52, 1.57], control the robot torso pitchcommands[6], [-0.7, 0.7], control the robot torso roll
You can apply your own controller to control the robot using AMOPolicy. Just set the commands in _get_comands()
H2HStudentPolicy is the policy that controls the robot using the human2humanoid.
PHC Submodule is needed for motionlib control. check README#setup.
script: h2hstudent_policy.py
H2HStudentPolicy is controlled by MotionH2HCtrl. check code motion_h2h_ctrl.py.
For motion source:
Unitree H1: Simply use the motion retargeting pipeline from human2humanoid.Unitree G1: As not officially supported, we use the PHC pipeline. Our submodule patch enables 29dof G1. Check unitree_g1_29dof_fitting.yaml.
You can refer to g1_h2h config in g1_cfg.py for more details.
HugWBCPolicy is the policy that controls the robot using the HugWBC.
script: hugwbc_policy.py
🥺Will release soon.
BeyondMimicPolicy is the policy that controls the robot using the whole_body_tracking.
We support both G1FlatEnvCfg and G1FlatWoStateEstimationEnvCfg.
For motion source, you could use the motion inside onnx policy, or use BeyondmimicCtrl with npz files.
script: beyondmimic_policy.py
BeyondMimicPolicyCfg: check example at G1BeyondMimicPolicyCfg:
policy_name: The name of the policy. We proviveJump_wosefor test. You should put your policy inassets/models/g1/beyondmimicwithout_state_estimator: Weather policy isWoStateEstimation. Default isTrue.use_modelmeta_config: Whether to use modelmeta config. Default isTrue. IfFalse, the policy will use config in yourBeyondMimicPolicyCfg.use_motion_from_model: Whether to use motion in the onnx model. Default isTrue. IfFalse, you need to enableBeyondMimicCtrl. .
You can refer to g1_beyondmimic and g1_beyondmimic_with_ctrl in g1_cfg.py for details.
AsapPolicy is the policy that controls the robot using the ASAP.
Also, KungfuBot is supported by AsapPolicy.
RoboJuDo support both deepmimic and decoupled_locomotion of the official repo, implemeted as AsapPolicy and AsapLocoPolicy.
We fully reproduced the original repository, including keyboard and joystick mapping:
ito make the robot the initial positionoto emergence stop the robot
for locomotion policy:
=to switch between tapping and walking for the locomotion policyw/a/s/dto control the linear velocityq/eto control the angular velocityzto set all commands to zero
for policy switch:
[to switch to MotionMimic]to switch to LocoMotion;toggle next mimic policy'toggle prev mimic policy
or with joystick:
Leftto switch between tapping and walking for the locomotion policyUp/Downto control the heightleft axesto control the linear velocityright axesto control the angular velocitySelect/Backto switch to LocoMotionStartto switch to MotionMimicR1/RBto toggle next mimic policyL1/LBto toggle prev mimic policy
script: asap_policy.py
For your convenience,
CR7_level1checkpoint is included, you can ran sim2sim withg1_asapconfig in g1_asap_cfg.py.
You can add more models to assets/models/g1/asap/mimic. Any model in the official repo ASAP-sim2real, PBHC and RoboMimic_Deploy should work.
This example highlights the advantages of RoboJudo:
- Modular code & config with easy implementation and strong readability
- Flexible policy switching, with interpolation support.
- Convenient external controller processing
You can refer to g1_asap and g1_asap_loco config in g1_asap_cfg.py for test and details.
KungfuBotGeneralPolicy is the policy that controls the robot using the PBHC-KungfuBot2.
To be noted, this is for KungfuBot2 general model, for KungfuBot, please use AsapPolicy.
PHC Submodule is needed for motionlib control. check README.
script: kungfubot_policy.py
KungfuBotGeneralPolicyis controlled byMotionKungfuBotCtrl- check code motion_kungfubot_ctrl.py.
- motions from PBHC pipeline are supported. Put your motion files in
assets/motions/g1/phc/kungfubot/.
You can refer to g1_kungfubot2 config in g1_cfg.py for test and details.
TwistPolicy is the policy that controls the robot using the TWIST.
script: twist_policy.py
For TwistPolicy, we implement two motion source controllers:
-
TwistRedisCtrlat twist_redis_ctrl.py:- get motion from redis server, which is used in the original repo.
- it works with the motion server like server_high_level_motion_lib.py
-
MotionTwistCtrlat motion_twist_ctrl.py:
You can refer to g1_twist config in g1_cfg.py for test and details.