toddlerbot.locomotion package¶
Submodules¶
toddlerbot.locomotion.mjx_config module¶
- class toddlerbot.locomotion.mjx_config.MJXConfig¶
Bases:
object
Configuration class for the MJX environment.
- class ActionConfig(action_parts: List[str] = <factory>, action_scale: float = 0.25, filter_type: str = 'none', filter_order: int = 4, filter_cutoff: float = 10.0, contact_force_threshold: float = 1.0, n_steps_delay: int = 1, n_frames: int = 5, cycle_time: float = 0.72, waist_roll_max: float = 0.0)¶
Bases:
object
- action_parts: List[str]¶
- action_scale: float = 0.25¶
- contact_force_threshold: float = 1.0¶
- cycle_time: float = 0.72¶
- filter_cutoff: float = 10.0¶
- filter_order: int = 4¶
- filter_type: str = 'none'¶
- n_frames: int = 5¶
- n_steps_delay: int = 1¶
- waist_roll_max: float = 0.0¶
- class CommandsConfig(resample_time: float = 3.0, reset_time: float = 100.0, mean_reversion: float = 0.5, zero_chance: float = 0.2, turn_chance: float = 0.3, command_obs_indices: List[int] = <factory>, command_range: List[List[float]] = <factory>, deadzone: List[float] = <factory>)¶
Bases:
object
- command_obs_indices: List[int]¶
- command_range: List[List[float]]¶
- deadzone: List[float]¶
- mean_reversion: float = 0.5¶
- resample_time: float = 3.0¶
- reset_time: float = 100.0¶
- turn_chance: float = 0.3¶
- zero_chance: float = 0.2¶
- class DomainRandConfig(add_domain_rand: bool = True, friction_range: List[float] = <factory>, damping_range: List[float] = <factory>, armature_range: List[float] = <factory>, frictionloss_range: List[float] = <factory>, body_mass_range: List[float] = <factory>, ee_mass_range: List[float] = <factory>, other_mass_range: List[float] = <factory>, kp_range: List[float] = <factory>, kd_range: List[float] = <factory>, tau_max_range: List[float] = <factory>, q_dot_tau_max_range: List[float] = <factory>, q_dot_max_range: List[float] = <factory>, push_interval_s: int = 2, push_lin_vel: float = 0.5, push_ang_vel: float = 1.0)¶
Bases:
object
- add_domain_rand: bool = True¶
- armature_range: List[float]¶
- body_mass_range: List[float]¶
- damping_range: List[float]¶
- ee_mass_range: List[float]¶
- friction_range: List[float]¶
- frictionloss_range: List[float]¶
- kd_range: List[float]¶
- kp_range: List[float]¶
- other_mass_range: List[float]¶
- push_ang_vel: float = 1.0¶
- push_interval_s: int = 2¶
- push_lin_vel: float = 0.5¶
- q_dot_max_range: List[float]¶
- q_dot_tau_max_range: List[float]¶
- tau_max_range: List[float]¶
- class NoiseConfig(add_noise: bool = True, action_noise: float = 0.02, obs_noise_scale: float = 0.05, dof_pos: float = 1.0, dof_vel: float = 2.0, ang_vel: float = 5.0, euler: float = 2.0, backlash_scale: float = 0.02, backlash_activation: float = 0.1)¶
Bases:
object
- action_noise: float = 0.02¶
- add_noise: bool = True¶
- ang_vel: float = 5.0¶
- backlash_activation: float = 0.1¶
- backlash_scale: float = 0.02¶
- dof_pos: float = 1.0¶
- dof_vel: float = 2.0¶
- euler: float = 2.0¶
- obs_noise_scale: float = 0.05¶
- class ObsConfig(frame_stack: int = 15, c_frame_stack: int = 15, num_single_obs: int = 83, num_single_privileged_obs: int = 126)¶
Bases:
object
- c_frame_stack: int = 15¶
- frame_stack: int = 15¶
- num_single_obs: int = 83¶
- num_single_privileged_obs: int = 126¶
- class ObsScales(lin_vel: float = 2.0, ang_vel: float = 1.0, dof_pos: float = 1.0, dof_vel: float = 0.05, euler: float = 1.0)¶
Bases:
object
- ang_vel: float = 1.0¶
- dof_pos: float = 1.0¶
- dof_vel: float = 0.05¶
- euler: float = 1.0¶
- lin_vel: float = 2.0¶
- class RewardScales(torso_pos: float = 0.0, torso_quat: float = 0.0, torso_roll: float = 0.0, torso_pitch: float = 0.0, lin_vel_xy: float = 1.0, lin_vel_z: float = 1.0, ang_vel_xy: float = 1.0, ang_vel_z: float = 1.0, neck_motor_pos: float = 0.0, arm_motor_pos: float = 0.0, waist_motor_pos: float = 0.0, leg_motor_pos: float = 5.0, motor_torque: float = 0.01, energy: float = 0.01, neck_action_rate: float = 0.0, neck_action_acc: float = 0.0, arm_action_rate: float = 0.0, arm_action_acc: float = 0.0, waist_action_rate: float = 0.0, waist_action_acc: float = 0.0, leg_action_rate: float = 0.05, leg_action_acc: float = 0.05, feet_contact: float = 1.0, collision: float = 0.0, survival: float = 10.0, feet_air_time: float = 0.0, feet_distance: float = 0.0, feet_slip: float = 0.0, feet_clearance: float = 0.0, stand_still: float = 0.0, align_ground: float = 0.0)¶
Bases:
object
- align_ground: float = 0.0¶
- ang_vel_xy: float = 1.0¶
- ang_vel_z: float = 1.0¶
- arm_action_acc: float = 0.0¶
- arm_action_rate: float = 0.0¶
- arm_motor_pos: float = 0.0¶
- collision: float = 0.0¶
- energy: float = 0.01¶
- feet_air_time: float = 0.0¶
- feet_clearance: float = 0.0¶
- feet_contact: float = 1.0¶
- feet_distance: float = 0.0¶
- feet_slip: float = 0.0¶
- leg_action_acc: float = 0.05¶
- leg_action_rate: float = 0.05¶
- leg_motor_pos: float = 5.0¶
- lin_vel_xy: float = 1.0¶
- lin_vel_z: float = 1.0¶
- motor_torque: float = 0.01¶
- neck_action_acc: float = 0.0¶
- neck_action_rate: float = 0.0¶
- neck_motor_pos: float = 0.0¶
- reset()¶
- stand_still: float = 0.0¶
- survival: float = 10.0¶
- torso_pitch: float = 0.0¶
- torso_pos: float = 0.0¶
- torso_quat: float = 0.0¶
- torso_roll: float = 0.0¶
- waist_action_acc: float = 0.0¶
- waist_action_rate: float = 0.0¶
- waist_motor_pos: float = 0.0¶
- class RewardsConfig(healthy_z_range: List[float] = <factory>, tracking_sigma: float = 100.0, min_feet_y_dist: float = 0.05, max_feet_y_dist: float = 0.13, torso_roll_range: List[float] = <factory>, torso_pitch_range: List[float] = <factory>)¶
Bases:
object
- healthy_z_range: List[float]¶
- max_feet_y_dist: float = 0.13¶
- min_feet_y_dist: float = 0.05¶
- torso_pitch_range: List[float]¶
- torso_roll_range: List[float]¶
- tracking_sigma: float = 100.0¶
- toddlerbot.locomotion.mjx_config.get_env_config(env: str)¶
Retrieves and parses the configuration for a specified environment.
- Parameters:
env (str) – The name of the environment for which to retrieve the configuration.
- Returns:
An instance of MJXConfig initialized with the parsed configuration.
- Return type:
- Raises:
FileNotFoundError – If the configuration file for the specified environment does not exist.
toddlerbot.locomotion.mjx_env module¶
toddlerbot.locomotion.ppo_config module¶
- class toddlerbot.locomotion.ppo_config.PPOConfig(policy_hidden_layer_sizes: Tuple[int, ...] = (512, 256, 128), value_hidden_layer_sizes: Tuple[int, ...] = (512, 256, 128), num_timesteps: int = 100000000, num_evals: int = 1000, episode_length: int = 1000, unroll_length: int = 20, num_updates_per_batch: int = 4, discounting: float = 0.97, learning_rate: float = 0.0001, decay_steps: int = 50000000, alpha: float = 0.1, entropy_cost: float = 0.0005, clipping_epsilon: float = 0.2, num_envs: int = 1024, render_interval: int = 50, batch_size: int = 256, num_minibatches: int = 4, seed: int = 0)¶
Bases:
object
Data class for storing PPO hyperparameters.
- alpha: float = 0.1¶
- batch_size: int = 256¶
- clipping_epsilon: float = 0.2¶
- decay_steps: int = 50000000¶
- discounting: float = 0.97¶
- entropy_cost: float = 0.0005¶
- episode_length: int = 1000¶
- learning_rate: float = 0.0001¶
- num_envs: int = 1024¶
- num_evals: int = 1000¶
- num_minibatches: int = 4¶
- num_timesteps: int = 100000000¶
- num_updates_per_batch: int = 4¶
- render_interval: int = 50¶
- seed: int = 0¶
- unroll_length: int = 20¶