Configure a Fake Movement Sensor

You can use the fake movement sensor model to test movement sensor code without connecting to any actual hardware.

The fake model supports all movement sensor methods: Accuracy, AngularVelocity, CompassHeading, LinearAcceleration, LinearVelocity, Orientation, Position, Properties, and Readings. Note that this model does not get any actual readings, so it supports these methods by returning placeholder data.

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

Creation of an `fake` movement sensor in the Viam app config builder.

Edit and fill in the attributes as applicable.

{
  "components": [
    {
      "name": <sensor_name>,
      "model": "fake",
      "type": "movement_sensor",
      "namespace": "rdk",
      "attributes": {},
      "depends_on": []
    }
  ]
}
{
  "components": [
    {
      "name": "myFakeSensor",
      "model": "fake",
      "type": "movement_sensor",
      "namespace": "rdk"
    }
  ]
}

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 position, orientation, angular velocity, linear 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.