Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Python (http://www.chiefdelphi.com/forums/forumdisplay.php?f=187)
-   -   Anyone successful with camera in RobotPy? (http://www.chiefdelphi.com/forums/showthread.php?t=90687)

BotnEyedJoe 02-01-2011 12:13 PM

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.

BotnEyedJoe 02-03-2011 11:50 AM

Re: Anyone successful with camera in RobotPy?
 
Well, OK... I'll take that as a "No."

CastleBravo 02-03-2011 09:28 PM

Re: Anyone successful with camera in RobotPy?
 
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.

BotnEyedJoe 02-03-2011 11:41 PM

Re: Anyone successful with camera in RobotPy?
 
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...

CastleBravo 02-04-2011 12:50 AM

Re: Anyone successful with camera in RobotPy?
 
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.

Joe Ross 02-04-2011 09:24 AM

Re: Anyone successful with camera in RobotPy?
 
Quote:

Originally Posted by BotnEyedJoe (Post 1015330)
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!

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

BotnEyedJoe 02-04-2011 12:50 PM

Re: Anyone successful with camera in RobotPy?
 
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...

BotnEyedJoe 02-06-2011 11:19 PM

Re: Anyone successful with camera in RobotPy?
 
Quote:

Originally Posted by Joe Ross (Post 1015441)
I'm sure the wpilib maintainers would appreciate your patch http://firstforge.wpi.edu/sf/tracker....wpilib_c_bugs

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).

jhersh 02-08-2011 04:09 AM

Re: Anyone successful with camera in RobotPy?
 
Quote:

Originally Posted by BotnEyedJoe (Post 1017331)
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. ;)

Thanks,
-Joe

BotnEyedJoe 02-08-2011 11:29 AM

Re: Anyone successful with camera in RobotPy?
 
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.

newkidd-sagar 02-09-2011 05:59 PM

Re: Anyone successful with camera in RobotPy?
 
Hey guys, how do you replace the .cpp files in Windriver (the patch that is on FirstForge)?

BotnEyedJoe 02-09-2011 09:06 PM

Re: Anyone successful with camera in RobotPy?
 
Quote:

Originally Posted by newkidd-sagar (Post 1019392)
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\target\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.

newkidd-sagar 02-10-2011 02:54 PM

Re: Anyone successful with camera in RobotPy?
 
Quote:

Originally Posted by BotnEyedJoe (Post 1019518)
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\target\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.

BotnEyedJoe 02-10-2011 05:39 PM

Re: Anyone successful with camera in RobotPy?
 
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.

newkidd-sagar 02-10-2011 07:11 PM

Re: Anyone successful with camera in RobotPy?
 
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!


All times are GMT -5. The time now is 03:49 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi