Misc
sgptools.utils.misc
cont2disc(Xu, candidates, candidate_labels=None)
Map continuous space locations to a discrete set of candidate location
Parameters:
Name | Type | Description | Default |
---|---|---|---|
Xu |
ndarray
|
(m, 2); Continuous space points |
required |
candidates |
ndarray
|
(n, 2); Discrete set of candidate locations |
required |
candidate_labels |
ndarray
|
(n, 1); Labels corresponding to the discrete set of candidate locations |
None
|
Returns:
Name | Type | Description |
---|---|---|
Xu_x |
ndarray
|
Discrete space points' locations |
Xu_y |
ndarray
|
Labels of the discrete space points. Returned only if |
Source code in sgptools/utils/misc.py
get_inducing_pts(data, num_inducing, orientation=False, random=False)
Selects a subset of the data points to be used as inducing points. The default approach uses kmeans to select the subset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
ndarray
|
(n, 2); Data points to select the inducing points from |
required |
num_inducing |
int
|
Number of inducing points |
required |
orientation |
bool
|
If True, add an additional dimension to model the sensor FoV rotation angle |
False
|
random |
bool
|
If True, the subset of inducing points are selected randomly instead of using kmeans |
False
|
Returns:
Name | Type | Description |
---|---|---|
Xu |
ndarray
|
(m, d); Inducing points in the position and orientation space.
|
Source code in sgptools/utils/misc.py
interpolate_path(waypoints, sampling_rate=0.05)
Interpolate additional points between the given waypoints to simulate continuous sensing robots
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waypoints |
(n, d)
|
Waypoints of the robot's path |
required |
sampling_rate |
float
|
Distance between each pair of interpolated points |
0.05
|
Returns:
Name | Type | Description |
---|---|---|
path |
ndarray
|
(p, d) Interpolated path, |
Source code in sgptools/utils/misc.py
plot_paths(paths, candidates=None, title=None)
Function to plot the IPP solution paths
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paths |
ndarray
|
(r, m, 2); |
required |
candidates |
ndarray
|
(n, 2); Candidate unlabeled locations used in the SGP-based sensor placement approach |
None
|
title |
str
|
Title of the plot |
None
|
Source code in sgptools/utils/misc.py
project_waypoints(waypoints, candidates)
Project the waypoints back to the candidate set while retaining the waypoint visitation order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
waypoints |
(n, d)
|
Waypoints of the robot's path |
required |
candidates |
ndarray
|
(n, 2); Discrete set of candidate locations |
required |
Returns:
Name | Type | Description |
---|---|---|
waypoints |
(n, d)
|
Projected waypoints of the robot's path |