<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Setting Environments
In Explauto, an environment implements the physical properties of the interaction between the robot body and the environment in which it evolves. Explauto comes with several sensorimotor systems available from the environment package
Step1:  According to your installation, you will see different available environments
Step2:  There are 4 different configurations for the simple arm (we see 5 above, but the 'default' one actually corresponds to the 'low_dimensional' one).
In the case of the simple_arm environment, a configuration must defines the following values
Step3:  Once you have choose a configuration, say the 'default' one, you can create the Environment instance
Step4:  If you already now the name of the environment and the configuration you want to use (here
Step5:  Each environment has an update method, we take as argument a motor command vector $m$ (here
Step6:  We observe that the second value $\pi$ has been bounded to $m_maxs[1] = \pi/3$. The two last values correspond to the resulting $x, y$ end-effector postion.
The simple arm environment also comes with a method to visualize the arm shape for a given motor configuration
Step7:  The base of the arm is fixed at (0, 0) (circle). The first angle position m[0] corresponds to the angle between a horizontal line and the segment attached to the base, anticlock-wise. Each following angle position, m[1] and m[2] are measured with respect to their respective previous segment. 
The sensory space (what will actually perceive the simulated robot) is the 2D hand position (position of the square).
Now let's see various arm shapes corresponding to random motor configurations. The Environment base class, from which every explauto environments derive, provides a random_motor method to uniformely sample motor configurations within their bounds (defined in the configuration dictionary, see above).
Step8:  Exercise
Plot arm shapes corresponding to random motor configurations using the 'high_dimensional' configuration of the simple_arm. Then plot more, e.g. $100$, random configurations.
An interpretation of the obtained plot is provided below.
<ASSISTANT_TASK:>
Python Code:
from explauto.environment import environments
print 'Available environments: {}'.format(environments.keys())
Explanation: Setting Environments
In Explauto, an environment implements the physical properties of the interaction between the robot body and the environment in which it evolves. Explauto comes with several sensorimotor systems available from the environment package:
End of explanation
env_cls, env_configs, _ = environments['simple_arm']
print 'Available configurations for the simple arm environment: {}'.format(env_configs.keys())
Explanation: According to your installation, you will see different available environments:
* a multi-joint arm acting on a plan ('simple_arm')
* an under-actuated torque-controlled inverse pendulum  ('pendulum')
* a pendulum chain ('npendulum', still in a beta version, need sympy installed).
These environments are simulated. Explauto also provides an interface with real robots based on Dynamixel actuators by providing bindings to the Pypot library  (this tutorial shows how to use it on a Poppy robot).
We will use the simple arm for this tutorial. It consists in the simulation of a $n$ degrees-of-freedom (DoF) arm with movements limited to a 2D plan.
Each available environment comes with a set of predefined configurations. A default configuration will always be defined.
End of explanation
config = env_configs['default']
print 'Default configuration for the simple arm:'
for config_key, value in config.items():
    print '\t{}: {}'.format(config_key, value)
Explanation: There are 4 different configurations for the simple arm (we see 5 above, but the 'default' one actually corresponds to the 'low_dimensional' one).
In the case of the simple_arm environment, a configuration must defines the following values:
* m_mins and m_maxs (bounds of the motor space)
* s_mins ans s_maxs (bounds of the sensory space)
* length_ratio (length ratio from one segment to the following one)
* noise (gaussian noise added in the sensor space)
The motor space corresponds to the angular position of each joint (hence $n$-dimensional), and the sensory space corresponds to the position of the end-effector on the plan ($x,y$: hence 2-dimensional). Arm total length is normalized to 1.
For instance, the default configuration defines a $n=3$ DoF arm where each segment is three time smaller than the previous one (from the "shoulder" to the end-effector). Each joint can move between $-\pi/3$ and $\pi/3$:
End of explanation
environment = env_cls(**config)
Explanation: Once you have choose a configuration, say the 'default' one, you can create the Environment instance:
End of explanation
from explauto import Environment
environment = Environment.from_configuration('simple_arm', 'default')
Explanation: If you already now the name of the environment and the configuration you want to use (here: 'simple_arm' and 'default', respectively), you can alternatively use that shortcut:
End of explanation
from math import pi
m = [-pi/6., pi, pi/4.]
print environment.update(m)
Explanation: Each environment has an update method, we take as argument a motor command vector $m$ (here: $n=3$-dimensional). It computes $m_bounds$, the command $m$ bounded according to the configuration used (m_mins, m_maxs values), then computes the corresponding sensory effect vector $s$ ($2$-dimensional) and returns the corresponding $n+2=5$-dimensional vector:
End of explanation
%pylab inline
ax = axes()
m = [-pi/6., pi/3., pi/4.]
environment.plot_arm(ax, m)
Explanation: We observe that the second value $\pi$ has been bounded to $m_maxs[1] = \pi/3$. The two last values correspond to the resulting $x, y$ end-effector postion.
The simple arm environment also comes with a method to visualize the arm shape for a given motor configuration:
End of explanation
motor_configurations = environment.random_motors(n=10)
ax = axes()
for m in motor_configurations:
    environment.plot_arm(ax, m)
Explanation: The base of the arm is fixed at (0, 0) (circle). The first angle position m[0] corresponds to the angle between a horizontal line and the segment attached to the base, anticlock-wise. Each following angle position, m[1] and m[2] are measured with respect to their respective previous segment. 
The sensory space (what will actually perceive the simulated robot) is the 2D hand position (position of the square).
Now let's see various arm shapes corresponding to random motor configurations. The Environment base class, from which every explauto environments derive, provides a random_motor method to uniformely sample motor configurations within their bounds (defined in the configuration dictionary, see above).
End of explanation
%load exercise_solutions/setting_environment__high_dim_configuration.py
Explanation: Exercise
Plot arm shapes corresponding to random motor configurations using the 'high_dimensional' configuration of the simple_arm. Then plot more, e.g. $100$, random configurations.
An interpretation of the obtained plot is provided below.
End of explanation
<END_TASK>