Go to Post they just build excellence and silently wait to deploy their creation on the unsuspecting masses - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 16-02-2011, 16:47
QRohlf's Avatar
QRohlf QRohlf is offline
Registered User
FRC #1823 (PING)
Team Role: Engineer
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Portland, OR
Posts: 7
QRohlf is an unknown quantity at this point
type tInterruptHandler doesn't seem to exist

Hello,

I'm trying to implement the following behavior on my team's bot:
We have a forklift. This forklift has two limit switches at the top and bottom of the track. We would like to stop the forklift motor and reset/re-calibrate the class we're using to handle the encoder attached to the motor as well whenever one of these limit switches are tripped.

To handle all of the Forklift stuff, I've created a Forklift class, which has the limit switches as members in the form of DigitalInputs. In order to get the behavior described above to occur within the Forklift class, I'm trying to use something similar to the Java Observer Pattern. It looks like the way to do this with the WPI lib is to use DigitalInput.requestInterrupts(Object handler, Object param). The documentation for this method states that the handler Object should be:
"The address of the interrupt handler function of type tInterruptHandler that will be called whenever there is an interrupt on the digitial input port. Request interrupts in synchronus mode where the user program interrupt handler will be called when an interrupt occurs. The default is interrupt on rising edges only."

However, I cannot find the type tInterruptHandler anywhere in the API or the documentation.

My questions are:
1. Has anyone here been successful at implementing this type of behavior inside of a class other than IterativeRobot, using interrupts or otherwise?
2. If not, what is the proper way to use DigitalInput.requestInterrupts(handler, param) so that I can make it do what I want it to?

My background is in Android programming, so I am very comfortable with the pattern adding change listeners to objects, then implementing an abstract method within those change listeners in order to receive callbacks when a change occurs. I figured it would be similar with the WPI interrupts, except that I haven't been able to figure it out because of the missing tInterruptHandler.

Thanks!
Reply With Quote
 


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


All times are GMT -5. The time now is 17:58.

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