Proprioceptive system
Abstract base class for proprioception |
|
Simple implementation reading all values directly from the physics simulation. |
mimoProprioception.proprio
This module provides the interface and a simple implementation for proprioception.
The interface is defined as an abstract class in Proprioception.
A simple implementation directly reading values is in SimpleProprioception.
- class mimoProprioception.proprio.Proprioception(env, proprio_parameters)
Bases:
objectAbstract base class for proprioception
This class defines the functions that implementing classes must provide.
get_proprioception_obs()should return the complete sensor outputs and additionally store them insensor_outputs.- env
The environment to which this module will be attached.
- Type
Gym.Env
- proprio_parameters
A dictionary containing the configuration. The exact from will depend on the specific implementation.
- Type
Dict
- output_components
A list containing all the proprioceptive components that should be put in the output. This attribute is populated by proprio_parameters. These components must be in
VALID_COMPONENTS.- Type
List[str]
- sensor_outputs
A dictionary containing the outputs produced by the sensors. Shape will depend on the specific implementation. This should be populated by
get_proprioception_obs().- Type
Dict[str, np.ndarray]
- VALID_COMPONENTS = []
Valid entries for the output components
- get_proprioception_obs()
Produce the proprioceptive sensor outputs.
This function should perform the whole sensory pipeline and return the output as defined in
proprio_parameters. Exact return value and functionality will depend on the implementation, but should always be a flat numpy array.- Returns
A flat numpy array with proprioceptive outputs.
- Return type
np.ndarray
- class mimoProprioception.proprio.SimpleProprioception(env, proprio_parameters)
Bases:
mimoProprioception.proprio.ProprioceptionSimple implementation reading all values directly from the physics simulation.
This class can provide relative joint positions, joint velocities, joint torques and limit sensors on the joint range of motion. Torques are in newton-meters, all other values in radians. Joint positions are always part of the output, while the others can be added optionally through the configuration dictionary. Valid components are ‘velocity’, ‘torque’, ‘limits’ and ‘actuation’. The limit sensing increases linearly from 0 through 1 and beyond as the joint position moves within the threshold distance to the limit and then exceeds the limit. The threshold is part of the configuration. The ‘actuation’ component returns quantities from the actuation model. What these are depends on the specific actuation model. The configuration dictionary should have the form:
{ 'components': [list, of, components], 'threshold': threshold_value, }
Joint positions, velocities and limits are read from the simulation state directly, joint torques uses torque sensors placed between bodies in the scene. By default, MIMo has one sensor for each joint. Any torque sensor with the ‘proprio’ prefix is used for the output.
The following attributes are provided in addition to those of
Proprioception.- sensor_names
A dictionary of lists that can be used to find the joint/sensor of the associated entry in the output. The ith value in the joint position output belongs to joint sensor_names[‘qpos’][i].
- limit_thresh
Threshold distance to joint limit, in radians. If the joint is more than this distance away from the limit, the output will be 0. Default value is .035
- Type
- VALID_COMPONENTS = ['velocity', 'torque', 'limits', 'actuation']
Valid entries for the output components
- get_proprioception_obs()
Produce the proprioceptive sensor outputs.
Collects the proprioceptive output according to the sensor components.
sensor_outputsis populated by this function. The dictionary will always contain an entry ‘qpos’ with the joint positions and optionally includes ‘torques’, ‘limits’, and ‘qvel’ for the joint velocities. The return value is a concatenation of these entries.- Returns
A numpy array containing the concatenation of all enabled outputs.
- Return type
np.ndarray