environment Package¶
- class explauto.environment.environment.Environment(m_mins, m_maxs, s_mins, s_maxs)[source]¶
Bases: explauto.utils.observer.Observable
Abstract class to define environments.
When defining your sub-environment, you should specify whether they could be forked and run in different processes through the use_process class variable. By default, it is set to False to guarantee that the code will work.
Parameters: m_mins, m_maxs, s_mins, s_maxs (numpy.array) – bounds of the motor (m) and sensory (s) spaces - use_process = False¶
- classmethod from_configuration(env_name, config_name='default')[source]¶
Environment factory from name and configuration strings.
Parameters: Environment name strings are available using:
from explauto.environment import environments print environments.keys()
This will return the available environment names, something like:
'['npendulum', 'pendulum', 'simple_arm']'
Once you have choose an environment, e.g. ‘simple_arm’, corresponding available configurations are available using:
env_cls, env_configs, _ = environments['simple_arm'] print env_configs.keys()
This will return the available configuration names for the ‘simple_arm’ environment, something like:
'['mid_dimensional', 'default', 'high_dim_high_s_range', 'low_dimensional', 'high_dimensional']'
Once you have choose a configuration, for example the ‘mid_dimensional’ one, you can contruct the environment using:
from explauto import Environment my_environment = Environment.from_configuration('simple_arm', 'mid_dimensional')
Or, in an equivalent manner:
my_environment = env_cls(**env_configs['mid_dimensional'])
- update(m_ag, log=True)[source]¶
Computes sensorimotor values from motor orders.
Parameters: - m_ag (numpy.array) – a motor command with shape (self.conf.m_ndims, ) or a set of n motor commands of shape (n, self.conf.m_ndims)
- log (bool) – emit the motor and sensory values for logging purpose (default: True).
Returns: an array of shape (self.conf.ndims, ) or (n, self.conf.ndims) according to the shape of the m_ag parameter, containing the motor values (which can be different from m_ag, e.g. bounded according to self.conf.m_bounds) and the corresponding sensory values.
Note
self.conf.ndims = self.conf.m_ndims + self.conf.s_ndims is the dimensionality of the sensorimotor space (dim of the motor space + dim of the sensory space).
- explauto.environment.simple_arm.simple_arm.forward(angles, lengths)[source]¶
Link object as defined by the standard DH representation.
Parameters: Returns: a tuple (x, y) of the end-effector position
Warning
angles and lengths should be the same size.
- explauto.environment.simple_arm.simple_arm.joint_positions(angles, lengths)[source]¶
Link object as defined by the standard DH representation.
Parameters: Returns: x positions of each joint, y positions of each joints, except the first one wich is fixed at (0, 0)
Warning
angles and lengths should be the same size.
- class explauto.environment.simple_arm.simple_arm.SimpleArmEnvironment(m_mins, m_maxs, s_mins, s_maxs, length_ratio, noise)[source]¶
Bases: explauto.environment.environment.Environment
- use_process = True¶
- class explauto.environment.pendulum.pendulum.PendulumEnvironment(m_mins, m_maxs, s_mins, s_maxs, noise, torque_max=0.25, dt=0.25)[source]¶
- class explauto.environment.pypot.pypot_robot.PypotEnvironment(robot_cls, robot_conf, motors, move_duration, tracked_obj, m_mins, m_maxs, s_mins, s_maxs)[source]¶
Bases: explauto.environment.environment.Environment
Environment based on dynamixel based robot using pypot.
This environment can be used to link explauto with pypot, a library allowing to control robot based on dynamixel motors. It uses an optitrack has the sensor. This could easily be changed by defining other pypot environments.
Parameters: - get_pypot_robot – function returning the pypot robot used as the environment
- motors (list of DxlMotor) – list of motors used by the environment
- move_duration (float) – duration (in sec.) of each primitive motion
- tracker (Tracker) – tracker used as the sensor by the Agent
- tracked_obj (string) – name of the object tracked by the optitrack
- m_mins (numpy.array) – minimum motor dims
- m_maxs (numpy.array) – maximum motor dims
- s_mins (numpy.array) – minimum sensor dims
- s_maxs (numpy.array) – maximum sensor dims
- use_process = False¶
- class explauto.environment.pypot.pypot_robot.VrepRobot(config_path, scene_path, host='127.0.0.1', port=19997, tracked_objects=['left_hand_tracker', 'right_hand_tracker'])[source]¶
Bases: object
- explauto.environment.pypot.pypot_robot.get_configuration(get_robot, tracker_cls, tracked_obj, m_mins=array([-0.26179939, 0., -1.57079633, -1.57079633]), m_maxs=array([ 1.57079633, 1.57079633, 1.57079633, 0. ]), s_mins=array([-0.2, -0.1, 0. ]), s_maxs=array([ 0.4, 0.5, 0.6]))[source]¶
- explauto.environment.pypot.pypot_robot.environment¶
alias of PypotEnvironment