![]() |
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
|
| 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