laptophead
Well-known member
I am using a 3.5 to run a robotic arm, 6 points of inflection, controlled by 3 DC motor controller with Quadrature encoders.
It is essential to read the encoders all the time, so I know my XYZ and when a motion is completed...
So I use 3 Serial ports on the teensy to read these values every 20 mS , they all run at 115200.
Despite it power, the teensy is acting sluggish, is overshooting some commands , etc
So I pulled up the Scope to see what is going on.
On the red (top) I made an oscillator in the loop to see how long to refresh.
digitalWriteFast(35, !digitalReadFast(35)); // toggle
When there is no Serial talk, the loop is takes about 250 micro Sec. Not bad,
However , look at the yellow line.
During the ask - tell of the 6 encoders the loop stops for about 7 Mili Sec.
The commands look like:
BaseEncGlobal = roboclaw129.ReadEncM1(adr129, &status3, &valid3);
ShoEncGlobal = roboclaw128.ReadEncM2(adr128, &status2, &valid2);
ElbowEncGlobal = roboclaw129.ReadEncM2(adr129, &status4, &valid4);
GripEncGlobal = roboclaw128.ReadEncM1(adr128, &status1, &valid1);
VertRotEnc = roboclaw130.ReadEncM1(adr130, &status5, &valid5);
HorRotEnc = roboclaw130.ReadEncM2(adr130, &status6, &valid6);
they are part of the ROBOCLAW controller library.
So does that mean that I am stuck during the Serial Talk?
Things get even slower later. I am outputting about 20 numbers to a tablet that I use to see and input commands to the robot.
I am using processing for that and the AP Sync library.
ck it out if you have time
https://youtu.be/t_-1qefwpJQ
That resulted in a 75 mS blockage.... No wonder the arm goes berserk.
Is there a better way to handle my serial "needs"?
Thanks everyone,
Mitch
It is essential to read the encoders all the time, so I know my XYZ and when a motion is completed...
So I use 3 Serial ports on the teensy to read these values every 20 mS , they all run at 115200.
Despite it power, the teensy is acting sluggish, is overshooting some commands , etc
So I pulled up the Scope to see what is going on.
On the red (top) I made an oscillator in the loop to see how long to refresh.
digitalWriteFast(35, !digitalReadFast(35)); // toggle
When there is no Serial talk, the loop is takes about 250 micro Sec. Not bad,
However , look at the yellow line.
During the ask - tell of the 6 encoders the loop stops for about 7 Mili Sec.
The commands look like:
BaseEncGlobal = roboclaw129.ReadEncM1(adr129, &status3, &valid3);
ShoEncGlobal = roboclaw128.ReadEncM2(adr128, &status2, &valid2);
ElbowEncGlobal = roboclaw129.ReadEncM2(adr129, &status4, &valid4);
GripEncGlobal = roboclaw128.ReadEncM1(adr128, &status1, &valid1);
VertRotEnc = roboclaw130.ReadEncM1(adr130, &status5, &valid5);
HorRotEnc = roboclaw130.ReadEncM2(adr130, &status6, &valid6);
they are part of the ROBOCLAW controller library.
So does that mean that I am stuck during the Serial Talk?
Things get even slower later. I am outputting about 20 numbers to a tablet that I use to see and input commands to the robot.
I am using processing for that and the AP Sync library.
ck it out if you have time
https://youtu.be/t_-1qefwpJQ
That resulted in a 75 mS blockage.... No wonder the arm goes berserk.
Is there a better way to handle my serial "needs"?
Thanks everyone,
Mitch