factorGraph
Description
A factorGraph
object stores a bipartite graph consisting of
factors connected to variable nodes. The nodes represent the unknown random variables in an
estimation problem, such as robot poses, and the factors represent probabilistic constraints
on those nodes, derived from measurements or prior knowledge. During optimization, the factor
graph uses all the factors and current node states to update the node states.
For more information about factor graph and how to use it, see Factor Graph for SLAM.
Creation
Syntax
Description
creates an empty
fg
= factorGraphfactorGraph
object.
Properties
Object Functions
Examples
More About
Tips
To specify multiple factors and nodes at once for a specific factor type, use the
generateNodeID
function and specify the number of factors and the factor type. See thegenerateNodeID
function for more details.poseIDPairs = generateNodeID(fg,3,"factorTwoPoseSE2"); ftpse2 = factorTwoPoseSE2(poseIDPairs);
You can get the states of all the pose nodes by first using the
nodeIDs
function and specifying the node type as"POSE_SE2"
for SE(2) robot poses and"POSE_SE3"
for SE(3) robot poses. Then, use thenodeState
function with those node IDs to get the node states of the robot pose nodes.poseIDs = nodeIDs(fg,NodeType="POSE_SE2"); poseStates = nodeState(fg,poseIDs);
Check the types of nodes that each factor creates or connects to before adding factors to the factor graph to avoid node type mismatch errors. For a list of expected node types for each factor, see Expected Node Types of Factor Objects.
References
[1] Dellaert, Frank. Factor graphs and GTSAM: A Hands-On Introduction. Georgia: Georgia Tech, September, 2012.