Go to Post You mean to tell me there's a weight limit this year?!?!?!!? - Carlo [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-02-2007, 23:21
Dkim Dkim is offline
Registered User
FRC #1515
 
Join Date: Feb 2007
Location: Beverly Hills
Posts: 2
Dkim is an unknown quantity at this point
WPILib Op. Control mode

Our team is working with WPILib. We've seen many example of sample
code that would work in Autonomous mode, but
very few examples of how to handle Operator Control mode where we have
to listen for hardware interrupts, process commands
and stuff. Is it possible that we could get a very simple example of
what would be expected of us in the software arena for Operator
mode? Many thanks!
  #2   Spotlight this post!  
Unread 07-02-2007, 00:15
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,185
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: WPILib Op. Control mode

You will pretty much write your code the exact same way you would if you were using IFI's default code. Your control over the robots hardware is at a higher level in WPILib, so it will take some getting used to. At its most simple point, you will be calling functions to set motor values rather than assigning variables. At a more complicated point, you can write new device drivers to talk with sensors that aren't supported "out of the box".

If you want to watch for interrupts, you can use a cool feature of WPILib called an Interrupt Watcher. This is pretty simple.. You set up the interrupt watcher by giving it a port number. When the interrupt occurs, it sets a flag. In your main loop, you can check that flag. Pretty simple, pretty easy. This will come in handy if you have a sensor where you need to keep track of whether it was fired or not, and the operation of the sensor may be too fast for your main loop

From WPILib documentation:
Code:
// initialize interrupt watcher on port 1 looking for a rising edge 
//    this is an input going from low to high (like a switch opening) 
StartInterruptWatcher(1, RISING_EDGE); 
while (1) 
{ 
  
  // the time to poll the digital input port that was being watched 
  // 
  // 
  // check if the value has changed since the last check 
  if (GetInterruptWatcher(1) == 1) 
  { 
    printf("Interrupt Occurred!\r");
  } 
  // 
  // program doing more work over here. 
  // 
}
If you chose, you can also set up an ISR to handle these interrupts.

Take a look at the WPILib documentation. It is very well written and should help you out alot. Read the entire thing before you sit down to code.
http://users.wpi.edu/~bamiller/WPILib/WPILib.pdf
  #3   Spotlight this post!  
Unread 08-02-2007, 23:51
Dkim Dkim is offline
Registered User
FRC #1515
 
Join Date: Feb 2007
Location: Beverly Hills
Posts: 2
Dkim is an unknown quantity at this point
Re: WPILib Op. Control mode

With WPILib, I am trying to set the various LED lights on the controller. When I
call SetOILed( ..., ... ), the compiler pukes "call of function without prototype".
I believe this is due to the way this function is conditionally included. It
appears to not be available to us with the 2007 kit. Is this correct or am I doing
something wrong?
  #4   Spotlight this post!  
Unread 10-02-2007, 09: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: 588
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: WPILib Op. Control mode

Quote:
Originally Posted by Dkim View Post
With WPILib, I am trying to set the various LED lights on the controller. When I
call SetOILed( ..., ... ), the compiler pukes "call of function without prototype".
I believe this is due to the way this function is conditionally included. It
appears to not be available to us with the 2007 kit. Is this correct or am I doing
something wrong?
Make sure you've defined the symbol _FRC_BOARD in the defines section of MPLab, eclipse or whatever tool you are using.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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
New version of WPILib BradAMiller Programming 26 27-01-2007 15:49
WPILib Questions Kruuzr Programming 1 22-01-2007 11:46
Auto aim in user control mode JamesBrown Programming 2 19-02-2006 12:58
Direct Control of PWMs and OI in WPILib CyberWolf_22 Programming 7 06-02-2006 19:06


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

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