xavierpacheco wrote on Wednesday, April 11, 2018:
Hello,
I have 6 ultrasonic sensors HC-SR04 which I want to trigger them accoding to the following schedule:
Table attached.
If you have further questions, you can see the paper related: https://www.cs.cmu.edu/~motionplanning/papers/sbp_papers/integrated1/borenstein_obstacle_avoid.pdf
They will fire in groups of 2.
First period:
S1 (sensor 1) fires at 24 ms
S2 = 49 ms
S3=24 ms
S4=49 ms
S5=24 ms
S6= 49 ms
Second period:
S1= 37 ms
S2=75 ms
S3= 39 ms
S4=77 ms
S5 = 41 ms
S6 = 79 ms
That’s the schedule, I mean, for the first period, first S1 fires at 24 ms, then S2 at 49 ms, so S2-S1 = 25 ms, so when S3 fires, it’s been 50 ms.
After first period, S1 fires again but at 37 ms after sensor 6 in first period.
Note that the shortest time difference between firings of any 2 neighboring sensors is 38.0 ms
As you know, to trigger an ultrasonic sensor, a 10 us pulse needs to be sent to the trigger pin . The times above just mean the exact point when the get triggered.
Hopefully you understand what I want to achieve using FreeRTOS.
Do you think I should just create simple tasks with same priority and blocking time equal to the time needed to trigger the sensor?