greengrass component cannot open camera

0

Hi. I deployed the components of Greengrass v2 to Raspberry Pi. The artifact of my recipe contains the face recognition inference code in the S3 bucket. So I created and deployed the components. The Raspberry pi status is normal, and the components are deployed successfully. But I have an error. In my inference code, there is a task to open and execute the camera connected to the Raspberry Pi4. But it can't open the camera when I deployed it as a component. What should I do? When I run the code on Raspberry Pi4, it runs well, but when I deploy it as a component, it doesn't. Help me!!! The camera connected to my Raspberry pi4 is intel realsense F450

Thank you. Please help me

<This is my component's log> 2022-10-24T14:57:40.205Z [INFO] (pool-2-thread-28) com.example.jamesML: shell-runner-start. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=STARTING, command=["cd /home/pi&&. pracvenv/bin/activate&&cd james_ml&&python3 practice.py"]} 2022-10-24T14:58:11.981Z [WARN] (Copier) com.example.jamesML: stderr. /home/pi/pracvenv/lib/python3.7/site-packages/h5py/init.py:40: UserWarning: h5py is running against HDF5 1.10.6 when it was built against 1.10.4, this may cause problems. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:11.982Z [WARN] (Copier) com.example.jamesML: stderr. '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple). {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:11.982Z [WARN] (Copier) com.example.jamesML: stderr. WARNING:tensorflow:No training configuration found in the save file, so the model was not compiled. Compile it manually.. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:11.998Z [WARN] (Copier) com.example.jamesML: stderr. [ WARN:0@15.489] global /tmp/pip-wheel-8c7uejek/opencv-python_88dbbad412c5416b992ae69de26299d6/opencv/modules/videoio/src/cap_v4l.cpp (902) open VIDEOIO(V4L2:/dev/video0): can't open camera by index. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:12.005Z [INFO] (Copier) com.example.jamesML: stdout. Could not open webcam. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:13.240Z [INFO] (Copier) com.example.jamesML: Run script exited. {exitCode=0, serviceName=com.example.jamesML, currentState=RUNNING}

<and this is my recipe> { "RecipeFormatVersion": "2020-01-25", "ComponentName": "com.example.jamesML", "ComponentVersion": "1.0.19", "ComponentType": "aws.greengrass.generic", "ComponentDescription": "Capstone Design james machine learning.", "ComponentPublisher": "Me", "ComponentConfiguration": { "DefaultConfiguration": { "accessControl": { "aws.greengrass.ipc.mqttproxy": { "com.example.jamesML:mqttproxy:1": { "policyDescription": "Allows access to publish via topic ml/dlr/image-classification.", "operations": [ "aws.greengrass#PublishToIoTCore" ], "resources": [ "ml/dlr/image-classification" ] } } } } }, "Manifests": [ { "Platform": { "os": "linux", "architecture": "arm" }, "Lifecycle": { "install": { "Script": "" }, "run": { "script": "cd /home/pi&&. pracvenv/bin/activate&&cd james_ml&&python3 practice.py" } }, "Artifacts": [ { "Uri": "s3://greengrass-sagemaker-0930/james_ml.zip", "Digest": "Bc8JmqcuVXamFOuXHeEGMoNovRTgwo9sJQEcsgpqoDo=", "Algorithm": "SHA-256", "Unarchive": "ZIP", "Permission": { "Read": "OWNER", "Execute": "NONE" } } ] } ], "Lifecycle": {} }
1 Answer
0
Accepted Answer

Hi hyorim.

When I run the code on Raspberry Pi4, it runs well, but when I deploy it as a component, it doesn't.

When running as a component, it will run as a different user, most commonly ggc_user. Please check whether ggc_user is in the video group (groups ggc_user) and add it if it isn't.

profile pictureAWS
EXPERT
Greg_B
answered a year ago
profile picture
EXPERT
reviewed 7 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions