Task

The interaction with environment during training differs depending on type of task that is being trained. Therefore are observations, the necessary inputs for Reinforcement Learning, collected by this Task Module and are adjusted to particular task that is trained. The types of tasks implemented in myGym are: reach, push, throw and pick_and_place.

class myGym.envs.task.TaskModule(task_type='reach', task_objects='cube_holes', num_subgoals=0, reward_type='gt', vae_path=None, yolact_path=None, yolact_config=None, distance_type='euclidean', logdir='/home/megi/git/myGym/myGym/envs', env=None, pybullet_client=None)[source]

Task module class for task management

Parameters:
param task_type

(string) Type of learned task (reach, push, …)

param num_subgoals

(int) Number of subgoals in task

param task_objects

(list of strings) Objects that are relevant for performing the task

param reward_type

(string) Type of reward signal source (gt, 3dvs, 2dvu)

param distance_type

(string) Way of calculating distances (euclidean, manhattan)

param logdir

(string) Directory for logging

param env

(object) Environment, where the training takes place

param pybullet_client

Which pybullet client the environment should refere to in case of parallel existence of multiple instances of this environment

reset_task()[source]

Reset task relevant data and statistics

get_observation()[source]

Get task relevant observation data based on reward signal source

Returns:
return self._observation

(array) Task relevant observation data, positions of task objects

check_vision_failure()[source]

Check if YOLACT vision model fails repeatedly during episode

Returns:
return

(bool)

check_time_exceeded()[source]

Check if maximum episode time was exceeded

Returns:
return

(bool)

check_object_moved(object, threshold=0.3)[source]

Check if object moved more than allowed threshold

Parameters:
param object

(object) Object to check

param threshold

(float) Maximum allowed object movement

Returns:
return

(bool)

check_distance_threshold(observation)[source]

Check if the distance between relevant task objects is under threshold for successful task completion

Returns:
return

(bool)

check_goal()[source]

Check if goal of the task was completed successfully

calc_distance(obj1, obj2)[source]

Calculate distance between two objects

Parameters:
param obj1

(float array) First object position representation

param obj2

(float array) Second object position representation

Returns:
return dist

(float) Distance between 2 float arrays

calc_rotation_diff(obj1, obj2)[source]

Calculate diffrence between orientation of two objects

Parameters:
param obj1

(float array) First object orientation (Quaternion xyzw)

param obj2

(float array) Second object orientation (Quaterion xyzw)

Returns:
return diff

(float) Distance between 2 float arrays

generate_new_goal(object_area_borders, camera_id)[source]

Generate an image of new goal for VEA vision model. This function is supposed to be called from env workspace.

Parameters:
param object_area_borders

(list) Volume in space where task objects can be located

param camera_id

(int) ID of environment camera active for image rendering