Coverage Control Library
Loading...
Searching...
No Matches
CoverageEnvUtils Class Reference

Class for utility functions for coverage environment. More...

Static Public Member Functions

torch.Tensor to_tensor (object data)
 Converts various types of data to torch.Tensor.
 
torch.Tensor get_raw_local_maps (CoverageSystem env, Parameters params)
 Get raw local maps.
 
torch.Tensor get_raw_obstacle_maps (CoverageSystem env, Parameters params)
 Get raw obstacle maps.
 
torch.Tensor get_communication_maps (CoverageSystem env, Parameters params, int map_size)
 Generate communication maps from positions.
 
torch.Tensor resize_maps (torch.Tensor maps, int resized_map_size)
 Resize maps to a given size Uses bilinear interpolation from torchvision.transforms.functional.resize Options antialias=True.
 
torch.Tensor get_maps (CoverageSystem env, Parameters params, int resized_map_size, bool use_comm_map)
 Get maps for the coverage environment.
 
torch.Tensor get_voronoi_features (CoverageSystem env)
 Get voronoi features.
 
torch.Tensor get_robot_positions (CoverageSystem env)
 Get robot positions.
 
torch.Tensor get_weights (CoverageSystem env, Parameters params)
 Get edge weights for the communication graph.
 
torch.Tensor robot_positions_to_edge_weights (PointVector robot_positions, int world_map_size, float comm_range)
 Convert robot positions to edge weights.
 
torch_geometric.data.Data get_torch_geometric_data (CoverageSystem env, Parameters params, bool use_cnn, bool use_comm_map, int map_size)
 Get torch geometric data In this function, the edge weights are binary.
 

Detailed Description

Class for utility functions for coverage environment.

Definition at line 46 of file coverage_env_utils.py.

Member Function Documentation

◆ get_communication_maps()

torch.Tensor get_communication_maps ( CoverageSystem env,
Parameters params,
int map_size )
static

Generate communication maps from positions.

   Communication maps are composed of two channels.
   Each channnel has non-zero values for cells that correspond to the relative positions of the neighbors.
   For the first channel, the value is the x-coordinate of the relative position divided by the communication range.
   Similarly, the y-coordinte is used for the second channel.
Parameters
envcoverage environment
paramsparameters
map_sizesize of the map
Returns
torch communication maps

Definition at line 163 of file coverage_env_utils.py.

◆ get_maps()

torch.Tensor get_maps ( CoverageSystem env,
Parameters params,
int resized_map_size,
bool use_comm_map )
static

Get maps for the coverage environment.

Parameters
envcoverage environment
paramsparameters
resized_map_sizesize of the resized maps
use_comm_mapwhether to use communication maps
Returns
torch maps

Definition at line 244 of file coverage_env_utils.py.

◆ get_raw_local_maps()

torch.Tensor get_raw_local_maps ( CoverageSystem env,
Parameters params )
static

Get raw local maps.

Parameters
envcoverage environment
paramsparameters
Returns
torch raw local maps

Definition at line 112 of file coverage_env_utils.py.

◆ get_raw_obstacle_maps()

torch.Tensor get_raw_obstacle_maps ( CoverageSystem env,
Parameters params )
static

Get raw obstacle maps.

Parameters
envcoverage environment
paramsparameters
Returns
torch raw obstacle maps

Definition at line 134 of file coverage_env_utils.py.

◆ get_robot_positions()

torch.Tensor get_robot_positions ( CoverageSystem env)
static

Get robot positions.

Parameters
envcoverage environment
Returns
torch robot positions

Definition at line 309 of file coverage_env_utils.py.

◆ get_torch_geometric_data()

torch_geometric.data.Data get_torch_geometric_data ( CoverageSystem env,
Parameters params,
bool use_cnn,
bool use_comm_map,
int map_size )
static

Get torch geometric data In this function, the edge weights are binary.

Parameters
envcoverage environment
paramsparameters
use_cnnwhether to use CNN
use_comm_mapwhether to use communication maps
map_sizesize of the maps
Returns
torch_geometric torch geometric data

Definition at line 381 of file coverage_env_utils.py.

◆ get_voronoi_features()

torch.Tensor get_voronoi_features ( CoverageSystem env)
static

Get voronoi features.

Parameters
envcoverage environment
Returns
torch voronoi features

Definition at line 290 of file coverage_env_utils.py.

◆ get_weights()

torch.Tensor get_weights ( CoverageSystem env,
Parameters params )
static

Get edge weights for the communication graph.

Parameters
envcoverage environment
paramsparameters
Returns
torch edge weights

Definition at line 325 of file coverage_env_utils.py.

◆ resize_maps()

torch.Tensor resize_maps ( torch.Tensor maps,
int resized_map_size )
static

Resize maps to a given size Uses bilinear interpolation from torchvision.transforms.functional.resize Options antialias=True.

Parameters
mapsinput maps
resized_map_sizesize of the resized maps
Returns
torch resized maps

Definition at line 217 of file coverage_env_utils.py.

◆ robot_positions_to_edge_weights()

torch.Tensor robot_positions_to_edge_weights ( PointVector robot_positions,
int world_map_size,
float comm_range )
static

Convert robot positions to edge weights.

Parameters
robot_positionsrobot positions
world_map_sizesize of the world map
comm_rangecommunication range
Returns
torch edge weights

Definition at line 353 of file coverage_env_utils.py.

◆ to_tensor()

torch.Tensor to_tensor ( object data)
static

Converts various types of data to torch.Tensor.

   Can accept the following types:
- numpy.ndarray
- PointVector
- DblVectorVector
- DblVector
Parameters
datainput data
Returns
torch converted data
Exceptions
ValueErrorif data type is not supported

Definition at line 70 of file coverage_env_utils.py.