A scheduled control signal with fibers?

Ferhat Kurtulmuş aferust at gmail.com
Fri Sep 25 11:58:53 UTC 2020


Hi,

I have a problem to solve that may be solved using fibers. I have 
no previous experience with fibers. We are working on a 
variable-rate weeder. A camera is installed in front of a 
tractor. A flame weeder is connected to the behind of a tractor. 
Doing image processing (on RP3), we determine a weed density rate 
and send a PWM signal to the LPG valve to adjust the intensity of 
the flame. It is working well under lab conditions so far. 
However, my control signal has to be continuous with a delayed 
time shift. Because the tractor is moving with a ground-speed, 
and the flame applicator will reach the scene seen by the camera 
after about 1.5 seconds (I cannot change the location of the 
camera for some bad and mandatory design decisions). My 
pseudo-code is like:

int main(){
     ...

     while(true){

         int pwmval = getFlameIntensityViaImageProcessing();

         sendPWMSignalToValfe(pwmval); // I need this streamed 
ctrl signal to the valfe with a delayed time shift

         // a possible solution:
         // enum afterNmilliseconds = 1500;

         // schedulePWMSignalToValve(pwmval, afterNmilliseconds );

         ...
     }
     ...
}

How can I implement schedulePWMSignalToValve(pwmval, 
afterNmilliseconds ) using fibers?

Thanks in advance.


More information about the Digitalmars-d-learn mailing list