Go to Post Free food attracts us like flies. It's the one sure way to get us to meetings. - Mark McLeod [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2010, 08:34
Rikard023's Avatar
Rikard023 Rikard023 is offline
Programmer/Animator/Captain/Ninja
AKA: Rikard
FRC #0522 (The Robowizards)
Team Role: Programmer
 
Join Date: Sep 2009
Rookie Year: 2008
Location: Staten Island,NY
Posts: 20
Rikard023 is an unknown quantity at this point
Send a message via AIM to Rikard023
How to write Notifier help!!

OK im trying to write a notifier class to cause a delay in my program where one task would be preformed after another with a specific delay.

I get to the part where i named what the notifier is but when the little box appears after i put the name then -> the box says

Notifier(TimerEventHandler handler, void *param)

Now i dont know whatvalues to put in or what any of this means

Any documentation or code any one could give me to simply write a notifier would be much appreciated
__________________
"Sharp edges are prone to cause bleeding trust me i know" T.T

http://www.robowizards.com
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2010, 10:07
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: How to write Notifier help!!

I'll post some help later tonight.
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2010, 23:33
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: How to write Notifier help!!

First you write a function that does whatever you want to do after the notifier delay. Say you want to activate a solenoid after the delay. The Notifier calls a function that takes a void pointer as an argument. We'll pass it a pointer to our solenoid and cast it back in the function so we can use it.

Here's the function:

Code:
void SolenoidDelayEventHandler(void* param)
{
        //Cast the pointer back to the solenoid type
	Solenoid* sol = (Solenoid*)param;
        //Activate the solenoid
	sol->Set(true);
}
Now, when we create our Notifier class, it wants two arguments: the function and what to pass to the function. We create it like so:

Code:
//As a member of your robot class,
Notifier solenoidNotifier;

//Then in the constructor of your robot class
solenoidNotifier(SolenoidDelayEventHandler, &mySolenoid)
//assuming mySolenoid is declared statically in the robot class as well
//and not with the keyword new
Now whenever you want to call your notifier function (and therefore activate the solenoid) after a delay time, just call
Code:
solenoidNotifier.StartSingle(time);
where time is the delay time in seconds. There's also a StartPeriodic(time) function in the Notifier class that calls the function continuously, where time is the delay between calls. It stops when you call Notifier::Stop().

Any questions?
__________________
Reply With Quote
  #4   Spotlight this post!  
Unread 17-02-2010, 05:01
gvarndell's Avatar
gvarndell gvarndell is offline
Software Engineer
AKA: Addi's and Georgie's Dad
FRC #1629 (GaCo)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Grantsville, Maryland
Posts: 350
gvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond repute
Re: How to write Notifier help!!

Quote:
Originally Posted by slavik262 View Post
Any questions?
Yes.

I just downloaded the WPILibSource20100107.zip because I am curious how they implemented the notifiers.
Is that the latest library source from WPI as far as you know?
THX!
__________________
Robots never, ever, ever, ever break -- The Robot Repairman (Backyardigans)
Reply With Quote
  #5   Spotlight this post!  
Unread 17-02-2010, 08:40
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: How to write Notifier help!!

Quote:
Originally Posted by gvarndell View Post
Yes.

I just downloaded the WPILibSource20100107.zip because I am curious how they implemented the notifiers.
Is that the latest library source from WPI as far as you know?
THX!
Off the top of my head, I don't know the current version number and I can't download the newest update to check since I'm at school at the moment.

As far as how notifiers work, they seem to work on an interrupt level (I'm assuming through a hardware timer run in the FPGA). This is just a guess from glancing over the header file; anyone can feel free to confirm or correct me here.
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 20-02-2010, 07:56
Rikard023's Avatar
Rikard023 Rikard023 is offline
Programmer/Animator/Captain/Ninja
AKA: Rikard
FRC #0522 (The Robowizards)
Team Role: Programmer
 
Join Date: Sep 2009
Rookie Year: 2008
Location: Staten Island,NY
Posts: 20
Rikard023 is an unknown quantity at this point
Send a message via AIM to Rikard023
Re: How to write Notifier help!!

I still need help with the notifier if anyone else has info

kinda close to ship date
__________________
"Sharp edges are prone to cause bleeding trust me i know" T.T

http://www.robowizards.com
Reply With Quote
  #7   Spotlight this post!  
Unread 20-02-2010, 08:12
Rikard023's Avatar
Rikard023 Rikard023 is offline
Programmer/Animator/Captain/Ninja
AKA: Rikard
FRC #0522 (The Robowizards)
Team Role: Programmer
 
Join Date: Sep 2009
Rookie Year: 2008
Location: Staten Island,NY
Posts: 20
Rikard023 is an unknown quantity at this point
Send a message via AIM to Rikard023
Re: How to write Notifier help!!

Quote:
Originally Posted by gvarndell View Post
Yes.

I just downloaded the WPILibSource20100107.zip because I am curious how they implemented the notifiers.
Is that the latest library source from WPI as far as you know?
THX!
And the last workbench update is WorkbenchUpdate20100217.exe
http://first.wpi.edu/Images/CMS/Firs...te20100217.exe
__________________
"Sharp edges are prone to cause bleeding trust me i know" T.T

http://www.robowizards.com
Reply With Quote
Reply


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
how to write a good proposal and sponsorship letter for a event alanelf Fundraising 17 03-05-2011 06:58
Notifier fixes (impacting PIDController) heydowns C/C++ 0 05-02-2009 11:06
Notifier Class Phoenix Spud Programming 0 26-01-2009 20:16
How long to understand camera and write useful code RGuindon Programming 3 16-12-2007 01:37
How to write image data to binary PGM file format(P5)? tommy_chai Programming 0 08-10-2007 08:22


All times are GMT -5. The time now is 13:54.

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