graphslam.edge.edge_odometry module

A class for odometry edges.

class graphslam.edge.edge_odometry.EdgeOdometry(vertex_ids, information, estimate, vertices=None)[source]

Bases: BaseEdge

A class for representing odometry 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\)

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

estimate

The expected measurement \(\mathbf{z}_j\)

Type:

BasePose

information

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

Type:

np.ndarray

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 = \mathbf{z}_j - (p_2 \ominus p_1)\]
Returns:

The error for the edge

Return type:

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]

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 an odometry edge

Return type:

EdgeOdometry, None

is_valid()[source]

Check that the edge is valid.

Returns:

Whether the edge is valid

Return type:

bool

plot(color='b')[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