but this year it does not work. Whenever this camera code is put onto our robot, nothing happens, and the drive does not work either. it totally kills the code.
Also, make sure there is an account on the camera with a username of “FRC” and a password of “FRC” (without quotations for each). Apparently you couldn’t have a feed without that account last year as well. I just found out, and now we have a working feed. Time for bed now.
make sure the camera is connected.
if the camera is not connected it causes the system to crash.
I ran into this every time i removed the camera from the system.
as was said before, get the Axis Cam utility and add an admin username: FRC pass: FRC.
Also, note that when you call “getInstance” of the AxisCamera, it initializes and returns a class the first time you do this. If you don’t capture this class in a variable and keep it “alive” during the whole of your robot’s run, it will get garbage collected and the thread it creates to relay information will be killed.
This is not true. AxisCamera.getInstance() will create a new instance of the AxisCamera class and return it the first time it is called. Any time after that, it returns the one instance that it already created. There is no destructor that kills the camera thread, and a reference to the singleton AxisCamera instance is always stored within the AxisCamera class in AxisCamera.m_instance. A call to AxisCamera.getInstance() will always return this instance.
public class AxisCamera implements ISensor{
private static AxisCamera m_instance = null;
...
public static synchronized AxisCamera getInstance() {
if (m_instance == null) {
m_instance = new AxisCamera();
}
return m_instance;
}
The constructor calls the AxisCameraStart function that is part of the C++ library. That function starts up the PCVideoServer. Even if there was destruction of the AxisCamera object, it would not signal this thread to stop.
Don’t try to adjust any camera settings from your code. Do all of your setting adjustments by going to the camera’s webpage by connecting directly to it with your computer. The reason I say this, is because from my experience this year WPI Lib’s camera parameters code is broken and crashes if you try to adjust any parameters.
In other words, try using just one line of code for streaming images from the camera:
AxisCamera camera = AxisCamera.getInstance();
we’ve only had success this year with streaming images from the new camera by doing this.