Actuator#
- class genesis_forge.managers.actuator.ActuatorManager(env: GenesisEnv, joint_names: list[str] | str = '.*', default_pos: float | NoisyValue | dict = {'.*': 0.0}, kp: float | NoisyValue | dict = None, kv: float | NoisyValue | dict = None, max_force: float | NoisyValue | tuple[Any, Any] | dict = None, damping: float | NoisyValue | dict = None, stiffness: float | NoisyValue | dict = None, frictionloss: float | NoisyValue | dict = None, armature: float | NoisyValue | dict = None, default_noise_scale: float = 0.0, entity_attr: str = 'robot')[source]#
Bases:
BaseManagerConfigures and manages the actuators of your robot. You can define values for all actuators, or target specific joints by name or name pattern (see example). To add some domain randomization, you can define the values as NoisyValue objects, which will apply random noise at each reset.
- Parameters:
env – The environment to manage the DOF actuators for.
joint_names – The joint names to manage.
default_pos – The default DOF positions. The DOF joints will be set to these positions on reset.
kp – The positional gain values.
kv – The velocity gains values.
max_force – Define the maximum actuator force. Either as a single value or a tuple range.
damping – The damping values.
stiffness – The stiffness values.
frictionloss – The frictionloss values.
armature – The armature values.
entity_attr – The attribute of the environment to get the robot from.
default_noise_scale – (deprecated) This noise scale will be applied to all actuator values. Use NoisyValue instead.
Example:
class MyEnv(ManagedEnvironment): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.actuator_manager = ActuatorManager( self, joint_names=".*", default_pos={ "Leg[1-2]_Hip": -1.0, "Leg[3-4]_Hip": 1.0, "Leg[1-4]_Femur": 0.5, "Leg[1-4]_Tibia": 0.6, }, kp={ ".*_Hip": NoisyValue(50, 0.02), "*__Femur": NoisyValue(30, 0.01), "*__Tibia": NoisyValue(30, 0.01), }, kv=0.5, max_force=8.0, )
- control_dofs_position(position: torch.Tensor)[source]#
Control the position of the configured DOFs. This is a wrapper for RigidEntity.control_dofs_position.
- Parameters:
position – The position to set the DOFs to. The indices of this tensor should match the configured DOFs (see: dofs_names and dofs_idx properties).
- get_dofs_force(noise: float = 0.0, clip_to_max_force: bool = False)[source]#
Return the force experienced by the configured DOFs. This is a wrapper for RigidEntity.get_dofs_force.
- Parameters:
noise – The maximum amount of random noise to add to the force values returned.
clip_to_max_force – Clip the force returned to the maximum force of the actuators.
- Returns:
The force experienced by the enabled DOFs.
- get_dofs_limits() tuple[torch.Tensor, torch.Tensor][source]#
Return the limits of the configured DOFs. This is a wrapper for RigidEntity.get_dofs_limit.
- Returns:
A tuple of two tensors, the first is the lower limits and the second is the upper limits. Each tensor is of shape (num_envs, num_dofs).
- get_dofs_position(noise: float = 0.0)[source]#
Return the current position of the configured DOFs. This is a wrapper for RigidEntity.get_dofs_position.
- Parameters:
noise – The maximum amount of random noise to add to the position values returned.
- get_dofs_velocity(noise: float = 0.0, clip: tuple[float, float] = None)[source]#
Return the current velocity of the configured DOFs. This is a wrapper for RigidEntity.get_dofs_velocity.
- Parameters:
noise – The maximum amount of random noise to add to the velocity values returned.
clip – Clip the velocity returned.
- set_dofs_position(position: torch.Tensor)[source]#
Set the position of the configured DOFs. This is a wrapper for RigidEntity.set_dofs_position.
- Parameters:
position – The position to set the DOFs to. The indices of this tensor should match the configured DOFs (see: dofs_names and dofs_idx properties).
- step()#
Called when the environment is stepped
- property default_dofs_pos: torch.Tensor#
Return the default DOF positions.