Detect Camera Attached
-
If
voxl-camera-server
is up and running, you'll see a directory for the camera in/run/mpa/[camera name]
.Otherwise, I'd look in the source code for
voxl-configure-cameras
to see wha tit does for detection. -
@tom
/run/mpa
directories are setup byvoxl-camera-server
so it has to be configured and running first. And, I'm not sure it verifies the presence of the camera before setting up the MPA hierarchy. I could be wrong, I'm relatively new here. -
@SmittyHalibut That's correct, I made the assumption that voxl-camera-server was being used which could be wrong. There's also https://docs.modalai.com/voxl-uvc-server/
-
@tom Right, but that just handles the UVC cameras correct?
I am trying to detect the tracking, hi-res, and stereo cameras that are plugging directly into the J* ports on the board.
I wonder if I have to do something like attempt to read from them to see if they are there.I will keep looking in the source code
-
Hi all,
One of the features in the works for
voxl-camera-server
is a mode to only check the hal module directly for the available cameras. Since we're not sure exactly when we're going to be able to have this release up and this has been a very asked for feature, I'm going to extract that code real quick from our internal branch and publish a small executable that will list the cameras that are plugged into the mipi ports. I'll have a link for you if you give me 15-20 minutes. -
@Alex-Gardner Oh ok cool.
Thanks for doing that Alex. I was going to say, I know where that hal code lives. Just having you verify that for me is great help.
I can work on that code in the branch you post and make a pull request once i make some progress on it.Is there a TODO list left before release is acceptable?
-
The package (voxl-list-cameras) is live on our dev repo. you can manually download it from there or on voxl run:
voxl-configure-opkg dev
opkg update
opkg install voxl-list-cameras
There will be a command
voxl-list-cameras
that will list the available cameras and their resolutions from the hal module, and return the number of cameras connected. Additionally, since this is a temporary package that won't have a gitlab repo, the source for the executable is in /etc/modalai/voxl-list-cameras-src/ . This tool is pretty crude at the moment, the final design will filter out resolutions that aren't actually available/sort by format, but this is enough for you to tell which cameras are connected. I can tell you that in it's final form, this will be the behavior of runningvoxl-camera-server -l
orvoxl-camera-server --list
.As for the time frame/publicity of the other branch, it's hard to know, this feature was added as part of a major restructure of camera server for our rb5 platform that will be backported to voxl once proper behavior has been verified on both platforms. Until then, you can use this tool or make your own program that uses it (the entire source for the executable is around 100 lines of c even with comments/license, so if you want to make your own for whatever test bench you're using it shouldn't be too hard).
Lastly, I can give you a hint that if you're looking at the source and trying to filter different cameras, you can modify the source around the print loop:
printf("Available resolutions for camera: %d:\n", camId); for (size_t j = 0; j < entry.count; j+=4) { if (entry.data.i32[j + 3] == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) { printf("\t%d x %d\n", entry.data.i32[j+1], entry.data.i32[j+2]); } }
to also check
entry.data.i32[j]
which will be the format of that resolution (which is why you will see duplicates in the available resolutions, same resolutions in different formats). The main ones that you'll see areHAL_PIXEL_FORMAT_YCbCr_420_888
for YUV data,HAL_PIXEL_FORMAT_RAW10
for raw grayscale (note that some of our drivers actually output raw8 data not raw10, you can see the check for this in camera server), orHAL_PIXEL_FORMAT_BLOB
for data coming out of the PMD TOF sensor.Hope that's all a good starting point for what you're trying, let me know if you have any additional questions
-
@Alex-Gardner Thank you for that information!
I was able to easily get it installed and working. However, I am trying to modify the source code for it.
My question is: did you compile this on the VOXL board or through voxl-emulator/voxl-hexagon/etc...
I want to make sure my environment is the same. Thanks
-
Nevermind. Forgot docker does not save image state automatically and I had to reinstall dependencies.
I swear I fix these issue 5 minutes after I post things
-
@Alex-Gardner
I see why you created a separate tool for checking the connected cameras as the code in that tool is implemented in much lower level files on voxl-camera-server.
I did quickly put together a flag option that would list cameras if they are setup in /etc/modalai/voxl-camera-server.conf
I created a pull request here
Let me know if this is useful. If the needed feature requires all cameras to be listed let me know and I can see what I can do.
Also, I was trying to find a way to get some form of id off of the cameras, but I see in code that we compare the resolutions and that is how we distinguish a stereo from a tracking. Was trying to find some HAL3 data member that could give more of an "id". I found this
ANDROID_REQUEST_ID
variable in this documentation, but I could not get it working