A simple gym environment using pybox2d as the physics engine and matplotlib for graphics.
-
Download de ArmSim repo:
git clone https://github.com/francesco-mannella/ArmSim.git
-
Install the ArmSim package: cd ArmSim pip install -e .
import gym
import ArmSim
env = gym.make('ArmSimOneArm-v0')
for t in range(10):
env.render()
observation = env.step(env.action_space.sample())
The two possible values of the argument to be passed to env.render() are:
- "human": open a matplotlib figure and update it at each call.
- "offline": save a frame into a png file at each call. Files are saved into the local folder 'frames'. This folder is created if it does not exist.
Example in test.py |
The action attribute of env.step must be a vector of 7 joint positions in radiants. The first 7 joints have a range between -Pi/2 and +Pi/2. The two gripper joints have a range between 0 and +Pi/2. They are also coupled so that the second joint will be at most twice the angle of the first one.
|
The observation object returned by env.step is a dictionary:
- observation["JOINT_POSITIONS"] is a vector containing the current angles of the 7:w joints
- observation["TOUCH_SENSORS"] is a vector containing the current touch intensity at the four touch sensors (see figure below)
- observation["OBJ_POSITION"] coordinates of the center of mass of the external object
The reward value returned by env.step is always put to 0.
The done value returned by env.step is always set to False.
The info value returned by env.step is always set to an empy set {}. .