michaellee1019 / prusa-connect-camera-server

2 stars 0 forks source link

Error with the Component #1

Open ZevaKikel opened 5 months ago

ZevaKikel commented 5 months ago

Hi Michael! Thanks so much for sharing this! I think the idea is great, but unfortunately I haven't been able to make it work.

I've successfully created the machine in VIAM and I can see the video feed from the "CONTROL" tab without any problems. But after adding and configuring the component "michaellee1019:prusa-connect-camera-server" on my machine, the logs show the following error:

4/25/2024, 12:49:47 PM error robot_server.rdk:component:generic/MyCameraServer resource/graph_node.go:230 resource build error: unknown resource type: API "rdk:component:generic" with model "michaellee1019:prusa_connect:camera_server" not registered resource rdk:component:generic/MyCameraServermodel michaellee1019:prusa_connect:camera_server

I was trying to solve it, but I've reached the limit of my knowledge, so I'd love your help by checking my configuration to see if you can find the error:

{
  "components": [
    {
      "name": "PrusaMini",
      "namespace": "rdk",
      "type": "camera",
      "model": "webcam",
      "attributes": {}
    },
    {
      "name": "MyCameraServer",
      "namespace": "rdk",
      "type": "generic",
      "model": "michaellee1019:prusa_connect:camera_server",
      "attributes": {
        "cameras_config": {
          "PrusaMini": {
            "token": "*****MyPrusaConnectToken*****",
            "fingerprint": "usb-046d_Logitech_BRIO_75220247-video-index0"
          }
        }
      },
      "depends_on": [
        "PrusaMini"
      ]
    }
  ],
  "modules": [
    {
      "type": "registry",
      "name": "michaellee1019_prusa-connect-camera-server",
      "module_id": "michaellee1019:prusa-connect-camera-server",
      "version": "1.0.26"
    }
  ],

I'd be really grateful for your help!

Warm regards, Sebastian

michaellee1019 commented 5 months ago

Hi @ZevaKikel, I think the part of the logs you posted is probably a red herring, is that still happening if you look at recent logs?

I think your issue is likely that your webcam component is missing the video_path attribute. This is what tells Viam the source of the video stream is. You can use the Viam UI to automatically detect the available video paths and it should display the model of the camera you have connected. This is mine for example:

Screenshot 2024-04-25 at 11 01 40 AM

My resulting components section of the configuration is:

    {
      "name": "overhead_cam",
      "namespace": "rdk",
      "type": "camera",
      "model": "webcam",
      "attributes": {
        "video_path": "usb-0000:01:00.0-1.2"
      }
    },

You can leave the rest of the attributes as optional, size, framerate, etc are automatically detected (you can change these later to force a specific setting to be used).

michaellee1019 commented 5 months ago

Also to troubleshoot, use the control tab in the UI to make sure the camera stream loads. This can help determine the right video path if you have multiple options, and determine if there is a camera connection or driver issue.

Screenshot 2024-04-25 at 11 08 18 AM