SELAB3 Python Code
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
environment.environment.SimEnv Class Reference

Custom Environment that follows gym interface. More...

Inheritance diagram for environment.environment.SimEnv:

Public Member Functions

None __init__ (self, str env_path, str urdf, bool use_graphics, int worker_id=0)
 The SimEnv class initializer. More...
 
None set_goal (self, tuple goal)
 Set the coordinates of the goal visualization. More...
 
None set_workspace (self, tuple workspace)
 Set the coordinates and size of the workspace visualization. More...
 
None build_wall (self, List[List[bool]] wall)
 Build a new wall The first wall will be built on a certain distance from the anchor. More...
 
None remove_walls (self)
 Remove all walls.
 
None replace_walls (self, List[List[bool]] wall)
 Replace all the walls, build 1 new one See build_wall for how a wall is represented. More...
 
np.ndarray step (self, np.ndarray action, return_observations=True)
 Do 1 step in the unity environment. More...
 
np.ndarray reset (self)
 Reset the Unity Environment, essentially starting a new episode. More...
 
None pause (self, steps=200)
 For a certain amount of steps, take no action. More...
 
None close (self)
 Gym interface function to close the environment.
 
np.ndarray get_current_state (self)
 Get the observations from the Unity environment. More...
 

Public Attributes

 env_path
 
 urdf
 
 use_graphics
 
 worker_id
 
 joint_amount
 
 u_env
 
 behavior_name
 
 behavior_spec
 

Static Public Attributes

dictionary metadata = {'render.modes': ['human']}
 
int MAX_N_MODULES = 10
 
int JOINT_ANGLE_STEP = 10
 

Detailed Description

Custom Environment that follows gym interface.

Constructor & Destructor Documentation

◆ __init__()

None environment.environment.SimEnv.__init__ (   self,
str  env_path,
str  urdf,
bool  use_graphics,
int   worker_id = 0 
)

The SimEnv class initializer.

Parameters
env_pathPath of the environment executable.
urdfInstance that represents the robot urdf.
use_graphicsBoolean that turns graphics on or off.
Returns
An instance of the SimEnv class.

Member Function Documentation

◆ build_wall()

None environment.environment.SimEnv.build_wall (   self,
List[List[bool]]  wall 
)

Build a new wall The first wall will be built on a certain distance from the anchor.

Every subsequent wall will be built on a certain distance from the previous wall.

Walls are represented by a 2D array of booleans True means there is a tile on that 'coordinate/index' and False meaning there is not

Parameters
wallThe new wall.

◆ get_current_state()

np.ndarray environment.environment.SimEnv.get_current_state (   self)

Get the observations from the Unity environment.

Returns
The observations.

◆ pause()

None environment.environment.SimEnv.pause (   self,
  steps = 200 
)

For a certain amount of steps, take no action.

Achieved by taking "zero" actions.

◆ replace_walls()

None environment.environment.SimEnv.replace_walls (   self,
List[List[bool]]  wall 
)

Replace all the walls, build 1 new one See build_wall for how a wall is represented.

Parameters
wallThe new wall

◆ reset()

np.ndarray environment.environment.SimEnv.reset (   self)

Reset the Unity Environment, essentially starting a new episode.

The effect is that OnEpisodeBegin is called in Unity.

Returns
Observations obtained after the reset.

◆ set_goal()

None environment.environment.SimEnv.set_goal (   self,
tuple  goal 
)

Set the coordinates of the goal visualization.

Parameters
goalThe coordinates: (x, y, z).

◆ set_workspace()

None environment.environment.SimEnv.set_workspace (   self,
tuple  workspace 
)

Set the coordinates and size of the workspace visualization.

Parameters
workspaceThe coordinates and size: (x, y, z, sideLength).

◆ step()

np.ndarray environment.environment.SimEnv.step (   self,
np.ndarray  action,
  return_observations = True 
)

Do 1 step in the unity environment.

Parameters
actionThe action for this step.
return_observationsWhether to return observations after the step is taken.
Returns
Observations after the step is taken.

The documentation for this class was generated from the following file: