I haven’t cycled between this yet just using the default ones for now… the default is EM0 right ?
However I have now added some time profiling… basic one for the entire loop
looks like when the robot is in power off state the time for loop run is 20ms
***madmax: LoopTime: Start time: 5061 End time: 5081 Difference: 20
***madmax: LoopTime: Start time: 5081 End time: 5101 Difference: 20
***madmax: LoopTime: Start time: 5101 End time: 5122 Difference: 21
***madmax: LoopTime: Start time: 5122 End time: 5142 Difference: 20
then after switching it on and the robot just holding Initial position it takes about 300ms
Which seems a lot considering it is a 600MHz core and all the maths(atan sin, cos etc ) is from look up tables !!! Do we have some wait time somewhere which causes this ?
Then I wanted to check what the servoMoveTime is set to so added some more debug:
While robot is off…
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 150
***madmax: LoopTime: Start time: 16837 End time: 16857 Difference: 20
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 150
***madmax: LoopTime: Start time: 16857 End time: 16877 Difference: 20
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 150
***madmax: LoopTime: Start time: 16877 End time: 16897 Difference: 20
then after switching on the robot using the PS button
***madmax: LoopTime: Start time: 27537 End time: 27837 Difference: 300
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 27837 End time: 28137 Difference: 300
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 28137 End time: 28437 Difference: 300
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
Then I went to the rotate mode and got the following timmings
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 69379 End time: 69600 Difference: 221
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 69600 End time: 70100 Difference: 500
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 70100 End time: 70121 Difference: 21
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 70121 End time: 70620 Difference: 499
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 70620 End time: 70641 Difference: 21
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 70641 End time: 70863 Difference: 222
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 70863 End time: 71083 Difference: 220
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 71083 End time: 71583 Difference: 500
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
***madmax: LoopTime: Start time: 71583 End time: 71606 Difference: 23
***madmax: Before assigning PrevServoMovetime ServoMoveTime is: 300
and it does jump around quite a bit but the ServoMoveTime does not seem to reflect this. Does it mean we are sending position updates before the servo completes its move ?
So what I am trying to understand here is
-
What is our control loop (loop() function ) processing time ?
-
Why are some calculations taking so much time ? Is it because the code is accessing EEPROM while doing calculations ? It might be good to cache the EEPROM data in some variables as part on an initialization routine so the loop time is reduced?
I am thinking aloud here so please bear with my questions if they are silly… Still digging through…