Hidden RoboRIO CameraServer Endpoints

There does not seem to be any official list of web endpoints for the RoboRIO’s cameraserver. This is a problem because I am looking to change camera settings by uploading a json file through the webserver. The server allows the user to download a json settings file, so uploading seems logical. But I can’t find an endpoint or service for this.

Does anyone know how to do this?

Note: The server I am talking about is the one exposed on ports 1180-1190 (1181 for us) by wpilib’s cameraserver (cscore i think)

So far, all I know of is:

http://roborio-TEAM-frc.local:1181/

and

http://roborio-TEAM-frc.local:1181/stream.mjpg

Not that it’s a good excuse for lacking documentation… but read the source, Luke.

There is no http endpoint currently for sending that json file. It exists from the code API, but not an http API.

Ah. thank you. I know my way around wpilibc very well and couldn’t find the code. I never made the connection that cscore would be in the ccscore folder… Entirely my fault.

If i built my own server on the RIO that accepted a json file, then parsed and sent the data to the API, it should work fine then?

This code leads me to believe that the functionality I need is implemented. Am I wrong about it’s function?

else if (req.find("GET /config") != wpi::StringRef::npos &&
             req.find(".json") != wpi::StringRef::npos) {
    kind = kGetSourceConfig;
  } else if (req.find("GET /input") != wpi::StringRef::npos &&
             req.find(".json") != wpi::StringRef::npos) {
    kind = kGetSettings;

Both of those endpoints are GET. You would need a POST/PUT endpoint.

Also, keep in mind that the CameraServer stuff is something that you launch from your robot code, it’s not a separate process (except for Python). You may find it easier for your code to create the right objects and set the appropriate settings through those instead.

That’s the code that lets you get the json file, there is no code at present to POST it back. I’ll look at adding this functionality soon, or if you need it sooner, yes, you can write your own web server and call VideoSource.setConfigJson().

Note there are endpoints to set individual camera settings via HTTP, but not the entire JSON file.

I would be doing this the proper way normally, but we are using a coprocessor this year that will change camera settings over the network during sandstorm period because our drivers like being able to see. and various other strategic reasons.

Ok. Thanks. It looks like I should get started on my server then.

Note that if there’s just a handful of settings you want to change, you can change individual settings with HTTP GET request(s), and that functionality is present today (it’s how the interactive sliders work). e.g. /?action=command&setting1=value1&setting2=value2

1 Like

Im looking to change just about every setting at once. So this wouldn’t be the best approach for me.

You can change multiple settings in a single GET request, as long as the total length is less than about 4000 characters.

1 Like