# nodeState

Get or set node state in factor graph

## Syntax

``state = nodeState(graph,nodeID)``
``nodeState(graph,nodeID,newState)``

## Description

````state = nodeState(graph,nodeID)` returns the state of the node with the specified ID `nodeID` in the specified `factorGraph` object `graph`.```
````nodeState(graph,nodeID,newState)` sets the state of the node with the specified ID `nodeID` in the specified `factorGraph` object `graph` to the specified state `newState`.```

## Input Arguments

collapse all

Factor graph, specified as a `factorGraph` object.

ID of the node to get or set, specified as a nonnegative integer.

New node state, specified as an N-element row vector, where N is the number of state elements in the specified node.

These are the supported node types and the form of their corresponding states:

• `POSE_SE2` — Pose in SE(2) state space in the form [x y theta]. x, and y are the x and y positions, respectively, and theta is the orientation.

• `POSE_SE3` — Pose in SE(3) state space in the form [x y z qw qx qy qz]. x, y, and z are the x, y, and z positions, respectively, and qw, qx, qy, and qz represent the orientation as a quaternion.

• `VEL3` — 3-D velocity in the form [vx vy vz]. vx, vy, and vz are the x, y, and z velocities, respectively.

• `POINT_XY` — 2-D point in the form [x y]. x, and y are the x and y positions, respectively.

• `POINT_XYZ` — 3-D point in the form [x y z]. x, y, and z are the x, y, and z positions, respectively.

• `IMU_BIAS` — IMU gyroscope and accelerometer bias in the form [bias_gyro_x bias_gyro_y bias_gyro_z bias_accel_x bias_accel_y bias_accel_z], where:

• bias_gyro_x, bias_gyro_y, and bias_gyro_z are the x, y, and z IMU gyroscope biases, respectively.

• bias_accel_x, bias_accel_y, and bias_accel_z] are the x, y, and z accelerometer biases, respectively.

## Output Arguments

collapse all

State of the state, returned as an N-element row vector, where N is the number of state elements in the specified node.

These are the supported node types and the form of their corresponding states:

• `POSE_SE2` — Pose in SE(2) state space in the form [x y theta]. x, and y are the x and y positions, respectively, and theta is the orientation.

• `POSE_SE3` — Pose in SE(3) state space in the form [x y z qw qx qy qz]. x, y, and z are the x, y, and z positions, respectively, and qw, qx, qy, and qz represent the orientation as a quaternion.

• `VEL3` — 3-D velocity in the form [vx vy vz]. vx, vy, and vz are the x, y, and z velocities, respectively.

• `POINT_XY` — 2-D point in the form [x y]. x, and y are the x and y positions, respectively.

• `POINT_XYZ` — 3-D point in the form [x y z]. x, y, and z are the x, y, and z positions, respectively.

• `IMU_BIAS` — IMU gyroscope and accelerometer bias in the form [bias_gyro_x bias_gyro_y bias_gyro_z bias_accel_x bias_accel_y bias_accel_z], where:

• bias_gyro_x, bias_gyro_y, and bias_gyro_z are the x, y, and z IMU gyroscope biases, respectively.

• bias_accel_x, bias_accel_y, and bias_accel_z] are the x, y, and z accelerometer biases, respectively.

## Version History

Introduced in R2022a