Configure a WitMotion IMU

An inertial measurement unit (IMU) provides data for the AngularVelocity, Orientation, CompassHeading, and LinearAcceleration methods. Acceleration and magnetometer data are available by using the sensor GetReadings method, which IMUs wrap.

The imu-wit movement sensor model supports the following IMUs manufactured by WitMotion:

Navigate to the Config tab of your robot’s page in the Viam app. Click on the Components subtab and navigate to the Create component menu. Enter a name for your movement sensor, select the movement-sensor type, and select the imu-wit model.

Click Create Component.

Creation of an imu-wit movement sensor in the Viam app config builder.

Edit and fill in the attributes as applicable.

{
  "components": [
    {
      "name": "<your-sensor-name>",
      "type": "movement_sensor",
      "model": "imu-wit",
      "attributes": {
        "serial_path": "<your-port>",
        "serial_baud_rate": <int>
      },
      "depends_on": []
    }
  ]
}
{
  "components": [
    {
      "name": "myIMU",
      "type": "movement_sensor",
      "model": "imu-wit",
      "attributes": {
        "serial_path": "/dev/serial/by-path/<device_ID>",
        "serial_baud_rate": 115200
      },
      "depends_on": []
    }
  ]
}

Attributes

NameTypeInclusionDescription
serial_pathstringRequiredThe name of the port through which the sensor communicates with the computer.
serial_baud_rateintOptionalThe rate at which data is sent from the sensor, between 9600 and 115200. The default rate will work for all models. Only the HWT901B can have a different serial baud rate. Refer to your model’s data sheet.
Default: 115200


Have questions, or want to meet other people working on robots? Join our Community Discord.