Swarm-SLAM
1.0.0
C-SLAM Framework
|
Public Member Functions | |
def | __init__ (self, robot_id=0, max_nb_robots=1, max_iters=20, fixed_weight=1.0, extra_params={ "frontend.enable_sparsification":True, "evaluation.enable_sparsification_comparison":False, }) |
def | edge_key (self, edge) |
def | replace_weight (self, edge, weight) |
def | update_nb_poses (self, edge) |
def | update_initial_fixed_edge_exists (self, fixed_edge) |
def | set_graph (self, fixed_edges, candidate_edges) |
def | add_fixed_edge (self, edge) |
def | add_candidate_edge (self, edge) |
def | remove_candidate_edges (self, edges, failed=False) |
def | candidate_edges_to_fixed (self, edges) |
def | greedy_initialization (self, nb_candidates_to_choose, edges) |
def | pseudo_greedy_initialization (self, nb_candidates_to_choose, nb_random, edges) |
def | random_initialization (self, nb_candidates_to_choose, edges) |
def | connection_biased_greedy_selection (self, nb_candidates_to_choose, edges, is_robot_included) |
def | compute_offsets (self, is_robot_included) |
def | rekey_edges (self, edges, is_robot_included) |
def | get_included_edges (self, edges, is_robot_included) |
def | fill_odometry (self) |
def | recover_inter_robot_edges (self, edges, is_robot_included) |
def | check_graph_disconnections (self, is_other_robot_considered) |
def | check_initial_fixed_measurements_exists (self, is_robot_included) |
def | run_mac_solver (self, fixed_edges, candidate_edges, w_init, nb_candidates_to_choose) |
def | select_candidates (self, nb_candidates_to_choose, is_other_robot_considered, greedy_initialization=True) |
def | sparsification_comparison_logs (self, rekeyed_candidate_edges, is_robot_included, greedy_result, mac_result) |
def | add_match (self, match) |
Definition at line 34 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.__init__ | ( | self, | |
robot_id = 0 , |
|||
max_nb_robots = 1 , |
|||
max_iters = 20 , |
|||
fixed_weight = 1.0 , |
|||
extra_params = {
"frontend.enable_sparsification": True,
"evaluation.enable_sparsification_comparison": False,
} |
|||
) |
Initialization Args: robot_id (int, optional): ID of the robot max_nb_robots (int, optional): number of robots. Defaults to 1. max_iters (int, optional): maximum number of iterations. Defaults to 20. fixed_weight (float, optional): weight of fixed measurements. Defaults to 1.0.
Definition at line 36 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.add_candidate_edge | ( | self, | |
edge | |||
) |
Add a candidate edge to the graph Args: edge (EdgeInterRobot): inter-robot edge
Definition at line 163 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.add_fixed_edge | ( | self, | |
edge | |||
) |
Add an already computed edge to the graph Args: edge (EdgeInterRobot): inter-robot edge
Definition at line 152 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.add_match | ( | self, | |
match | |||
) |
Add match Args: match (EdgeInterRobot): potential match
Definition at line 559 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.candidate_edges_to_fixed | ( | self, | |
edges | |||
) |
Move candidate edges to fixed. Use when candidates are successfully converted into measurements Args: edges (list(EdgeInterRobot)): inter-robot edges
Definition at line 192 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.check_graph_disconnections | ( | self, | |
is_other_robot_considered | |||
) |
Check if the current graph of potential matches is connected Args: is_other_robot_considered: dict(int, bool): indicates which other robots are are to be included Returns: dict(int, bool): dict indicating if each robot is connected
Definition at line 391 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.check_initial_fixed_measurements_exists | ( | self, | |
is_robot_included | |||
) |
Check if we have an initial fixed measurement with each robot included If not, greedy selection should be used Args: is_robot_included dict(bool): indicates if each robot is included Returns: bool: check result
Definition at line 419 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.compute_offsets | ( | self, | |
is_robot_included | |||
) |
Compute rekey offsets Args: is_robot_included dict(int, bool): Indicates if the robot is connected and in communication range
Definition at line 291 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.connection_biased_greedy_selection | ( | self, | |
nb_candidates_to_choose, | |||
edges, | |||
is_robot_included | |||
) |
Greedy weight initialization with connection bias Prioritize edges that connect unconnected robots.
Definition at line 257 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.edge_key | ( | self, | |
edge | |||
) |
Get a unique key for an edge Args: edge (EdgeInterRobot): inter-robot edge Returns: tuple(int, int, int, int): unique key
Definition at line 76 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.fill_odometry | ( | self | ) |
Add odometry edges We can infer the odometry edges directly from the number of poses, without communication. Returns: list(Edge): odometry edges
Definition at line 348 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.get_included_edges | ( | self, | |
edges, | |||
is_robot_included | |||
) |
TODO
Definition at line 337 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.greedy_initialization | ( | self, | |
nb_candidates_to_choose, | |||
edges | |||
) |
Greedy weight initialization Args: nb_candidates_to_choose (int): number of edges to choose edges (list(Edge)): candidate_edges
Definition at line 205 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.pseudo_greedy_initialization | ( | self, | |
nb_candidates_to_choose, | |||
nb_random, | |||
edges | |||
) |
Greedy weight initialization Greedy initialization with for the first nb_candidates_to_choose-nb_random then random choice Args: nb_candidates_to_choose (int): number of edges to choose nb_random (int): number of edges to choose randomly edges (list(Edge)): candidate_edges
Definition at line 220 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.random_initialization | ( | self, | |
nb_candidates_to_choose, | |||
edges | |||
) |
Random weight initialization Args: nb_candidates_to_choose (int): number of edges to choose
Definition at line 247 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.recover_inter_robot_edges | ( | self, | |
edges, | |||
is_robot_included | |||
) |
Recover IDs from before rekey_edges() Args: edges (list(Edge)): rekeyed edges is_robot_included (dict(int, bool)): indicates if a robot is included Returns: list(EdgeInterRobot): edges
Definition at line 364 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.rekey_edges | ( | self, | |
edges, | |||
is_robot_included | |||
) |
Modify keys (nodes ID) from robot_id+keyframe_id to node_id Result example: 3 robots with 10 nodes eachs robot 0 nodes id = 1 to 9 robot 1 nodes id = 10 to 19 robot 2 nodes id = 20 to 29 Args: edges (dict(EdgeInterRobot)): inter-robot edges is_robot_included dict(int, bool): Indicates if the robot is connected and in communication range Returns: list(Edge): edges with keys for MAC problem
Definition at line 312 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.remove_candidate_edges | ( | self, | |
edges, | |||
failed = False |
|||
) |
Remove candidate edge from the graph Args: edges (list(EdgeInterRobot)): inter-robot edges
Definition at line 178 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.replace_weight | ( | self, | |
edge, | |||
weight | |||
) |
Replace the weight of an edge Args: edge (EdgeInterRobot): inter-robot edge weight (float): new weight Returns: EdgeInterRobot: new edge with new weight
Definition at line 92 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.run_mac_solver | ( | self, | |
fixed_edges, | |||
candidate_edges, | |||
w_init, | |||
nb_candidates_to_choose | |||
) |
Run the maximalization of algebraic connectivity Args: fixed_edges list(EdgeInterRobot): fixed edges candidate_edges list(EdgeInterRobot): candidate edges w_init (np.array): One-hot selection vector nb_candidates_to_choose (int): budger
Definition at line 436 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.select_candidates | ( | self, | |
nb_candidates_to_choose, | |||
is_other_robot_considered, | |||
greedy_initialization = True |
|||
) |
Solve algebraic connectivity maximization Args: nb_candidates_to_choose (int): number of candidates to choose, related to a computation/communication budget is_other_robot_considered: dict(int, bool): indicates which other robots are in communication range greedy_initialization: perform greedy initialization based on similarity Returns: list(EdgeInterRobot): selected edges
Definition at line 468 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.set_graph | ( | self, | |
fixed_edges, | |||
candidate_edges | |||
) |
Fill graph struct Args: fixed_edges (list(EdgeInterRobot)): edges that are already computed candidate_edges (list(EdgeInterRobot)): candidate edges to compute
Definition at line 132 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.sparsification_comparison_logs | ( | self, | |
rekeyed_candidate_edges, | |||
is_robot_included, | |||
greedy_result, | |||
mac_result | |||
) |
TODO: document
Definition at line 545 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.update_initial_fixed_edge_exists | ( | self, | |
fixed_edge | |||
) |
Maintains a bool for each neighbors to know if we have at least a known link. In cases where no initial fixed edge exists, we perform the greedy selection Args: fixed_edge (EdgeInterRobot): fixed edge in the graph
Definition at line 121 of file algebraic_connectivity_maximization.py.
def cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.update_nb_poses | ( | self, | |
edge | |||
) |
The number of poses should be the maximal edge id known Args: edge (EdgeInterRobot): loop closure edge
Definition at line 110 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.already_considered_matches |
Definition at line 59 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.candidate_edges |
Definition at line 58 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.fixed_edges |
Definition at line 57 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.fixed_weight |
Definition at line 54 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.initial_fixed_edge_exists |
Definition at line 67 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.log_greedy_edges |
Definition at line 73 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.log_mac_edges |
Definition at line 74 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.max_iters |
Definition at line 61 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.max_nb_robots |
Definition at line 63 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.nb_poses |
Definition at line 68 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.offsets |
Definition at line 300 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.params |
Definition at line 55 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.robot_id |
Definition at line 64 of file algebraic_connectivity_maximization.py.
cslam.algebraic_connectivity_maximization.AlgebraicConnectivityMaximization.total_nb_poses |
Definition at line 65 of file algebraic_connectivity_maximization.py.