graphslam.edge.edge_landmark module

A class for landmark edges.

class graphslam.edge.edge_landmark.EdgeLandmark(vertex_ids, information, estimate, offset, offset_id=None, vertices=None)[source]

Bases: BaseEdge

A class for representing landmark edges in Graph SLAM.

Parameters:
  • vertex_ids (list[int]) – The IDs of all vertices constrained by this edge

  • information (np.ndarray) – The information matrix \(\Omega_j\) associated with the edge

  • estimate (BasePose) – The expected measurement \(\mathbf{z}_j\); this should be the same type as self.vertices[1].pose

  • offset (BasePose, None) – The offset that is applied to the first pose; this should be the same type as self.vertices[0].pose

  • offset_id (int, None) – The ID of the offset; this is only used for writing to .g2o format

  • vertices (list[graphslam.vertex.Vertex], None) – A list of the vertices constrained by the edge

estimate

The expected measurement \(\mathbf{z}_j\); this should be the same type as self.vertices[1].pose

Type:

BasePose

information

The information matrix \(\Omega_j\) associated with the edge

Type:

np.ndarray

offset

The offset that is applied to the first pose; this should be the same type as self.vertices[0].pose

Type:

BasePose, None

offset_id

The ID of the offset; this is only used for writing to .g2o format

Type:

int, None

vertex_ids

The IDs of all vertices constrained by this edge

Type:

list[int]

vertices

A list of the vertices constrained by the edge

Type:

list[graphslam.vertex.Vertex], None

_abc_impl = <_abc._abc_data object>
calc_error()[source]

Calculate the error for the edge: \(\mathbf{e}_j \in \mathbb{R}^\bullet\).

\[\mathbf{e}_j =((p_1 \oplus p_{\text{offset}})^{-1} \oplus p_2) - \mathbf{z}_j\]

\(SE(2)\) landmark edges in g2o

\(SE(3)\) landmark edges in g2o

returns:

The error for the edge

rtype:

np.ndarray

calc_jacobians()[source]

Calculate the Jacobian of the edge’s error with respect to each constrained pose.

\[\frac{\partial}{\partial \Delta \mathbf{x}^k} \left[ \mathbf{e}_j(\mathbf{x}^k \boxplus \Delta \mathbf{x}^k) \right]\]
Returns:

The Jacobian matrices for the edge with respect to each constrained pose

Return type:

list[np.ndarray]

equals(other, tol=1e-06)[source]

Check whether two edges are equal.

Parameters:
  • other (BaseEdge) – The edge to which we are comparing

  • tol (float) – The tolerance

Returns:

Whether the two edges are equal

Return type:

bool

classmethod from_g2o(line, g2o_params_or_none=None)[source]

Load an edge from a line in a .g2o file.

Parameters:
  • line (str) – The line from the .g2o file

  • g2o_params_or_none (dict, None) – A dictionary where the values are graphslam.g2o_parameters.BaseG2OParameters objects, or None if there are no such parameters

Returns:

The instantiated edge object, or None if line does not correspond to a landmark edge

Return type:

EdgeLandmark, None

is_valid()[source]

Check that the edge is valid.

Returns:

Whether the edge is valid

Return type:

bool

plot(color='g')[source]

Plot the edge.

Parameters:

color (str) – The color that will be used to plot the edge

to_g2o()[source]

Export the edge to the .g2o format.

Returns:

The edge in .g2o format

Return type:

str