Configure a WitMotion HWT905-TTL IMU

An inertial measurement unit (IMU) provides data for the AngularVelocity, Orientation, CompassHeading, LinearAcceleration, and GetAccuracy methods. To get all the raw sensor data, you can use the sensor GetReadings method, which movement sensors inherit from the general sensor API.

The imu-wit-hwt905 movement sensor model supports the HWT905-TTL IMU manufactured by WitMotion.

Navigate to the CONFIGURE tab of your machine’s page in the Viam app. Click the + icon next to your machine part in the left-hand menu and select Component. Select the movement-sensor type, then select the imu-wit-hwt905 model. Enter a name or use the suggested name for your movement sensor and click Create.

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

Then fill in the attributes as applicable to your movement sensor, according to the table below.

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

The "serial_path" filepath used in this example is specific to serial devices connected to Linux systems. The "serial_path" filepath on a macOS system might resemble "/dev/ttyUSB0" or "/dev/ttyS0".

Attributes

NameTypeInclusionDescription
serial_pathstringRequiredThe full filesystem path to the serial device, starting with /dev/. To find your serial device path, first connect the serial device to your machine, then:
  • On Linux, run ls /dev/serial/by-path/* to show connected serial devices, or look for your device in the output of sudo dmesg | grep tty. Example: "/dev/serial/by-path/usb-0:1.1:1.0".
  • On macOS, run ls /dev/tty* | grep -i usb to show connected USB serial devices, ls /dev/tty* to browse all devices, or look for your device in the output of sudo dmesg | grep tty. Example: "/dev/ttyS0".
serial_baud_rateintOptionalThe rate at which data is sent from the sensor over the serial connection. Valid rates are 9600 and 115200.
Default: 115200

Test the movement sensor

After you configure your movement sensor, navigate to the CONTROL tab and select the dedicated movement sensor dropdown panel. This panel presents the data collected by the movement sensor. The sections in the panel include the orientation, angular velocity and linear acceleration.

The movement sensor component in the control tab

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

If you notice any issues with the documentation, feel free to file an issue or edit this file.