I’m having some trouble compiling code with WPILib under Linux. I’m using the Wine mcc-wrappers and the IFI Makefile/configure script (modified to link against wpilib).
In general, compiling with the 2005 libraries works fine. However, when I complied against the 2006 libraries, the linker complained that there were multiple definitions of Set_Number_of_Analog_Channels. Sure enough, I inspected the libraries with a hex editor, that function was defined in each. However, I “fixed” it by changing the name of the function in WPILib2k6.lib. Yes, I know that’s terrible, but my code would compile after that.
Now, when I try to use CMUcam functions, like InitializeCamera, the linker complains that the symbol numberOfCameraInitBlocks cannot be found in CMUCam2.o.
Does anyone here (Brad Miller in particular) know what’s going on?
You are correct on all counts… There are actually 2 problems, neither related to the linux environment.
The Set_Number_of_Analog_Channels can be fixed by changing the library order in the linker. The symbol is redefined in WPILib and it’s a conflict between the IFI libraries and WPILib. Just reorder the two libraries.
The numberOfCameraInitBlocks is normally generated by easyC. The way it handles the camera is to create an array of structures, each one containing the camera initialization parameters for a set of tracking values (color, saturation, etc.). You need to add the following code to your program to get it to track the FIRST green target lights:
// camera initialization array - would normally be generated by EasyC
unsigned char numberOfCameraInitBlocks = 1;
CameraInitializationData cameraData] =
{
{ 85,115,15,17,100,145,0,1,0,1,0,0,128,128,128,1,16,8,5,30,15,5 }};
Then to use the camera do this:
InitCamera(1);
StartCamera();
That will initialize it using the set of parameters supplied (see API.h for the meaning - it’s an initializer for a CameraInitializationData struct.)
And hopefully that will take care of the two problems that you described. If not, feel free to ask more questions.