Decision Module  1.0
ICRA2020 AI Challenge Northwestern Polytechnical University Aoxiang Team Strategy Code
firefly_env.FireflyEnv Class Reference
Inheritance diagram for firefly_env.FireflyEnv:
robot_gazebo_env.RobotGazeboEnv

Public Member Functions

def __init__ (self)
 
def render (self, mode='human')
 
def start_game (self)
 
def get_blue1_ground_truth (self)
 
def get_blue2_ground_truth (self)
 
def get_red1_ground_truth (self)
 
def get_red2_ground_truth (self)
 
ShootInfo get_red2_shoot_info (self)
 
ShootInfo get_red1_shoot_info (self)
 
ShootInfo get_blue1_shoot_info (self)
 
ShootInfo get_blue2_shoot_info (self)
 
RobotStatus get_blue1_robot_status (self)
 
RobotStatus get_blue2_robot_status (self)
 
RobotStatus get_red1_robot_status (self)
 
RobotStatus get_red2_robot_status (self)
 
def get_buff_zones_status (self)
 
def get_game_status (self)
 
def get_game_survivor (self)
 
def reinit_sensors (self)
 
def get_obs (self)
 
def is_roll_over (self)
 
- Public Member Functions inherited from robot_gazebo_env.RobotGazeboEnv
def __init__ (self, robot_name_space, controllers_list, reset_controls, start_init_physics_parameters=True, reset_world_or_sim="SIMULATION")
 
def seed (self, seed=None)
 
def step (self, action)
 
def reset (self)
 
def close (self)
 

Public Attributes

 controllers_list
 
 robot_name_space
 
 red1_ground_truth_pose
 
 red2_ground_truth_pose
 
 blue1_ground_truth_pose
 
 blue2_ground_truth_pose
 
 red1_shoot_info
 
 red2_shoot_info
 
 blue1_shoot_info
 
 blue2_shoot_info
 
 red1_robot_status
 
 red2_robot_status
 
 blue1_robot_status
 
 blue2_robot_status
 
 buff_zone_status
 
 game_status
 
 game_survivor
 
 rate
 
 my_robots_pose
 
- Public Attributes inherited from robot_gazebo_env.RobotGazeboEnv
 gazebo
 
 controllers_object
 
 reset_controls
 
 episode_num
 
 cumulated_episode_reward
 
 reward_pub
 

Private Member Functions

def _check_all_systems_ready (self)
 
def _check_all_sensors_ready (self)
 
def _check_red2_ground_truth_ready (self)
 
def _check_red1_ground_truth_ready (self)
 
def _check_blue1_ground_truth_ready (self)
 
def _check_blue2_ground_truth_ready (self)
 
def _check_red2_robot_status_ready (self)
 
def _check_red1_robot_status_ready (self)
 
def _check_blue1_robot_status_ready (self)
 
def _check_blue2_robot_status_ready (self)
 
def _red2_ground_truth_callback (self, Odometry data)
 
def _red1_ground_truth_callback (self, Odometry data)
 
def _blue1_ground_truth_callback (self, Odometry data)
 
def _blue2_ground_truth_callback (self, Odometry data)
 
def _red2_shoot_info_callback (self, data)
 
def _red1_shoot_info_callback (self, data)
 
def _blue1_shoot_info_callback (self, data)
 
def _blue2_shoot_info_callback (self, data)
 
def _check_red2_shoot_info_ready (self)
 
def _check_red1_shoot_info_ready (self)
 
def _check_blue1_shoot_info_ready (self)
 
def _check_blue2_shoot_info_ready (self)
 
def _red2_robot_status_callback (self, data)
 
def _red1_robot_status_callback (self, data)
 
def _blue1_robot_status_callback (self, data)
 
def _blue2_robot_status_callback (self, data)
 
def _buff_zone_status_callback (self, data)
 
def _check_buff_zone_status_ready (self)
 
def _game_status_callback (self, data)
 
def _check_game_status_ready (self)
 
def _game_survivor_callback (self, data)
 
def _check_game_survivor_ready (self)
 
def _robot_strategy_status_callback (self, RobotStrategyState data)
 
def _check_publishers_connection (self)
 
def _set_init_pose (self)
 
def _init_env_variables (self)
 
def _env_setup (self, initial_qpos)
 
def _compute_reward (self, observations, done, my_color='red')
 
def _set_action (self, action)
 
def _get_obs (self)
 
def _is_done (self, observations)
 
def _is_stop (self, stop_time=60)
 

Static Private Member Functions

def _get_continuous_data_num (list data_list, finish=-1)
 

Private Attributes

 _robot_strategy_status
 
 _my_color
 
 _acion_id_pub
 
 _robot_pose_pub
 
 _reset_referee_pub
 

Detailed Description

Superclass for all CubeSingleDisk environments.

Constructor & Destructor Documentation

◆ __init__()

def firefly_env.FireflyEnv.__init__ (   self)
Initializes a new FireflyEnv environment.

To check any topic we need to have the simulations running, we need to do two things:
1) Unpause the simulation: without that th stream of data doesnt flow. This is for simulations
that are pause for whatever the reason
2) If the simulation was running already for some reason, we need to reset the controlers.
This has to do with the fact that some plugins with tf, dont understand the reset of the simulation
and need to be reseted to work properly.

The Sensors: The sensors accesible are the ones considered usefull for AI learning.

Args:

Member Function Documentation

◆ _blue1_ground_truth_callback()

def firefly_env.FireflyEnv._blue1_ground_truth_callback (   self,
Odometry  data 
)
private

◆ _blue1_robot_status_callback()

def firefly_env.FireflyEnv._blue1_robot_status_callback (   self,
  data 
)
private

◆ _blue1_shoot_info_callback()

def firefly_env.FireflyEnv._blue1_shoot_info_callback (   self,
  data 
)
private

◆ _blue2_ground_truth_callback()

def firefly_env.FireflyEnv._blue2_ground_truth_callback (   self,
Odometry  data 
)
private

◆ _blue2_robot_status_callback()

def firefly_env.FireflyEnv._blue2_robot_status_callback (   self,
  data 
)
private

◆ _blue2_shoot_info_callback()

def firefly_env.FireflyEnv._blue2_shoot_info_callback (   self,
  data 
)
private

◆ _buff_zone_status_callback()

def firefly_env.FireflyEnv._buff_zone_status_callback (   self,
  data 
)
private

◆ _check_all_sensors_ready()

def firefly_env.FireflyEnv._check_all_sensors_ready (   self)
private

◆ _check_all_systems_ready()

def firefly_env.FireflyEnv._check_all_systems_ready (   self)
private
Checks that all the sensors, publishers and other simulation systems are
operational.

Reimplemented from robot_gazebo_env.RobotGazeboEnv.

◆ _check_blue1_ground_truth_ready()

def firefly_env.FireflyEnv._check_blue1_ground_truth_ready (   self)
private

◆ _check_blue1_robot_status_ready()

def firefly_env.FireflyEnv._check_blue1_robot_status_ready (   self)
private

◆ _check_blue1_shoot_info_ready()

def firefly_env.FireflyEnv._check_blue1_shoot_info_ready (   self)
private

◆ _check_blue2_ground_truth_ready()

def firefly_env.FireflyEnv._check_blue2_ground_truth_ready (   self)
private

◆ _check_blue2_robot_status_ready()

def firefly_env.FireflyEnv._check_blue2_robot_status_ready (   self)
private

◆ _check_blue2_shoot_info_ready()

def firefly_env.FireflyEnv._check_blue2_shoot_info_ready (   self)
private

◆ _check_buff_zone_status_ready()

def firefly_env.FireflyEnv._check_buff_zone_status_ready (   self)
private

◆ _check_game_status_ready()

def firefly_env.FireflyEnv._check_game_status_ready (   self)
private

◆ _check_game_survivor_ready()

def firefly_env.FireflyEnv._check_game_survivor_ready (   self)
private

◆ _check_publishers_connection()

def firefly_env.FireflyEnv._check_publishers_connection (   self)
private
Checks that all the publishers are working
:return:

◆ _check_red1_ground_truth_ready()

def firefly_env.FireflyEnv._check_red1_ground_truth_ready (   self)
private

◆ _check_red1_robot_status_ready()

def firefly_env.FireflyEnv._check_red1_robot_status_ready (   self)
private

◆ _check_red1_shoot_info_ready()

def firefly_env.FireflyEnv._check_red1_shoot_info_ready (   self)
private

◆ _check_red2_ground_truth_ready()

def firefly_env.FireflyEnv._check_red2_ground_truth_ready (   self)
private

◆ _check_red2_robot_status_ready()

def firefly_env.FireflyEnv._check_red2_robot_status_ready (   self)
private

◆ _check_red2_shoot_info_ready()

def firefly_env.FireflyEnv._check_red2_shoot_info_ready (   self)
private

◆ _compute_reward()

def firefly_env.FireflyEnv._compute_reward (   self,
  observations,
  done,
  my_color = 'red' 
)
private
Calculates the reward to give based on the observations given.
我方血量:+k1×血量/2000
敌方血量:-k1×血量/2000
敌方死:+MAX
我方死:-MAX
敌方子弹量:-k2×敌方子弹/100
我方子弹量:+k2×我方子弹/100
执行上一拍策略:2^(-x)  连续执行次数x

◆ _env_setup()

def firefly_env.FireflyEnv._env_setup (   self,
  initial_qpos 
)
private
Initial configuration of the environment. Can be used to configure initial state
and extract information from the simulation.

Reimplemented from robot_gazebo_env.RobotGazeboEnv.

◆ _game_status_callback()

def firefly_env.FireflyEnv._game_status_callback (   self,
  data 
)
private

◆ _game_survivor_callback()

def firefly_env.FireflyEnv._game_survivor_callback (   self,
  data 
)
private

◆ _get_continuous_data_num()

def firefly_env.FireflyEnv._get_continuous_data_num ( list  data_list,
  finish = -1 
)
staticprivate
获得从finish向前连续的数据个数
:param finish: 计数的开始位置(从后往前)
:return: 连续的数据个数

◆ _get_obs()

def firefly_env.FireflyEnv._get_obs (   self)
private
Returns the observation.

Reimplemented from robot_gazebo_env.RobotGazeboEnv.

◆ _init_env_variables()

def firefly_env.FireflyEnv._init_env_variables (   self)
private
Inits variables needed to be initialised each time we reset at the start
of an episode.

Reimplemented from robot_gazebo_env.RobotGazeboEnv.

◆ _is_done()

def firefly_env.FireflyEnv._is_done (   self,
  observations 
)
private
Checks if episode done based on observations given.

Reimplemented from robot_gazebo_env.RobotGazeboEnv.

◆ _is_stop()

def firefly_env.FireflyEnv._is_stop (   self,
  stop_time = 60 
)
private
判断若我方两个机器人是否长时间静止
:return:

◆ _red1_ground_truth_callback()

def firefly_env.FireflyEnv._red1_ground_truth_callback (   self,
Odometry  data 
)
private

◆ _red1_robot_status_callback()

def firefly_env.FireflyEnv._red1_robot_status_callback (   self,
  data 
)
private

◆ _red1_shoot_info_callback()

def firefly_env.FireflyEnv._red1_shoot_info_callback (   self,
  data 
)
private

◆ _red2_ground_truth_callback()

def firefly_env.FireflyEnv._red2_ground_truth_callback (   self,
Odometry  data 
)
private

◆ _red2_robot_status_callback()

def firefly_env.FireflyEnv._red2_robot_status_callback (   self,
  data 
)
private

◆ _red2_shoot_info_callback()

def firefly_env.FireflyEnv._red2_shoot_info_callback (   self,
  data 
)
private

◆ _robot_strategy_status_callback()

def firefly_env.FireflyEnv._robot_strategy_status_callback (   self,
RobotStrategyState  data 
)
private

◆ _set_action()

def firefly_env.FireflyEnv._set_action (   self,
  action 
)
private
Applies the given action to the simulation.

Reimplemented from robot_gazebo_env.RobotGazeboEnv.

◆ _set_init_pose()

def firefly_env.FireflyEnv._set_init_pose (   self)
private
Sets the Robot in its init pose

Reimplemented from robot_gazebo_env.RobotGazeboEnv.

◆ get_blue1_ground_truth()

def firefly_env.FireflyEnv.get_blue1_ground_truth (   self)

◆ get_blue1_robot_status()

RobotStatus firefly_env.FireflyEnv.get_blue1_robot_status (   self)

◆ get_blue1_shoot_info()

ShootInfo firefly_env.FireflyEnv.get_blue1_shoot_info (   self)

◆ get_blue2_ground_truth()

def firefly_env.FireflyEnv.get_blue2_ground_truth (   self)

◆ get_blue2_robot_status()

RobotStatus firefly_env.FireflyEnv.get_blue2_robot_status (   self)

◆ get_blue2_shoot_info()

ShootInfo firefly_env.FireflyEnv.get_blue2_shoot_info (   self)

◆ get_buff_zones_status()

def firefly_env.FireflyEnv.get_buff_zones_status (   self)

◆ get_game_status()

def firefly_env.FireflyEnv.get_game_status (   self)

◆ get_game_survivor()

def firefly_env.FireflyEnv.get_game_survivor (   self)

◆ get_obs()

def firefly_env.FireflyEnv.get_obs (   self)

◆ get_red1_ground_truth()

def firefly_env.FireflyEnv.get_red1_ground_truth (   self)

◆ get_red1_robot_status()

RobotStatus firefly_env.FireflyEnv.get_red1_robot_status (   self)

◆ get_red1_shoot_info()

ShootInfo firefly_env.FireflyEnv.get_red1_shoot_info (   self)

◆ get_red2_ground_truth()

def firefly_env.FireflyEnv.get_red2_ground_truth (   self)

◆ get_red2_robot_status()

RobotStatus firefly_env.FireflyEnv.get_red2_robot_status (   self)

◆ get_red2_shoot_info()

ShootInfo firefly_env.FireflyEnv.get_red2_shoot_info (   self)

◆ is_roll_over()

def firefly_env.FireflyEnv.is_roll_over (   self)

◆ reinit_sensors()

def firefly_env.FireflyEnv.reinit_sensors (   self)
This method is for the tasks so that when reseting the episode
the sensors values are forced to be updated with the real data and

◆ render()

def firefly_env.FireflyEnv.render (   self,
  mode = 'human' 
)

◆ start_game()

def firefly_env.FireflyEnv.start_game (   self)

Member Data Documentation

◆ _acion_id_pub

firefly_env.FireflyEnv._acion_id_pub
private

◆ _my_color

firefly_env.FireflyEnv._my_color
private

◆ _reset_referee_pub

firefly_env.FireflyEnv._reset_referee_pub
private

◆ _robot_pose_pub

firefly_env.FireflyEnv._robot_pose_pub
private

◆ _robot_strategy_status

firefly_env.FireflyEnv._robot_strategy_status
private

◆ blue1_ground_truth_pose

firefly_env.FireflyEnv.blue1_ground_truth_pose

◆ blue1_robot_status

firefly_env.FireflyEnv.blue1_robot_status

◆ blue1_shoot_info

firefly_env.FireflyEnv.blue1_shoot_info

◆ blue2_ground_truth_pose

firefly_env.FireflyEnv.blue2_ground_truth_pose

◆ blue2_robot_status

firefly_env.FireflyEnv.blue2_robot_status

◆ blue2_shoot_info

firefly_env.FireflyEnv.blue2_shoot_info

◆ buff_zone_status

firefly_env.FireflyEnv.buff_zone_status

◆ controllers_list

firefly_env.FireflyEnv.controllers_list

◆ game_status

firefly_env.FireflyEnv.game_status

◆ game_survivor

firefly_env.FireflyEnv.game_survivor

◆ my_robots_pose

firefly_env.FireflyEnv.my_robots_pose

◆ rate

firefly_env.FireflyEnv.rate

◆ red1_ground_truth_pose

firefly_env.FireflyEnv.red1_ground_truth_pose

◆ red1_robot_status

firefly_env.FireflyEnv.red1_robot_status

◆ red1_shoot_info

firefly_env.FireflyEnv.red1_shoot_info

◆ red2_ground_truth_pose

firefly_env.FireflyEnv.red2_ground_truth_pose

◆ red2_robot_status

firefly_env.FireflyEnv.red2_robot_status

◆ red2_shoot_info

firefly_env.FireflyEnv.red2_shoot_info

◆ robot_name_space

firefly_env.FireflyEnv.robot_name_space

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