|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Help with two USB Cameras on the Dashboard.
The attached picture is a modified version of WPI_CameraSendImages To PC Loop. If you have the VI, put it in with the rest of your code -- perhaps next to RobotMain. Then drag it to the project window so that it is listed there.
In the Vision Processing VI, comment out or delete the Background block and call the new VI instead by dragging it from the project to the Vision Processing diagram. Post again if that doesn't work. Greg McKaskle |
|
#2
|
|||
|
|||
|
Re: Help with two USB Cameras on the Dashboard.
If lab view is the same as Java/c++, you are going to have trouble. The camera server (routines) are only designed for 1 camera.
If your second camera is an ip camera, you can open a browser window and get the image directly. There may be a way to access a sub camera directly, but I have no idea how |
|
#3
|
|||
|
|||
|
Re: Help with two USB Cameras on the Dashboard.
The code that the student attached is the video server.
The default one in WPILib serves one camera, the one posted opens sessions to two USB cameras and serves images from one of them. To further modify it to interleave the images on one port or to open a second port is just a bit more code. So teams are given the source to the video server and it is theirs to expand provided they don't bypass the bandwidth limits. Greg McKaskle |
|
#4
|
||||
|
||||
|
Re: Help with two USB Cameras on the Dashboard.
Thank you,
For posting your responses, Mr. McKaskle when you say "In the Vision Processing VI, comment out or delete the Background block and call the new VI instead by dragging it from the project to the Vision Processing diagram." What do you mean? Thank you again both of you for responding to the thread. Once we fully make this program functional we will post back, and vise versa if the program does not work. |
|
#5
|
||||
|
||||
|
Re: Help with two USB Cameras on the Dashboard.
Okay,
So we put the program into place and we found that there is too much data so the driverstation is shutting down the flow of information to the other camera feed or it doesn't show it at all and then the cycle continues, it goes from 9E-5 Mbps to 0 Mbps then to 8E-5 Mbps. So here is the program showing all of the case structures and their sub-cases. If there are any problems please help us. Thank you, Lorenzo Guerra and Team 4063 Programming |
|
#6
|
|||
|
|||
|
Re: Help with two USB Cameras on the Dashboard.
Thanks for asking. Here is what I meant.
The attached image shows the part of the Vision Processing block diagram that calls the Background block -- actually it is called the WPI_CameraBackground Loop.vi. That VI does two background tasks: 1.) For Axis cameras, it reads images as soon as they are available and keeps the last one so that the user code will always be reading the most recent image. 2.) For USB cameras, it serves the images to the dashboard on TCP port 1180. You have your own image server, and you don't care about the Axis stuff, so you can delete or comment out the Background block and wire up the one you are using that serves two cameras. The code shown in your attached images looks pretty good, but the compression is basically off. I'll explain more in a sec. With two cameras at 5fps, that is the same as one camera at 10fps with very little compression. From the image, I can't tell what the image size is, so I think the first thing to do is add compression and shrink the image size and test it again. The server you are using has a T wired to the OpenAndSetMode. This means that the camera itself is doing the compression, and that we have no control on how much to compress. If you set the image size smaller and maybe the fps a to four, I think this will work. Another approach is to change from camera compressed images to roboRIO compressed images. This involves two edits. The T constant that is wired to the Set Video Mode VI needs to be changed to a false. Next, drop the attached snippet of code somewhere on the edge of your VI. Surround it with the comment block to make it a comment. Notice that one frame of the snippet case structure, the -1 case, looks just like the code you have in your server. It gets the Raw Image Data from the camera and sends it to the dashboard. The other case, the Default one, gets the image and sends that image to the "Flatten Image to String" function telling it to make a JPEG with a compression number that ranges from 0 to 1000. The default camera server supports both camera compressed and roboRIO compressed, and it uses a compression number of -1 to select camera compressed, and all other numbers mean roboRIO compressed. So if you want to, you can swap out the code in your server with the stuff from the commented snippet. Post the result if you want a review of it. Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|