Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   URL for MjpegServer from CameraServer/USB Camera (http://www.chiefdelphi.com/forums/showthread.php?t=154059)

dmelcer9 21-01-2017 17:11

URL for MjpegServer from CameraServer/USB Camera
 
I'm looking to use a USB camera connected to the robot for GRIP development. I know that GRIP doesn't accept the dashboard stream, but the MJPG stream supposedly works. However, I can't figure out what URL to point GRIP to if I want to actually use the stream.

Currently, our code looks something like this (forgot to commit to github so don't have the exact code):

Code:

//Robot.java -> RobotInit

UsbCamera c = CameraServer.getInstance().startAutomaticCapture();
MjpegServer s = CameraServer.getInstance().addServer("gripStream");
s.setSource(c);

What URL would I point the "Add IP Camera" source to in GRIP to get the camera to work properly?

Thad House 22-01-2017 00:07

Re: URL for MjpegServer from CameraServer/USB Camera
 
Quote:

Originally Posted by dmelcer9 (Post 1634552)
I'm looking to use a USB camera connected to the robot for GRIP development. I know that GRIP doesn't accept the dashboard stream, but the MJPG stream supposedly works. However, I can't figure out what URL to point GRIP to if I want to actually use the stream.

Currently, our code looks something like this (forgot to commit to github so don't have the exact code):

Code:

//Robot.java -> RobotInit

UsbCamera c = CameraServer.getInstance().startAutomaticCapture();
MjpegServer s = CameraServer.getInstance().addServer("gripStream");
s.setSource(c);

What URL would I point the "Add IP Camera" source to in GRIP to get the camera to work properly?

You actually don't need that MjpegServer definition or the setSource line. startAutomaticCapture will automatically create the stream.

The way to access the code from GRIP would be
Code:

http://roborio-TEAM-frc.local:1181/?action=stream

dmelcer9 22-01-2017 00:18

Re: URL for MjpegServer from CameraServer/USB Camera
 
Really? Thank you! I'm guessing any additional streams (for example if we have 2 cameras) would use port 1182? I saw some sort of reference to using the next available port.

Thad House 22-01-2017 01:38

Re: URL for MjpegServer from CameraServer/USB Camera
 
Quote:

Originally Posted by dmelcer9 (Post 1634700)
Really? Thank you! I'm guessing any additional streams (for example if we have 2 cameras) would use port 1182? I saw some sort of reference to using the next available port.

Yeah any additional cameras will just increase the port number, so cam 2 will use 1182, cam 3 will use 1183 etc...

dmelcer9 24-01-2017 22:01

Re: URL for MjpegServer from CameraServer/USB Camera
 
Thanks! Didn't get a chance to test until today (building was closed for bad weather) but it worked really nicely. One (hopefully) last question: is there any way to increase the resolution of the mjpg stream? Currently GRIP shows the stream as a tiny thumbnail which is workable but a little annoying.

Thad House 24-01-2017 22:39

Re: URL for MjpegServer from CameraServer/USB Camera
 
Quote:

Originally Posted by dmelcer9 (Post 1635933)
Thanks! Didn't get a chance to test until today (building was closed for bad weather) but it worked really nicely. One (hopefully) last question: is there any way to increase the resolution of the mjpg stream? Currently GRIP shows the stream as a tiny thumbnail which is workable but a little annoying.

When you call startAutomaticCapture, it will return a UsbCamera object. Call setResolution on that object, and that will set the resolution to whatever you put in.

dmelcer9 24-01-2017 22:41

Re: URL for MjpegServer from CameraServer/USB Camera
 
Thanks! Didn't know that the USBCamera object affected the stream like that. Good to know.

ryan.mitchell 25-01-2017 07:40

Re: URL for MjpegServer from CameraServer/USB Camera
 
What would the mjpegserver be if I am accessing the camera from a raspberry pi? Currently I am just typing raspberrypi.local:1185 into a browser to see the camera image but I would like to get it to appear on my smartdashboard.

ryan.mitchell 25-01-2017 08:29

Re: URL for MjpegServer from CameraServer/USB Camera
 
Quote:

Originally Posted by ryan.mitchell (Post 1636031)
What would the mjpegserver be if I am accessing the camera from a raspberry pi? Currently I am just typing raspberrypi.local:1185 into a browser to see the camera image but I would like to get it to appear on my smartdashboard.

Oh wait...it should be the same thing just port 1185, I'll give that a go and relay how it goes.

thecoopster20 01-02-2017 21:50

Re: URL for MjpegServer from CameraServer/USB Camera
 
Quote:

Originally Posted by ryan.mitchell (Post 1636044)
Oh wait...it should be the same thing just port 1185, I'll give that a go and relay how it goes.

Any success? I am on the same boat as you are currently.

MuskieProgramme 01-02-2017 22:34

Re: URL for MjpegServer from CameraServer/USB Camera
 
I would also like to know how to get the camera stream from the raspberry pi on the dashboard. Even better would be an unmodified Labview Dashboard, as nobody on my team is interested in using the other options. I'm fairly certain it is possible with the right things published to network tables, but who knows...

ryan.mitchell 01-02-2017 23:12

Re: URL for MjpegServer from CameraServer/USB Camera
 
Quote:

Originally Posted by thecoopster20 (Post 1639297)
Any success? I am on the same boat as you are currently.

Well, I'm upset...I hit submit post and it just went *poof*...anyway a rundown of my current situation is that it didn't work however I an idea that I just thought of which I will test tomorrow (and paste my code). I believe I have just been making a stupid mistake. As for MuskieProgrammes question, I would use the SmartDashboard definitely because I believe LabView can only handle Usbcameras, could be wrong though. Also, network tables can only publish/get variables (again, 99% positive).

Ryan

MuskieProgramme 02-02-2017 09:15

Re: URL for MjpegServer from CameraServer/USB Camera
 
Yes, the actual stream can't be over network tables. But if you start reading the CameraServer class you find it is publishing certain information to NetworkTables... I believe the LabView dashboard uses this information to provide the camera drop-downs. It looks like all of CameraServer's dependencies are available on the Pi so I'm going to try to deploy it there and see what happens.


All times are GMT -5. The time now is 15:27.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi