View Single Post
  #3   Spotlight this post!  
Unread 13-06-2010, 09:51
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: no control of bot when kicker is operating

I've seen the following kicker approach successfully implemented in LabVIEW. The same approach could be used in Java or C++.

put the following code in a separate concurrent periodic task using your language of choice. for a kicker, 20Hz is probably plenty fast enough.

Code:
/*
to establish the 50ms period (20Hz frequency) put your code here 
to block wait for 50ms to elapse, releasing the CPU so this task 
does not run at high speed and use CPU resources unnecessarily 
when not kicking
*/

if (kickRequested && !kicking) {

kicking=1; // prevent reentrancy

/*
put your sequential kicking code here. if your code has places where it needs to wait for an event, like elapsed time or a limit switch for example, make sure you code it so that the CPU will be released to use that time to service other tasks while waiting for the event. if your code uses data from other tasks, make sure the access is protected.
*/ kicking=0; }

"kickRequested" is a global boolean that is used by your code in Autononmous and/or TeleOp to request that a kick be performed.

"kicking" is a local boolean to control reentrancy: If a kick is presently in progress when the request is made, the request will be ignored (so as not to interrupt the ongoing kick cycle)