graphslam.vertex module

A Vertex class.

class graphslam.vertex.Vertex(vertex_id, pose, fixed=False)[source]

Bases: object

A class for representing a vertex in Graph SLAM.

Parameters:
  • vertex_id (int) – The vertex’s unique ID

  • pose (graphslam.pose.base_pose.BasePose) – The pose associated with the vertex

  • fixed (bool) – Whether this vertex should be fixed

gradient_index

The index of the first entry in the gradient vector to which this vertex corresponds (and similarly for the Hessian matrix)

Type:

int, None

id

The vertex’s unique ID

Type:

int

pose

The pose associated with the vertex

Type:

graphslam.pose.base_pose.BasePose

fixed

Whether this vertex should be fixed

Type:

bool

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

Check whether two vertices are equal.

Parameters:
  • other (Vertex) – The vertex to which we are comparing

  • tol (float) – The tolerance

Returns:

Whether the two vertices are equal

Return type:

bool

classmethod from_g2o(line)[source]

Load a vertex from a line in a .g2o file.

Parameters:

line (str) – The line from the .g2o file

Returns:

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

Return type:

Vertex, None

plot(color='r', marker='o', markersize=3)[source]

Plot the vertex.

Parameters:
  • color (str) – The color that will be used to plot the vertex

  • marker (str) – The marker that will be used to plot the vertex

  • markersize (int) – The size of the plotted vertex

to_g2o()[source]

Export the vertex to the .g2o format.

Returns:

The vertex in .g2o format

Return type:

str