![]() |
WPILib and Eclipse
I was trying to get WPILib working with Eclipse. Following the instructions here, I installed mingw, c18 compiler, CDT, and the two plugins. However, I can't find the right option to create the project, and am stuck there. What am I doing wrong?
Thanks. |
Re: WPILib and Eclipse
You must first make sure you copied the two plugins from the .zip file downloaded from the WPILib page into the Eclipse "plugins" directory and restarted Eclipse so they are registered. Note: you must extract the plugin .jar files from the .zip file provided on the WPILib page.
To create a new project:
You will also have to follow the instructions on the WPILib page concerning search and include paths, as well as the linker file and library order. These can all be checked/adjusted in the Project Properties dialog. (Right-click on the project object in the left-hand "Project Explorer" pane and select "Properties"). HTH. If you have more specific questions beyond that, please post again. |
Re: WPILib and Eclipse
Thanks. It works now. I guess I either misssed the option before, or had to relocate the plugins to make it work. Unless it fails to complie or anything like that, I think it should work now.
How exactly do I compile? I found the myriad of options under Project, but I have no idea where they built file goes when I either Build All or define a Make Target. Any idea? |
Re: WPILib and Eclipse
Now you're getting more into the specifics of how Eclipse works, and that's pretty well documented (including steps and examples) in the Eclipse "C/C++ Development User Guide". I recommend you check it out.
Your WPILib project will work just like any other Eclipse C/C++ project; just trust the plugins to create the project for you and make all the right property settings. If you create a project and just add a simple WPILib example file, it should compile and link with no changes required to the Project properties. After you compile and link, the generated objects and .hex file will be placed in a subdirectory under your project directory, and will be named based on the toolchain that you chose to use (e.g. mine is called "vEx WPILib Robot"). This allows you to use the same project directory and source files for multiple projects (e.g. a Vex project and an FRC project can use the same code; they just need to be compiled and linked differently). You'll still need to use either the IFI Loader or the one that comes with EasyC to move the .hex file to the robot. Note that you can use the Loader that comes with EasyC (and take advantage of its graphics terminal capability) without actually having an EasyC license on your machine. Just use the graphics terminal routines available in WPILib. HTH. |
Re: WPILib and Eclipse
Thanks again for your help. I'm almost getting there. I had to mess around with the path variable and eclipse settings a bit, but I got forward. Right now though, I'm getting another error I haven't been able to figure out by myself:
**** Build of configuration vEx WPILib Robot for project test **** mingw32-make 'Building target: test.hex' 'Invoking: MPLINK Linker' mplink "..\18F8520.lkr" /a INHX32 /w /m FRCMapfile.map /o"test.hex" ./main.o /l"C:\mcc18\lib" ..\Vex_library.lib ..\WPILibVex.lib MPLINK 4.12, Linker Copyright (c) 2007 Microchip Technology Inc. Error - Could not find linker command file '..\18F8520.lkr'. Errors : 1 mingw32-make: *** [test.hex] Error 1 I have no idea how to tell it where said linker file is, and I have four files on my machined named "18F8520.lkr": one in the MPLAB\LKR folder, one in the MCC18 folder, and two others in WPILib folders - one in the \2k5 and another in the \Vex. Although there's no one in the \2k6, and I'm using a pretty new installation of mcc18. Could this be a problem? How do I solve this issue? Thanks again for your help. |
Re: WPILib and Eclipse
Oh yeah... I forgot that the project wizard plug-in assumes that your project directory is a subdirectory of one of the toolchain directories under WPILib: \2k5, \2k6, or \Vex. That's why it's looking for "..\18f8520.lkr".
For a Vex project, you want to use the .lkr file in the \Vex directory. To get your project to look for it in the right place, go to: - Project Properties dialog - Left hand tree: C/C++ Build -> Settings - Tool settings tab - Left hand tree: MPLink Linker -> Linker Information - Specify your Linker file pathspec in the top list box - You can also add library search paths in the second box, and don't miss the "Libraries included in Linking" list box at the bottom (you may have to scroll to see it). HTH. |
Re: WPILib and Eclipse
It's not really working either. The only way it works as of now is if I have my source files in the WPILIB\Vex folder, and by works I mean this generates a different error. Now, the error is something with the ifi_libraries.o being out of date. I'm pretty sure this is happening because I am usign the mcc18, rather than the older one. I guess I'll have to find one of our CD's with mcc18 v2.4.
|
Re: WPILib and Eclipse
Yes - you definitely need to have the 2.40 version of mcc18. Newer versions are incompatible with the IFI-provided libraries (plus they cost real money after the trial period ;)
I think if you poke around in the Eclipse project properties box, you'll eventually figure out how and where to put things. I'm still trying to figure out the best organization for my team (FRC, using Vex for prototyping), so maybe when I settle that I'll try to post my findings (and project files) here. |
Re: WPILib and Eclipse
Still no luck. I got my hands on a copy of the c18 compiler, and now tried to build it, and now I'm getting a new error:
**** Build of configuration vEx WPILib Robot for project Vex **** mingw32-make all 'Building target: Vex.hex' 'Invoking: MPLINK Linker' mplink "..\18F8520.lkr" /a INHX32 /w /m FRCMapfile.map /o"Vex.hex" ./main.o /l"C:\mcc18\lib" ..\Vex_library.lib ..\WPILibVex.lib MPLINK 3.90, Linker Copyright (c) 2004 Microchip Technology Inc. Error - Coff file '././main.o' does not appear to be a valid COFF file. Errors : 1 mingw32-make: *** [Vex.hex] Error 1 main.c is my source file. Could this imply a problem with my code? Or what am I looking at? |
Re: WPILib and Eclipse
I'm not sure if this is the solution, but try changing the link order of the Vex_library.lib and WPILibVex.lib - I think you have them backwards.
|
Re: WPILib and Eclipse
Error - Coff file '././main.o' does not appear to be a valid COFF file.
That last COFF file error might be that the program is being compiled with the new microchip compiler rather than the 2.4 (I think) compiler that comes with the kit. The object file formats are incompatible. |
Re: WPILib and Eclipse
Mr. K, I'll try that. If that doesn't work, I might restart the process on another computer, and see if I can get it to work there. Unless I get a different error message.
Bard, I would be surprised if that's it. I removed mcc18 v3.0, completley deleted the folder, and installed v2.4 from the cd that comes in the kit. Any other ideas? |
Re: WPILib and Eclipse
"I removed mcc18 v3.0, completley deleted the folder, and installed v2.4 from the cd that comes in the kit. Any other ideas?"
Make sure you do a "clean" build, i.e. delete all the old object files (.o) from your project as well. If any are hanging around from when you used the newer compiler, they will cause problems. |
Re: WPILib and Eclipse
It worksssss! Doing a clean build from eclipse didn't fix it. However, going and manually erasing the old object files did the trick. Now I can start programming!
|
Re: WPILib and Eclipse
And now I'm running into trouble again. I am having a hard time using user input (from the Vex OI right now, though I will be moving to working with FRC control systems soon) to do anything.
I've tried the OIToPWM, but I don't understand what the function variable is. I kinda get the rest. I've also tried the Tank2 command, but couldn't get that to work either. Any ideas? Obviously I've read the WPILib documentation, but that wasn't too useful with the basic things. |
Re: WPILib and Eclipse
You shouldn't need to use the OIToPWM( ) function right off the bat. I haven't used it myself, but now that I look at it, I'd like to know the meaning of the "function" parameters too.
The "composite operator interface" functions (e.g. Tank2( )), also have some idiosyncrasies that you may need to just experiment with to discover. Put the robot up on blocks and watch what the wheels do when you use the various commands. In my case, I also found that the Tank2( ) function wanted the left motor "inverted", but your case may be different. I suggest playing with those parameters to see what works for you. Another thing I found is that the Tank and Arcade functions define the motor positions as if you were looking from the back of the robot, whereas the "builtin" drive functions (i.e. those defined in "BuiltIns.h", such as TwoWheelDrive() and Motors()) define the motor positions as if you were looking from the front of the robot. So if you combine the usage of these functions in your code, you have to be careful how you specify the motor positions, especially if you are using defined constants. I'm starting to accumulate quite a list of annotations to my copy of the WPILib document. If Brad is listening, maybe someone should think about a WPILib documentation Wiki or something like that where we could post corrections and clarifications to the doc as we find them. |
Re: WPILib and Eclipse
Tank2 works! Thanks for your help.
However, now I'm trying to use interrupt watchers to mess around with a one of the bump switches. I have it hooked up to interrupt port one, called StartInterruptWatcher(1,RISING_EDGE) (also tried FALLING_EDGE), and I can't ever get the Interrupt to go off. I doubt it's a bad swithc, as we tried a few and none worked. Any ideas? Also, how do I grab pwm values directly from the OI? Eventually I'd like to do more advanced stuff that I can't accomplish by just using the Tank2 function. I also doubt OIToPWM would work, as I need the actualy pwm value. How would I do that? Thanks. |
Re: WPILib and Eclipse
I haven't tried using the Interrupt Watchers yet - I've got bumper switches working on my vExbot just by calling GetDigitalInput( ) inside my main program loop. Yes, it's possible that I'll miss the "press" event, but I've actually got very little code running in the loop right now, and besides, I'm just using the switches to determine if I've driven into a wall, so the "press" is fairly certain to be longer than a program loop cycle. Perhaps Brad can chime in here on the "gotchas" for Interrupt Watchers?
As for your second question, I think you mean you want to get the "joystick" values from the OI, and use those to set the PWMs, correct? Here you would use another "undocumented" function - GetRxInput(port, channel), which returns a value between 0 and 255. You can then map that directly to the PWM of your choice using SetPWM( ). (There's also a GetPWM() function, but it's only available on the vEx, and I'm not quite sure what you would use it for anyway?) Note also these additional "undocumented" functions available for reading values from the OI: unsigned char GetOIDInput(unsigned char port, unsigned char channel); unsigned char GetOIAInput(unsigned char port, unsigned char channel); (where, if it's not obvious, "D" = digital, "A" = analog). |
Re: WPILib and Eclipse
Ahh. Thanks you very much. The GetDigitalInput() should work, and I'm not sure how I missed it. I went through the two included header files to look for something. And the GetDigitalInput is much more appropriate to a bumper switch than an interrupt.
Yeah, I meant joystick values. I guess I was really tired last night :/ Thanks, I'll definitely use those functions. It seems to me there's a need to extend the current documentation available. While I'm currently still learning the system, myself and the other programmers on our team working with me would love to help if we ever get a wiki online. Additionally, we'll probably be writing a file to handle PID loops soon. We'd be happy to share it if you're interested in it. |
Re: WPILib and Eclipse
im getting an error in Eclipse when i try to build my project. i don't understand the error. can someone try to explain what is going wrong?
here is the error. **** Build of configuration vEx WPILib Robot for project Dog **** (Exec error:Launching failed) thx for your help |
Re: WPILib and Eclipse
sumadin -
Yes, please let us know when you get a good PID routine working. We're going to be tackling the same thing in the next few weeks. There is all kinds of talk about using PID all over CD, but a real lack of good programming examples. NSolarz - You haven't given us much to go on, but it sounds like your search path is set up incorrectly, and it's not finding the compiler and/or linker. Make sure you've followed *all* the instructions on the WPILib web site for setting up the Eclipse plugins and the mcc18 compiler. |
Re: WPILib and Eclipse
We have the logic written out, pretty much the same as we had it on last year's FRC robot, but we haven't tested it yet. So far, we've been waiting for a few sensors (gyro, ultrasonic rangefinder) to arrive in the mail, so we've been implementing some auxillary functions and structures from last year's robot.
|
Re: WPILib and Eclipse
New issues: I've now been trying to convert code from Vex to FIRST. Even just having the just API.h, and BuiltIns.h, by having the project in the /WPILib/2k6/ folder. However, any time I try to call on any of the FIRST functions (Tank2, GetOIAInput, StartEncoder, etc.), I'm getting an error that says:
**** Build of configuration FRC 18f8722 WPILib Robot for project 2k6 **** mingw32-make all 'Building file: ../main.c' 'Invoking: C18 Compiler' mcc18 -D_FRC_BOARD -I=C:\mcc18\h -p=18F8722 -w=2 -nw=2066 -fo="main.o" "../main.c" C:\WPILib\2k6\main.c:51:Error [1204] too many arguments in function call mingw32-make: *** [main.o] Error 3 Any idea why this is happening? I've tried to mess around with pretty much every idea I had, and the only thing that seemed to relate is calling any of the WPILib functions. |
Re: WPILib and Eclipse
What does line 51 in main.c look like? As you know, several of the WPILib function prototypes are different between vEx and FRC, so you may need to use #ifdef _FRC_BOARD or #ifdef _VEX_BOARD in your own code in order to use the correct prototype.
|
Re: WPILib and Eclipse
Oh, that was increidbly stupid on my behalf. I just realized I copied the wrong error. I'm sorry. This one I completley understand. The one I do not understand does not supply a line, and the error itself complains about multiple definitions to "Set_Number_of_Analog_Channels". This happened any time I was in FRC code and tried to call any WPILib function, from either the main file or any other file. Any idea why that is happening? Sorry about the confusion.
|
Re: WPILib and Eclipse
I managed to replicate the error by calling StartEncoder(1) (although any number does it). Same thing happens with calling any WPILib function, such as InitGyro, or any WPILib function I tried. Any idea why this happens? Here's the error message:
**** Build of configuration FRC 18f8722 WPILib Robot for project 2k6 **** mingw32-make all 'Building file: ../main.c' 'Invoking: C18 Compiler' mcc18 -D_FRC_BOARD -I=C:\mcc18\h -p=18F8722 -w=2 -nw=2066 -fo="main.o" "../main.c" 'Finished building: ../main.c' ' ' 'Building target: 2k6.hex' 'Invoking: MPLINK Linker' mplink "..\18F8722.lkr" /a INHX32 /w /m FRCMapfile.map /o"2k6.hex" ./controls.o ./main.o ./motors.o /l"C:\mcc18\lib" ..\FRC2k6_library.lib ..\WPILib2k6.lib MPLINK 3.90, Linker Copyright (c) 2004 Microchip Technology Inc. Error - symbol 'Set_Number_of_Analog_Channels' has multiple definitions. Errors : 1 mingw32-make: *** [2k6.hex] Error 1 |
Re: WPILib and Eclipse
Quote:
The reason this happens is that there is some code in WPILib that duplicates part of the A/D code in the IFI library. If the IFI library is linked first, then both sections of code get included in the .hex file - and you see the multiple definition error. Brad |
Re: WPILib and Eclipse
Ahh, thank you. That solved it.
|
Re: WPILib and Eclipse
I'm stuck in the same place Sumadin & NSolarz were, in their first posts. After installation, and I am about to open my first project, there is no "project type" named "Microchip Embedded Systems" to open. I believe my mistake is also in the "path". Would someone please check these out. Thanks
From "My Computer" C:\ "System Properties" dialog box: "User Variables for Bill" PATH C:\MCC18\mpasm;C:\MCC18\bin;C:\MCC18\mpasm;C:\MCC1 8\bin; TEMP %USERPROFILE%\Local Settings\Temp TMP %USERPROFILE%\Local Settings\Temp "Systems Variables" (I think this is the problem) PATH C:\MCC18\mpasm;C:\MCC18\bin;C:\MCC18\mpasm;C:\MCC1 8\bin;%SystemRoot%\system32;C:\WINDOWS\System32;C: \MinGW\bin I was using the instructions from this White Paper and then added the 2 plug-ins from "WPLib". Also I am using C18 v2.20 and the MPLAB v6.62 Thanks again Bill |
Re: WPILib and Eclipse
1 Attachment(s)
Screen Shot
|
Re: WPILib and Eclipse
1 Attachment(s)
One more
|
Re: WPILib and Eclipse
I'd like to try this too, but am not clear what "mingw" I need. Do I want the .exe installer or do I just need the runtime? Also, what exactly does this provide? If it is just the C compiler add-in to Eclipse, can't I just go to the Eclipse website and download the "normal" C/C++ plug-in?
Thanks |
| All times are GMT -5. The time now is 19:35. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi