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 navigate to the Create component menu. Enter a name for your movement sensor, select the movement-sensor type, and select the fake model.

Click Create Component.

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

Edit and fill in the attributes as applicable.

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


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