Go to Post 7 divisions would be... interesting. - cadandcookies [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 17-01-2006, 10:19
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Welcome to the WPILib forum

WPILib was designed a few years ago for teaching robot programming to high schools students here at WPI. Since then it has been enhanced greatly and now there are versions for the 2k4-5 and 2k6 FRC controllers. It is being used by EasyC for FRC as the runtime system inside the robot.

What does it do for you?
  • First and foremost - it's easy to use. For example, a program to drive in a straight line using a gyro is literally 11 lines of code - including the braces! And that's the whole program, all you need to write or look at.
  • It's free - no licenses, just use it on as many computers as you want as long as it's helping you.
  • There is support for all the standard 2006 kit of parts sensors plus a bunch of others that you might want to use, i.e. rangefinders, compasses and encoders.
  • It is a true library - that is updates to the library don't require any source code editing or merging with your code. Programs written to the WPILib API from 2 years ago will still work today virtually unchanged.
  • It is completely extensible - advanced programmers can add new devices to the library (there is an example of adding a compass in the documentation) and it doesn't require any source code merging to add it to existing programs.
  • And, I think the expression is, "we eat our own dog food" - that is to say, we are using the library with Team 190 and any updates are quickly posted back for everyone else to use.
  • There is a large document that describes how to use it, and how to extend it (that part intended for the more experienced programmers).

Who should use it?
It you have little C programming experience you could use EasyC - it will help with all the syntax problems and still will be using WPILib since it's built in. But if you are comfortable with C programming and want to use MPLab or Eclipse or other development environment, give WPILib a try. It's easy to get things going fast.

Where to download it
You can download WPILib from my web site. I'll be posting updates there as they come out. There are also lots of example programs.

Support
We'll be monitoring this forum with the help of others at WPI to answer questions as they come up. New versions will be posted on the web site and will be announced on this forum.

Versions
There are versions right now for 2004-5 and 2006 robot controllers. The VEX and Robovation (EDU) versions will go up as soon as I have time. The guys here are bugging me to put up a new version for a battery conditioner/recycler they built out of an old EDU controller.

We hope this helps, and please feel free to email us with comments and suggestions.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #2   Spotlight this post!  
Unread 17-01-2006, 22:08
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
Re: Welcome to the WPILib forum

Brad,

Does WPILib have a math function library?

Jon Mittelman
Team236
  #3   Spotlight this post!  
Unread 17-01-2006, 22:39
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
Re: Welcome to the WPILib forum

In using WPILib with the CMU camera,

1. Should we save Vision Sensor parameters from LabView? And if so, how?
2. Are there any references to the SetServoTracking and SetServoPosition functions?
3. Do the 'pan' and 'tilt' values in the CaptureTrackingData structure refer to values that the servos should have to track the centroid of the desired color?

Jon Mittelman
Team236
  #4   Spotlight this post!  
Unread 17-01-2006, 22:49
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Welcome to the WPILib forum

Quote:
Originally Posted by Jon236
Brad,

Does WPILib have a math function library?

Jon Mittelman
Team236
Jon -

There is no explicit math library. It does link with the standard Microchip libraries so that gets you all the math.h stuff. However I would not recommend doing too much floating point math - it's really slow on the little PIC processor.

Last year we used this library of Cordic math functions - that used 24 bit (short long) arithmetic to do trig functions if that's what you're looking for. It was graciously posted by team 236.

It worked pretty well for us - those holonomic drive calculations needed a bunch of trig functions. So I'd recommend that solution to anyone who needs general purpose trig functions.

With that said, you might also try lookup tables if you don't need a small range of values to be calculated. This only works in some applications and might be useful this year.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #5   Spotlight this post!  
Unread 18-01-2006, 09:56
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Welcome to the WPILib forum

Quote:
Originally Posted by Jon236
In using WPILib with the CMU camera,

1. Should we save Vision Sensor parameters from LabView? And if so, how?
There is no easy way of exporting the camera parameters from LabView. I ran out of time. What you should do is create an instance of a CameraInitializationData struct, fill it in (can be statically initialized) and passed to InitializeCamera(CameraInitializationData *c). You can get the data looking at the labview interface and filling in the struct.

The CameraInitializationData struct is in UserAPI.h. This is a rom struct so you have to initialize it when it is declared.

When InitializeCamera is called, the data will be sent to the camera. When you call StartCamera, it will start tracking with the most recent set InitializationData.

Quote:
Originally Posted by Jon236
2. Are there any references to the SetServoTracking and SetServoPosition functions?
I'll try to add them to the documentation. But basically they look like this:
Code:
void SetServoTracking(unsigned char panTracking, unsigned char tiltTracking)
Where you set panTracking and tiltTracking to 1 or 0 to enable or disable that function. If either are disabled, then there won't be valid pan/tilt data in the returned camera packets.

Code:
void SetServoPosition(unsigned char servo, unsigned char position)
The servo is the servo index (value of 0-4) as described in the CMU Camera manual. The position is the PWM value sent to that servo.

Quote:
Originally Posted by Jon236
3. Do the 'pan' and 'tilt' values in the CaptureTrackingData structure refer to values that the servos should have to track the centroid of the desired color?
The pan and tilt values in the CaptureTrackingData are the values that the camera sends to the servos if it is connected and servo tracking is enabled (see previous question). If servo tracking is disabled the camera sends back 127 all the time.

Hope this helps.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #6   Spotlight this post!  
Unread 18-01-2006, 10:44
rodgadashruba rodgadashruba is offline
Registered User
FRC #0611
 
Join Date: Jan 2006
Location: McLean
Posts: 17
rodgadashruba is an unknown quantity at this point
Re: Welcome to the WPILib forum

hey quick question,
My team's programming side is made up of medium level programmers, and some of the great code by Kevin Watson is overwelming. We would be using MpLab regardless. but what are the cons of using WPIlib? it seems like there is none but i may have over looked somthing
  #7   Spotlight this post!  
Unread 18-01-2006, 11:20
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Welcome to the WPILib forum

Quote:
Originally Posted by rodgadashruba
hey quick question,
My team's programming side is made up of medium level programmers, and some of the great code by Kevin Watson is overwelming. We would be using MpLab regardless. but what are the cons of using WPIlib? it seems like there is none but i may have over looked somthing
I see two possible reasons that someone might not want to use it.

It is currently a "proprietary" solution. What I mean is that you are free to use it in any way you like, but the source code is not available. This is due to its inclusion in EasyC. This might change in the future.

With that said, I can tell you that we are using the code ourselves and posting new versions whenever it changes. I would consider it pretty unprofessional to be having a version of the library that we were using on Team 190 that wasn't available to everyone.

The other is that it is simply a different style of programming then the default code supplied by IFI. If you are more comfortable with the current code, then by all means, keep using it. We found it much easier to teach students programming using WPILib for 2 week intro to robotics courses.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #8   Spotlight this post!  
Unread 18-01-2006, 11:55
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
Re: Welcome to the WPILib forum

Quote:
Originally Posted by BradAMiller
I see two possible reasons that someone might not want to use it.

It is currently a "proprietary" solution. What I mean is that you are free to use it in any way you like, but the source code is not available. This is due to its inclusion in EasyC. This might change in the future.

With that said, I can tell you that we are using the code ourselves and posting new versions whenever it changes. I would consider it pretty unprofessional to be having a version of the library that we were using on Team 190 that wasn't available to everyone.

The other is that it is simply a different style of programming then the default code supplied by IFI. If you are more comfortable with the current code, then by all means, keep using it. We found it much easier to teach students programming using WPILib for 2 week intro to robotics courses.

Is that curriculum available at a website? I'd love to see it.

Jon
  #9   Spotlight this post!  
Unread 18-01-2006, 17:10
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Welcome to the WPILib forum

Quote:
Originally Posted by Jon236
Is that curriculum available at a website? I'd love to see it.
Jon
It isn't there right now - I'll see if I can post it in the future. We use it for our Frontiers program at WPI. It's a 2 week resident program in the summer for robotics.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #10   Spotlight this post!  
Unread 20-01-2006, 20:39
rodgadashruba rodgadashruba is offline
Registered User
FRC #0611
 
Join Date: Jan 2006
Location: McLean
Posts: 17
rodgadashruba is an unknown quantity at this point
Re: Welcome to the WPILib forum

well we decided on usign wpilib, and it looks great,

quick question..

how would u program a custom control board that would be conneted to the operater interface?

i hope this is possible
thanks
  #11   Spotlight this post!  
Unread 20-01-2006, 20:57
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Welcome to the WPILib forum

Quote:
Originally Posted by rodgadashruba
well we decided on usign wpilib, and it looks great,

quick question..

how would u program a custom control board that would be conneted to the operater interface?

i hope this is possible
thanks
There is no reason to prevent you from doing that and you don't have to use those functions.

We're about to do the same thing. Our team has been writing code to read the ports directly rather than using the functions. Currently they are creating a bunch of "#defines" that give mnemonic names to the ports where the custom controls ane connected. By doing that, they can easily be changed later if the OI is wired differently than originally planned.

It you decide to use the functions, that's ok too. There is no requirement that "trigger1" is actually connected to a joystick. It can be a separate switch.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #12   Spotlight this post!  
Unread 30-01-2007, 08:05
Joohoo's Avatar
Joohoo Joohoo is offline
Registered User
FRC #0340 (G.R.R.)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 2005
Location: Rochester
Posts: 241
Joohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really nice
Send a message via AIM to Joohoo Send a message via Yahoo to Joohoo
Re: Welcome to the WPILib forum

Just curious what interrupts/timers does each encoder and ultrasonic sensor use. Is there a listing of what each sensor uses in terms of internal timers, external interrupts, and how they are configured?

Also has any one used wpilib in addition to the default code?... kevin watson's?
  #13   Spotlight this post!  
Unread 30-01-2007, 11:06
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Welcome to the WPILib forum

Quote:
Originally Posted by Joohoo View Post
Just curious what interrupts/timers does each encoder and ultrasonic sensor use. Is there a listing of what each sensor uses in terms of internal timers, external interrupts, and how they are configured?

Also has any one used wpilib in addition to the default code?... kevin watson's?
WPILib uses timer 1 for everything. It maintains a timer queue internally and there are calls to register for timer support. So a device driver can call a function to register for repeating timer interrupts with 1ms resolution and that request is put in a list. On each timer interrupt the WPILib checks to see what outstanding requests exist at that time and call the registered timer handlers.

Devices can also get the time with about 10us accuracy by calling other functions. These work by using looking at the prescaler registers on timer1 to see where in the 1ms interval it is and compute the running time in microseconds.

So, for example, a Vex ultrasonic sensor registers for interrupts every 100ms that it uses to send the pings. But it has to do sub-millisecond timing to get the distance right, so it times the echo line using the microsecond timing functions.

All this happens only using timer 1.

External interrupts are handled by devices registering for interrupts (another function). They can look for rising or falling edges. The ultrasonic sensor, for example, uses this to watch the echo line on the sensor.

All these functions - registering for timer events, and registering for interrupts is done with functions that anyone can call. This makes the library extensible. You can write your own drivers for new devices just as I did for the ones in the library. And all the functions are documented in the manual that is on the web site along with the code.

I hope this answers your questions.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #14   Spotlight this post!  
Unread 04-02-2007, 13:11
michael714's Avatar
michael714 michael714 is offline
Registered User
FRC #3863 (Pantherbotics)
Team Role: Teacher
 
Join Date: Apr 2006
Rookie Year: 2007
Location: Newbury Park, CA
Posts: 46
michael714 is on a distinguished road
Mixing WPILib with default MPLAB code

Dear Brad,
Can you mix WPILib with default MPLAB code? If so, do you have any suggestions as to how to do so?

My team is using Kevin Watson's camera code as a basis for our coding efforts. However, it would be nice to access the routines in WPILib also (for when we try to do other things like using the Vex ultrasonic range finder).

Do we merely add the following files to our MPLAB workspace: API.h, BuiltIns.h, UserAPI.h and WPILib2k6.lib?

Do we need to add the FRC2k6_library.lib? Or is that the same as the ifi_library.lib file included with Kevin's MPLAB project?

Do we need to add the linker file or can we just use the linker file from Kevin's project?

And, one last question: right now we're using the EDU-RC to do our development, can we use WPILib with the EDU-RC as long as we use the 18f8520user.lkr file?

Your efforts are greatly appreciated.
  #15   Spotlight this post!  
Unread 04-02-2007, 15:33
michael714's Avatar
michael714 michael714 is offline
Registered User
FRC #3863 (Pantherbotics)
Team Role: Teacher
 
Join Date: Apr 2006
Rookie Year: 2007
Location: Newbury Park, CA
Posts: 46
michael714 is on a distinguished road
Mixing WPILib with default MPLAB code

Dear Brad,
I've been trying to do it myself. I added the 2k5 files including API.h, UserAPI.h, and WPILIb2k5.lib to Kevin Watson's edu_camera code and the compiler was able to do everything with no errors or warnings except from the Linker at the end and it looked like this:

Error - section 'InterruptVectorLow' type is non-overlay and absolute but occurs in more than one input file.

InterrruptVectorLow is in user_routines_fast.c. I tried removing user_routines_fast.c, but just got another error message. When I comment out the WPILib sample code (from the manual), the error message goes away and everything compiles just fine. As soon as I put the code that references WPILib routines back in, the error comes back. I still have ifi_library.lib attached to the project and I tried removing it, but the error did not go away. I also tried re-ordering the two library files and that did not help either.

Am I trying to do something that can't be done?
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
National Instruments LabVIEW and Data Acquisition Forum Danny Diaz National Instruments LabVIEW and Data Acquisition 1 16-01-2006 13:20
moderators for Q&A forum Ken Leung CD Forum Support 25 03-01-2003 18:15


All times are GMT -5. The time now is 10:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi