Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlapping tasks? #214

Closed
TooMuchAir opened this issue May 6, 2021 · 5 comments
Closed

Overlapping tasks? #214

TooMuchAir opened this issue May 6, 2021 · 5 comments

Comments

@TooMuchAir
Copy link

Hello,

I am using a 7 minute cycle time and usually a complete round takes about 4:30min. However occasionally I get two readings published within seconds.
Could there be a bug in the task scheduler that causes overlapping tasks? Just speculating...
Happy to provide more info is useful!

Thank you!

Example log excerpt (full log attached):

2021-05-06_00-41-02: =============================================================================================
2021-05-06_00-41-02: =================================== Main Started ============================================
2021-05-06_00-41-02: =============================================================================================
2021-05-06_00-41-11: Time zone set to CET-1CEST
2021-05-06_00-41-15: task_autodoFlow - next round - Round #1
2021-05-06_00-41-15: FlowControll.doFlow - ClassFlowMakeImage
2021-05-06_00-41-18: FlowControll.doFlow - ClassFlowAlignment
2021-05-06_00-48-20: FlowControll.doFlow - ClassFlowDigit
2021-05-06_00-48-27: FlowControll.doFlow - ClassFlowPostProcessing
2021-05-06_00-48-27: FlowControll.doFlow - ClassFlowMQTT
2021-05-06_00-48-27: sent publish successful in MQTTPublish, msg_id=16451, strom/zaehlerstand, 88815.9
2021-05-06_00-48-27: task_autodoFlow - round done
2021-05-06_00-48-27: CPU Temperature: 55.6
2021-05-06_00-48-27: task_autodoFlow - next round - Round #2
2021-05-06_00-48-27: FlowControll.doFlow - ClassFlowMakeImage
2021-05-06_00-48-31: FlowControll.doFlow - ClassFlowAlignment
2021-05-06_00-48-38: FlowControll.doFlow - ClassFlowDigit
2021-05-06_00-48-45: FlowControll.doFlow - ClassFlowPostProcessing
2021-05-06_00-48-45: FlowControll.doFlow - ClassFlowMQTT
2021-05-06_00-48-45: sent publish successful in MQTTPublish, msg_id=21156, strom/zaehlerstand, 88815.9
2021-05-06_00-48-45: task_autodoFlow - round done
2021-05-06_00-48-45: CPU Temperature: 55.0

Round 1 takes a little over 7 min. Round 2 only takes 18 seconds.
...
2021-05-06_03-51-41: sent publish successful in MQTTPublish, msg_id=39416, strom/zaehlerstand, 88816.1
2021-05-06_03-51-41: task_autodoFlow - round done
2021-05-06_03-51-41: CPU Temperature: 53.3
2021-05-06_03-58-22: task_autodoFlow - next round - Round #7
2021-05-06_03-58-23: FlowControll.doFlow - ClassFlowMakeImage
2021-05-06_03-58-26: FlowControll.doFlow - ClassFlowAlignment
2021-05-06_04-02-52: FlowControll.doFlow - ClassFlowDigit
2021-05-06_04-02-59: FlowControll.doFlow - ClassFlowPostProcessing
2021-05-06_04-02-59: FlowControll.doFlow - ClassFlowMQTT
2021-05-06_04-02-59: sent publish successful in MQTTPublish, msg_id=59286, strom/zaehlerstand, 88816.1
2021-05-06_04-02-59: task_autodoFlow - round done
2021-05-06_04-02-59: CPU Temperature: 55.0
...
Round 7 is started almost 7 min after round

2021-05-06_04-59-24: CPU Temperature: 54.4
2021-05-06_05-01-48: task_autodoFlow - next round - Round #5
2021-05-06_05-01-48: FlowControll.doFlow - ClassFlowMakeImage
2021-05-06_05-01-52: FlowControll.doFlow - ClassFlowAlignment
2021-05-06_05-09-04: FlowControll.doFlow - ClassFlowDigit
2021-05-06_05-09-11: FlowControll.doFlow - ClassFlowPostProcessing
2021-05-06_05-09-11: FlowControll.doFlow - ClassFlowMQTT
2021-05-06_05-09-11: sent publish successful in MQTTPublish, msg_id=15198, strom/zaehlerstand, 88816.4
2021-05-06_05-09-11: task_autodoFlow - round done
2021-05-06_05-09-11: CPU Temperature: 54.4
2021-05-06_05-09-11: task_autodoFlow - next round - Round #6
2021-05-06_05-09-11: FlowControll.doFlow - ClassFlowMakeImage
2021-05-06_05-09-15: FlowControll.doFlow - ClassFlowAlignment
2021-05-06_05-09-23: FlowControll.doFlow - ClassFlowDigit
2021-05-06_05-09-29: FlowControll.doFlow - ClassFlowPostProcessing
2021-05-06_05-09-29: FlowControll.doFlow - ClassFlowMQTT
2021-05-06_05-09-29: sent publish successful in MQTTPublish, msg_id=48879, strom/zaehlerstand, 88816.5
2021-05-06_05-09-29: task_autodoFlow - round done
2021-05-06_05-09-29: CPU Temperature: 54.4

Round 5 takes longer than usual and the subsequent round 6 finishes after only 18 seconds.

@jomjol
Copy link
Owner

jomjol commented May 6, 2021

Which setting for MakeImage and Alignment are you using (Parameter FixedExposure , AlignmentAlgo)?

@TooMuchAir
Copy link
Author

[MakeImage]
;LogImageLocation = /log/source
;LogfileRetentionInDays = 15
WaitBeforeTakingPicture = 3
ImageQuality = 5
ImageSize = VGA
;Brightness = -2
FixedExposure = true

[Alignment]
InitialRotate = 181
/config/ref0.jpg 363 275
/config/ref1.jpg 192 274
SearchFieldX = 20
SearchFieldY = 20
InitialMirror = false
AlignmentAlgo = Fast

@jomjol
Copy link
Owner

jomjol commented May 7, 2021

The explanationi for the different round duration is as follows:
The different timing could come from the AloignmentAlgo = Fast.
If this is enabled, at a first the algo just checks, if the position of the reference has been shifted, by just one single image comparison. Only if this fails, he starts the much longer searching algo, which takes way much longer.
Depending on the details of your reference structures, it could happen, that this first algo is rather instable and therefore rather often runs into the full searching algo.
You can change the FixedExposure to normal, then it will do the full finding always.

The reason for the start of the different start time till the next round is not clear for me yet. Need to think a bit longer about it.

@TooMuchAir
Copy link
Author

Thank you for the explanation! I will try out your recommendations.
It is obviously not critical during normal operation, but I thought I'd point it out in case this has side effects (e.g. the occasional crashes).

And in any case: Thank you for sharing this brilliant project and the very thoroug documentation! I have started to play with AI/ML myself using your examples.

@jomjol
Copy link
Owner

jomjol commented May 7, 2021

Thanks!

@jomjol jomjol closed this as completed May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants