GRIP icon indicating copy to clipboard operation
GRIP copied to clipboard

C++ Code generation issues

Open kauailabs opened this issue 7 years ago • 0 comments
trafficstars

  1. Missing Header Files

It's unclear what the best practices are for header files is. Currently, the VMX-RTK build script is using these files:

https://raw.githubusercontent.com/wpilibsuite/allwpilib/master/wpilibj/src/main/java/edu/wpi/first/wpilibj/vision/VisionPipeline.java https://raw.githubusercontent.com/wpilibsuite/allwpilib/master/wpilibc/src/main/native/include/vision/VisionPipeline.h

Are these the correct matching header files for use with the C++ (and Java) examples?

Recommendation: either generate these files as part of the GRIP code generation, or generate a readme that indicates where they matching header files are located.

  1. Mismatch between function signatures (process() method) in the GRIP-generated C++ code and the header files (assumed to be correct) mentioned above.

The header file (see above) has a method named:

	void Process(cv::Mat& source0);

But the Grip-generated had:

	void process(cv::Mat& source0); 

So to work around it we had to modify the GRIP-generated .h and .cpp files.

  1. The VMX-RTK uses OpenCV 3. The generated GripPipeline.h file references a opencv2 header file no longer used in opencv3. Recommendation: Remove inclusion of this file from generated C++ Grip Pipeline.

//#include <opencv2/contrib/contrib.hpp> /* This is no longer present in open cv 3*/

  1. GripPipeline.h missing a few (private) things in order to compile:

These lines needed to be added to GripPipelin.h to get it to compile.

	cv::Mat source0; 
	void setsource0(cv::Mat &source0);

For reference, the vmx-rtk-examples for frc/c++ demonstrates how the pipeline is being integrated into a C++ vision example. The GRIP-generated files are in the pipeline sub-directory.

https://github.com/kauailabs/vmx-rtk-examples/tree/master/coprocessor/frc/cpp/full_processing

** FINAL THOUGHTS **

My recommendation is to create unit tests that will (for C++ and Java):

  • Acquire the necessary matching headers
  • Build the pipeline to ensure no compile issues
  • Run the pipeline and pump one frame through it

kauailabs avatar Jan 08 '18 20:01 kauailabs