Has anybody converted the 2010 Image Demo from the SimpleRobot class to the IterativeRobot class? How did you define the camera so it’s not local to only the function it’s defined in and therefore lost between iterations? The AxisCamera class seems to work differently from all the other WPILib classes.
I think I have an answer to my own question if anyone is interested. The line
AxisCamera &camera = AxisCamera::getInstance
can be put into a function and called repeatedly. The first time it’s called it creates a pointer to the camera object and starts the camera app. After that it just returns the same pointer. Seems to works okay.
Declare a pointer in your IterativeRobot class:
AxisCamera * camera;
Then in your IterativeRobot constructor call:
camera = &(AxisCamera::GetInstance());
Use the dereference arrow -> instead of periods when calling camera methods.
Code above is from memory, so it may not work if you cut/paste, but hopefully it will help!