Main Content

nodeType

Get node type of node in factor graph

Since R2022a

Description

Factor Graph

type = nodeType(fg,nodeID) returns the type of the nodes with the specified node IDs in the factor graph.

example

Multi-Node Factors (e.g. factorTwoPoseSE3)

type = nodeType(factor,nodeID) returns the type of the node with the specified node ID that the specified factor connects to.

Use this syntax for these factors:

example

Single-Node Factors (e.g. factorPoseSE3Prior)

type = nodeType(factor) returns the type of the node that the specified factor connects to.

Use this syntax for these factors:

example

Examples

collapse all

Create factor graph, and generate node IDs one factorPoseSE2AndPointXY factor. Then create the factorPoseSE2AndPointXY factor and add the factor to the factor graph.

fg = factorGraph;
ids = generateNodeID(fg,1,"factorPoseSE2AndPointXY")
ids = 1×2

     0     1

f = factorPoseSE2AndPointXY(ids);
addFactor(fg,f);

Get the types of node 0 and node 1.

nodeType(fg,0)
ans = 
"POSE_SE2"
nodeType(fg,1)
ans = 
"POINT_XY"

Generate node IDs to create one factorPoseSE2AndPointXY factor and then create the factorPoseSE2AndPointXY factor.

f = factorPoseSE2AndPointXY([0 1]);

Get the types of node 0 and node 1.

nodeType(f,0)
ans = 
"POSE_SE2"
nodeType(f,1)
ans = 
"POINT_XY"

Create a SE(3) prior pose factor that connects to node ID 1.

f = factorPoseSE3Prior(1);

Get the type of the node that the factor connects to.

nodeType(f)
ans = 
"POSE_SE3"

Input Arguments

collapse all

Factor graph, specified as a factorGraph object.

IDs of nodes to check, specified as a nonnegative integer or an N-element row or column vector of nonnegative integers. N is the total number of nodes to check. The size and shape of nodeID depends on the syntax you use to get the type of node. This table describes the two situations.

SyntaxnodeID
type = nodeType(factor,nodeID)

Nonnegative integer

type = nodeType(fg,nodeID)

N-element row or column vector of nonnegative integers

Output Arguments

collapse all

Type of the nodes, returned as a string scalar or a cell array of character vectors, where each string scalar or cell of character vector is one of these node types:

  • "POSE_SE2" — Pose in SE(2) state space

  • "POSE_SE3" — Pose in SE(3) state space

  • "POSE_SE3_SCALE" — Pose scale in SE(3) state space

  • "TRANSFORM_SE3" — Sensor transform in SE(3) state space

  • "GRAVITY_ROTATION" — Gravity rotation represented as a quaternion

  • "POINT_XY" — 2-D point

  • "POINT_XYZ" — 3-D point

  • "IMU_BIAS" — IMU gyroscope and accelerometer bias

  • "VEL3" — 3-D velocity

The output type depends on the syntax you use to get the type of node. This table describes the two situations.

Syntaxtype
type = nodeType(factor,nodeID)

String scalar

type = nodeType(fg,nodeID)

Cell array of character vectors

Extended Capabilities

expand all

Version History

Introduced in R2022a

expand all