Anyone successful with camera in RobotPy?

With either RobotPy 2011.2 or the latest source from the repository, I am having problems getting off square one with the camera. Just calling the GetInstance() method of AxisCamera silently reboots the cRIO.

Has anyone had success with this? I have the M1011 model camera, and the C++ 2010ImageDemo runs flawlessly. But the PyResult is nasty.

I’m really just looking here to set my expectations, for example, if someone has been successful then how does their setup differ from mine. But it is also helpful for me to know if noone else gets it either.

Well, OK… I’ll take that as a “No.”

We have the camera running with Python, although Peter had to add more of nivision to RobotPy so our code could run, and do more than simply display output to the driverstation. The only thing is NI Vision Assistant doesn’t export code in Python, which makes it a bit trickier.

Great, that’s good to hear, that you’ve gotten that far, too. We had been having trouble just doing GetInstance()!

In fact, about an hour ago, I think we discovered the problem we were having. To work with the M1011 in C++, we had had to make some small modifications to the Vision portion of WPILib. What I did not fully realize until today, was RobotPy has its own copy of the WPILib source, which of course was not patched. Once that was also patched, presto, success!

The feed to the driver station, and to some of the nivision code I had waiting, worked fine. Now on to tuning…

If you need more help with it, I can ask Peter directly. He has been very busy, so I doubt he will be on CD much in the near future.

I’m sure the wpilib maintainers would appreciate your patch http://firstforge.wpi.edu/sf/tracker/do/listArtifacts/projects.wpilib/tracker.wpilib_c_bugs

Yes, agreed; I just need to sift through the actual changes made while investigating the problem, and determine which are significant and which are not…

I have submitted artifact 1330 in the WPILib project in FIRST Forge (follow the link Joe Ross kindly gave to get there). The artifact includes a proposed fix to the relevant parts of WPILib, in the attachment. The proposed fix has been tested with the M1011 model camera in the 2010ImageDemo (the vision demo supplied with the C++ environment) and also in RobotPy (based on the latest code in the repository, but it should also work in 2011.2).

Have you also tested it with the Axis 206 camera that many teams have? We would prefer not to break the other camera to make the new one work. :wink:

Thanks,
-Joe

We have not tested with the Axis 206. We don’t have one. Hopefully, “someone” out there with one can pick up this change, and try it? Otherwise, I have a [somewhat lower-priority] item on my To-Do list, to try to locate “borrow”] one for comparison testing… Sorry this answer isn’t more helpful.

Hey guys, how do you replace the .cpp files in Windriver (the patch that is on FirstForge)?

Realize, please, that what you ask for is complicated, so please do not attempt this if you are not confident of the steps involved. Ask for help if you need it. <Insert strong disclaimers here>

This is probably all written somewhere semi-officially; I looked for such a reference with no success (surprising!) Anywhere, here goes…

Obtain the source for WPILib: This should be nothing more than un-zipping the WPILib<blahblah>rev2259.zip found in the C:/WindRiver/WPILib folder.

Import the WPILib project into Workbench: In Workbench, File -> Import… -> Existing Projects into Workspace (under General) -> Next -> Select “Select Root Directory” -> Browse… to where you un-zipped the source and click OK. “WPILib” should show up in the Projects box, make sure it is checked. You can also uncheck “Copy projects into workspace” if you want to build WPILib where you un-zipped it, or check this to copy it all into your WindRiver workspace tree. Click Finish.

The build process automatically calls a Subversion program to embed the software version into the compiled code. If you don’t use Subversion, you’ll need to modify the build process in one place: Right-click on your new WPILib project in the Project Explorer, and select Properties -> Build Properties -> the Build Tools tab -> select Build Tool: -> C++ Compiler, and in the Command: window, modify the part of the command that reads -D’SVN_REV=“$(shell svnversion -n …)”’ so that the part inside the double quotes is a version string you want to see when your robot boots up. Then click Apply and OK to close the Properties dialog.

Build WPILib.a: Right-click on the WPILib project, and select Rebuild Project… -> Go take a break, and when you come back look in the file folder PPC603gnu\WPILib\Debug under your WPILib project. There should be a WPILib.a there. This is the library you want to link your robot code to. The original, official WPILib.a resides in WindRiver\vxworks-6.3 arget\lib, and this is where your robot code project expects to find WPILib by default. If you replace the official WPILib.a, you want to do so in a careful, calculated, reasoned, and fully backed up manner.

Notice we have not changed WPILib yet, we merely built the official release ourselves. Link your robot code against your library, and prove that it works as well as the official version. Trust me, do not hurry this step.

Once you have established a working baseline WPILib, now proceed to attempt modifications. Get the .zip you mentioned from FIRST Forge, unzip the three files there into their corresponding places in your WPILib source tree. Repeat the “Build WPILib.a” step from above.

Link this new modified library with your robot code, and see if the camera is working better now. Make sure everything else you need works too. Report any problems back here and on the FIRST Forge artifact, thanks.

Thank you for such an in depth reply.

Just one thing I had doubts about was the -D’SVN_REV=“$(shell svnversion -n …)”’ part. Could you clarify this a little bit. Where exactly do I put anything and what should I put ? Thank you for your help once again, I really appreciate it.

By default, robot projects look to link against WPILib.a in the directory I gave under “Build WPILib.a”. If you replace the standard WPILib.a installed there with yours, all your robot projects [the next time you link them] will begin to use your new library. BUT SAVE THE OLD LIBRARY FIRST! And label it, put it somewhere safe, for later when something goes wrong with your robot code and you want to rule out that the problem is in your version of the library.

Alright I got it working, and the camera works great now. I’m very pleased and thank you for your great instructions on building a custom WPILibrary. That should be documented. Thanks a lot once again!

Glad to hear it helped!

Can I ask, which model of camera are you using: the 206 or M1011?

For anyone interested in the Axis 206, I have run a quick test using the modified WPILib routines mentioned above, with a borrowed 206 model camera, and the live video stream to the FRC Dashboard works, and changing the camera params also works.

Please let me know if you encounter any problems.

2 Questions.

  1. My team just wants video feed from the camera back to the driver station.

Can I do this without the default RobotPy or do I have to apply all of the fixes discussed in this thread and build from source?

  1. I’m not sure which camera we have. I recognize it from the picture in the KoP list, but the description says:

“Camera, Axis M1011
206 color camera…”

So, is it the M1011 or the 206?

  1. The picture in the KOP list is of the M1011.

  2. If you just want video back to the driver station, there is a new option this year of plugging the camera directly into the network bridge on the robot (bypassing the cRIO). I understand this requires Dashboard changes, and the camera config is a little different. There are threads here on CD about that, though I can’t help more than that, since we are not pursuing that solution.

If you follow the ‘traditional’ solution, plugging the camera in the cRIO, and doing the vision.AxisCamera.GetInstance() to start the video feed to the Dashboard, I will tell you that we had problems doing even that much with the M1011 in either C++ or any version of RobotPy. Quite a few times the feed would work, many times it would not, and we could never change the camera parameters through the software. But the patch fixed all that.

You can apply the proposed patch mentioned in this thread to either RobotPy 2011.2 or the latest RobotPy from the git repository, and though you will have to ‘build it yourself’, I believe the result will be a more reliable and configurable video feed.

If you follow the ‘traditional’ solution, plugging the camera in the cRIO, and doing the vision.AxisCamera.GetInstance() to start the video feed to the Dashboard, I will tell you that we had problems doing even that much with the M1011 in either C++ or any version of RobotPy. Quite a few times the feed would work, many times it would not, and we could never change the camera parameters through the software. But the patch fixed all that.

You can apply the proposed patch mentioned in this thread to either RobotPy 2011.2 or the latest RobotPy from the git repository, and though you will have to ‘build it yourself’, I believe the result will be a more reliable and configurable video feed.

Hmmm I read the whole thread and tried a bit with our robot but I can’t get it done. I did exactly what you are saying up here.

Can maybe anybody briefly explain the steps that we have to do to get our camera running? Its an Axis 206 camera.