Class for utility functions for coverage environment.
More...
|
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_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.
|
|
Class for utility functions for coverage environment.
Definition at line 45 of file coverage_env_utils.py.
◆ 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
-
env | coverage environment |
params | parameters |
map_size | size of the map |
- Returns
-
torch communication maps
Definition at line 162 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
-
env | coverage environment |
params | parameters |
resized_map_size | size of the resized maps |
use_comm_map | whether to use communication maps |
- Returns
-
torch maps
Definition at line 243 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
-
env | coverage environment |
params | parameters |
- Returns
-
torch raw local maps
Definition at line 111 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
-
env | coverage environment |
params | parameters |
- Returns
-
torch raw obstacle maps
Definition at line 133 of file coverage_env_utils.py.
◆ get_robot_positions()
torch.Tensor get_robot_positions |
( |
CoverageSystem | env | ) |
|
|
static |
◆ 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
-
env | coverage environment |
params | parameters |
use_cnn | whether to use CNN |
use_comm_map | whether to use communication maps |
map_size | size of the maps |
- Returns
-
torch_geometric torch geometric data
Definition at line 355 of file coverage_env_utils.py.
◆ get_voronoi_features()
torch.Tensor get_voronoi_features |
( |
CoverageSystem | env | ) |
|
|
static |
◆ get_weights()
torch.Tensor get_weights |
( |
CoverageSystem | env, |
|
|
Parameters | params ) |
|
static |
Get edge weights for the communication graph.
- Parameters
-
env | coverage environment |
params | parameters |
- Returns
-
torch edge weights
Definition at line 326 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
-
maps | input maps |
resized_map_size | size of the resized maps |
- Returns
-
torch resized maps
Definition at line 216 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
-
- Returns
-
torch converted data
- Exceptions
-
ValueError | if data type is not supported |
Definition at line 69 of file coverage_env_utils.py.