|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Has anyone run OpenCV in a separate WPILLib Task / Thread on the RoboRIO?
Quote:
![]() |
|
#2
|
||||
|
||||
|
Yeah, you are ok to use it! We are still refining the vision code for detecting totes though so you should redo that part if you can do it better. For compiling and linking, this is a lengthy process. We used just plain OpenCV2. We followed team 2168's linking instructions which are a bit vague so I will try and explain.
1. Download our OpenCV project from our github here. And move the project somewhere safe (we have C:\OpenCV_frc\arm\include\OpenCV\opencv2) 2. Then I assume you have an existing project for C++ (im not sure if this differs from java) go open eclipse and right click on your project go to Properties->C/C++ Build->Settings. Then go to the tool settings tab and click on Cross G++ Linker and add -rpath,C:\OpenCV_frc\arm\libs\opencv (what ever your directory is). Also make sure you have a comma in between entries. 3. Then go to C/C++ general and go to paths and symbols. Click on the library paths tab and hit add. Add the directory from your file system and type in C:\OpenCV_frc\arm\libs\opencv (what ever your directory was) hit apply. 4. Then go to the Libraries tab and add opencv_core,opencv_highgui,opencv_imgproc from C:\OpenCV_frc\arm\libs\opencv (whatever your directory is) 5.Now hit apply and add the cpp and h files in a folder in your project. we have our called Vision2015. Then add the necessary includes and and using namespace cv; 6. You should be able to compile and run the robot. You might want to see how to run the code on a separate task though because it will slow down drive code if running in a separate task. Our actual robot project in robot.cpp shows how to do that. Please feel free to reply if you have any questions. Also, if you improve the tote detector in any way, contact us. Have a fun time!, Drew (2053 Programmer) Last edited by jreneew2 : 12-02-2015 at 20:26. |
|
#3
|
||||
|
||||
|
Re: Has anyone run OpenCV in a separate WPILLib Task / Thread on the RoboRIO?
Quote:
Did you get the tracking working on the RoboRio? Last I saw everything was a tote. I am assuming you got it working because Jason had it working on the laptop and this should of been a straight up port. I ask because when I saw it earlier yesterday it was running in the separate thread OK it just wasn't tracking right yet. |
|
#4
|
||||
|
||||
|
Re: Has anyone run OpenCV in a separate WPILLib Task / Thread on the RoboRIO?
Yeah, it was working when you were video conferencing with us. We just have to refine the colors.
|
|
#5
|
||||
|
||||
|
Re: Has anyone run OpenCV in a separate WPILLib Task / Thread on the RoboRIO?
If you update wpilib c++ robot development, be sure to go into wpilib.h and comment out #define REAL
|
|
#6
|
|||
|
|||
|
Re: Has anyone run OpenCV in a separate WPILLib Task / Thread on the RoboRIO?
Quote:
Thanks for the great instructions! However, every time I setup a project (including importing yours and fixing the paths to opencv) I get like 175 errors in opencv2/core/core.hpp. I had the same problem when I tried earlier in the season to get opencv in the project. Any idea why I would get so many errors? Sound like something to do with the index, but I've rebuilt in many times. Edit: followed PaulDavis1968's suggestion to comment out that line in WPILIB. No idea what that does, but it fixed it! Last edited by FleventyFive : 13-02-2015 at 22:36. |
|
#7
|
||||
|
||||
|
Re: Has anyone run OpenCV in a separate WPILLib Task / Thread on the RoboRIO?
Yeah, we found that out the hard way. After searching forever through OpenCV and wpilib we found that REAL is defined in both wpilib and OpenCV. Good luck with auto!
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|