Australia
Asked

Camera Device Index Error Resolution

I'm trying to use the Camera Device Index to automatically start the correct camera when connecting my robot. Currently, I perform this task manually because my robot is using the read-only version of ARC.

When I execute the command ControlCommand("Camera Device", "CameraStart", 3) to start the fourth device on the list, I encounter the following error message:

"Error for 'Camera' sending 'CameraStart'. InvalidArgument=Value of '3' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex"

What I find confusing is that if I manually set the camera to the third device on the list and then run the code, it works without any issues.

Could you provide guidance on how to resolve this problem?


Related Hardware EZ-B v4
Related Control Camera Device

ARC Pro

Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

PRO
Canada
#1  

Hi - I’m Athena. Thanks for the clear description. The error you’re seeing means the Camera Device skill is rejecting the SelectedIndex value you passed. Below are focused troubleshooting steps, a few likely causes, and short code examples you can try.

Useful docs

Quick checklist (most common fixes)

  1. Verify zero-based indexing

    • The Camera Device SelectedIndex is zero-based. The "fourth" device is index 3 - that part you already used correctly, but double-check the number of devices listed. If there are only 3 devices available, index 3 is invalid.
  2. Make sure the Camera Device skill is stopped before changing index

    • Some camera commands require the skill to be stopped first. Try stopping the skill, then set/start the index.
  3. Confirm the exact robot skill name

    • ControlCommand requires the skill name exactly as it appears in your project. If you renamed the Camera Device window, use that exact name.
  4. Check the Camera Device supported ControlCommands / parameter types

    • Open the Camera Device skill, edit a script block, then rightclick (or open the Cheat Sheet) to see the accepted ControlCommand entries and parameter types. This will show you whether CameraStart expects a number, string, or different command name.

Step-by-step to try now

  1. Stop the camera, then start with index 3 (JavaScript example):
// replace "Camera Device" with the exact skill name if you renamed it
controlCommand("Camera Device", "Stop");
sleep(500);
controlCommand("Camera Device", "CameraStart", 3);
print("Sent CameraStart(3)");
  1. If the CameraStart still errors, open the Camera Device Cheat Sheet:

    • Open the Camera Device skill window Edit script Right-click in the editor view ControlCommand list.
    • Confirm the exact CameraStart signature (parameter name/type). If it expects a different command (for example "SelectedIndex" or a device name string) use that.
  2. Alternative: select device by name (if supported)

    • Some camera implementations accept a device name instead of an index. If the Cheat Sheet shows a command like CameraStartByName or a SetDevice command, use the visible device name from the Camera Device dropdown. Example (pseudo):
controlCommand("Camera Device", "CameraStartByName", "Logitech C920");
  • Check the Cheat Sheet to get the exact parameter name.
  1. If you are using a read-only ARC account
    • Read-only mode can change which settings you can modify programmatically. If the Camera Device list or selected index is locked, you may need to set the device manually in the Camera Device configuration (kebab menu) or run the script after you manually stop the camera and confirm the device list is available.

How to get me the exact detail I need to help further

  • Open the Camera Device skill Edit script Right-click paste the Camera Device ControlCommand list (or screenshot) here.
  • Tell me exactly what the Camera Device window title is (if you renamed it), how many cameras are in the dropdown, and whether ARC is in readonly mode.

If you paste the cheat-sheet output or the camera skill exact name + how many devices are listed, I’ll give the exact ControlCommand line that will work reliably in your project and a small startup script you can add to your project.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.