Whats the method to get axis camera feed on smart dashboard, when the feed is on an ip address?
Easiest way is use CameraServer.addAxisCamera() on the robot side. Then it will appear in the list of cameras.
do we put the ip address in the parameters?
CameraServer.getInstance().addAxisCamera("10.5.5.10") or something like that.
How would i change this camera feed to a usb camera on the click of one button and make it revertible using the same button.
SmartDashboard’s camera viewer has a “Selected Camera Path” setting in properties. This is the NetworkTables key of a string to override the Camera Choice setting. So you can write code on your robot that reads the joystick and sets the NetworkTables value to the appropriate camera name.
The other way would be to switch it on the robot side similar to switching between two USB cameras (see http://wpilib.screenstepslive.com/s/currentCS/m/vision/l/708159-using-multiple-cameras).
I can confirm this approach works. You just need to create one AxisCamera and one UsbCamera, instead of both being of type UsbCamera like in the screensteps code.
You can also use HttpCamera, which took me forever to get working properly until I found Peter’s post about a bug in CameraServer and the workaround (thanks Peter):
CameraServer cs = CameraServer.getInstance(); HttpCamera frontIPCamera = new HttpCamera("frontIPcam", "http://10.31.3.11/mjpg/video.mjpg", HttpCameraKind.kMJPGStreamer); frontIPCamera.setConnectionStrategy(VideoSource.ConnectionStrategy.kKeepOpen); cs.startAutomaticCapture(frontIPCamera);
We have another IP camera setup we plan to use - I was just using an Axis for proof-of-concept.