Configure a Fake Camera

A fake camera is a camera model for testing. The camera always returns the same image, which is an image of a gradient. This camera also returns a point cloud.

You can optionally specify a height and width.

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 camera type, then select the fake model. Enter a name or use the suggested name for your camera and click Create.

Configuration of a fake camera in the Viam app config builder.

Edit the attributes as applicable to your camera, according to the table below.

{
  "name": "<your-camera-name>",
  "model": "fake",
  "type": "camera",
  "namespace": "rdk",
  "attributes": {
    "width": <int>,
    "height": <int>
  }
}

The following attributes are available for fake cameras:

NameTypeRequired?Description
widthintOptionalThe width of the image in pixels. The maximum width is 10000.
Default: 1280
heightintOptionalThe height of the image in pixels. The maximum height is 10000.
Default: 720
animatedboolOptionalIf you want the camera stream visible on the CONTROL tab to be animated.
Default: False

View the camera stream

Once your camera is configured, go to the CONTROL tab, and click on the camera’s dropdown menu. Then toggle the camera or the Point Cloud Data view to ON. You will see the live video feed from your camera. You can change the refresh frequency as needed to change bandwidth.

Fake Camera View

Troubleshooting

If your camera is not working as expected, follow these steps:

  1. Check your machine logs on the LOGS tab to check for errors.
  2. Review this camera model’s documentation to ensure you have configured all required attributes.
  3. Click on the TEST panel on the CONFIGURE or CONTROL tab and test if you can use the camera there.

If none of these steps work, reach out to us on the Community Discord and we will be happy to help.

Common errors

Failed to find the best driver that fits the constraints

When working with a camera component, depending on the camera, you may need to explicitly provide some camera-specific configuration parameters.

Solution: Check the specifications for your camera, and manually provide configuration parameters such as width and height to the camera component configuration page on the Viam app. On the CONFIGURE page, find your camera, then fill in your camera’s specific configuration either using the Show more button to show the relevant configuration options, or the {} (Switch to Advanced) button in the top right of the component panel to enter these attributes manually. Provide at least the width and height values to start.

Next steps

For more configuration and usage info, see:

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.