-
Notifications
You must be signed in to change notification settings - Fork 3
[BACKEND] Add comprehensive camera detection, configuration and live streaming #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[BACKEND] Add comprehensive camera detection, configuration and live streaming #3
Conversation
|
Hi @DavidLMS |
|
Oh! I just saw it. This is bad luck, because I have all the other commits made yesterday. I’ll try to fix it. |
|
Hey @nicolas-rabault I noticed we're both working on camera functionality at the same time and wanted to reach out to coordinate and avoid conflicts. I saw your commit 28117e4 that adds basic camera detection with /available-cameras, and also PR #4 for phone cameras with WebRTC. My PR does more comprehensive local camera detection (OpenCV + RealSense), persistent configuration, HTTP streaming, etc. The thing is we have some functional overlap - we both implement OpenCV camera detection, just in different ways. And also conflicts in main.py since we're both adding endpoints in similar areas of the file. But I think our work is actually complementary:
What do you think about coordinating the merge? We could:
Would you prefer your PR #4 goes first and I adapt mine? I'm happy to modify whatever's needed to make them work well together. What do you think? |
|
Hi @nicolas-rabault! I just rebased onto main to include the missing "Working cameras configuration" commit and enhanced the existing Changes made:
The endpoint now provides both backward compatibility and advanced features like live streaming, configuration persistence, and robust camera detection. Have a look! I think you'll like it |
|
Hey @DavidLMS, |
|
ok @nicolas-rabault, just this morning I tried to check your PR, but it was giving me problems. I won't be able to test with SO-101 robot until Monday either (and I'm afraid next week will be the last week I'll have access to it until September). But I'll try to make it work. I think I've got the management of the cameras that are connected to the PC to be good. I understand your idea in the PR would be to be able to add any external cameras that are not connected directly to the PC. I can try to integrate it within the same management system, although my knowledge of WebRTC is limited, I will give it a try. I would like, if you can, to merge my PR, to start from it with what you have done in your PR. Because if I do it from mine, I won't be able to reuse your work easily. Thanks for all! |
|
Make sense, |
|
Great! If you can, that would be great. I think you'll like it. If you have a mac and have ever used an iPhone with camera continuity and it's nearby, it detects it and sets it as one of the available cameras automatically. As well as virtual cameras in applications, e.g. OBS Studio. Remember to give permission in the terminal where you run Space to access the camera. |
|
@DavidLMS I tested you PRs with a robot and I didn't manage to add the robot one.
|
|
Oh my bad. I´m sorry! That's strange, it worked quite well for me. Maybe it's the operating system? It uses the same detection script as LeRobot. I need some clarification to fix it:
I have nothing to compare it to because there were no cameras in the version I started with. Only four frames were ready for reception, but none were operational.
I don´t know why. In my case, it detected up to four cameras (the robot camera, the laptop camera, the iPhone camera, and the virtual OBS Studio camera).
Which exactly? Perhaps we should start making screen recordings, because I think we are not seeing the same versions. I will make one on Monday, to see if we can figure out what is happening. Thank you very much for the feedback! |
|
I'm using mac OS.
You can find the camera compatible version I made on the Hugging face space if you want to.
Let's continue on Discord it will be easier to chat... and go back here when thing are sorrted out. |
Problem Solved
Changes Made
~/.cache/huggingface/lerobot/camera_configs/Related PRs
New Files
app/camera_detection.py- Complete camera detection and configuration modulefind_opencv_cameras()- Direct OpenCV detectionfind_realsense_cameras()- Intel RealSense detection with fallbackscapture_image_from_camera()- Preview image capturecreate_camera_config_for_lerobot()- LeRobot-compatible config generationAPI Endpoints Added
Enhanced Files
app/main.py- Added all camera endpoints and streaming logicapp/config.py- Added camera configuration persistence functionssave_camera_config()- Save camera configurationsget_saved_camera_config()- Load saved camera configurationsupdate_camera_in_config()- Update specific camera settingsremove_camera_from_config()- Remove camera from configurationBackward Compatibility
Dependencies