Slow communications Latency using Packet Serial
Posted: Sat Apr 21, 2018 11:21 pm
Hi
I am using the RoboClaw controllers to run all my actuation on a project.
The project consists of a Steward Platform atop a kiwi drive omni directional base
I am controlling 6 linear actuators for the platform, and 3 DC motors for the base
I am using an Adafruit ESP32 Feather for the MCU and have been using the Arduino libraries
The problem I am currently trying to solve is that I am getting a 30ms latency on each serial communication between the MCU and the RoboClaws - with 9 actuators this is adding up to 270ms for each command cycle, which is not functional. This gets worse when I try and request information from the RoboClaws.
I had been running previously off an AVR AtMega2560, I experienced a similar problem until I split the base and platform control over 2 Serial channels, but that doesn't seem to be fixing it this time (and it doesn't solve the initial problem with the source of the latency) - any help on this would be greatly appreciated.
Here are the drive functions:
UPDATE:
When I set the timeout to 1000 instead of 10000 when defining the roboclaws, the latency drops to 10ms - the esp32 therefor is timing out with communicating to the RoboClaws - given the trouble I was having with requesting info from the controllers, it would seem that the ESP32 isn't reading data back from the controllers?
UPDATE 2:
Even with the timeout set to effectively zero, the latency on the Platform drive is still around 8ms on each communication cycle (with the encoders and actuators not currently connected) - so around 83ms for all nine control commands (I have ran it wirelessly, connected to all the actuators, so the control commands are getting from the ESP32 to the Roboclaws just fine)
Dillon
I am using the RoboClaw controllers to run all my actuation on a project.
The project consists of a Steward Platform atop a kiwi drive omni directional base
I am controlling 6 linear actuators for the platform, and 3 DC motors for the base
I am using an Adafruit ESP32 Feather for the MCU and have been using the Arduino libraries
The problem I am currently trying to solve is that I am getting a 30ms latency on each serial communication between the MCU and the RoboClaws - with 9 actuators this is adding up to 270ms for each command cycle, which is not functional. This gets worse when I try and request information from the RoboClaws.
I had been running previously off an AVR AtMega2560, I experienced a similar problem until I split the base and platform control over 2 Serial channels, but that doesn't seem to be fixing it this time (and it doesn't solve the initial problem with the source of the latency) - any help on this would be greatly appreciated.
Here are the drive functions:
Code: Select all
//kiwi drive base driving function
void driveEncBase()
{
roboclaw2.SpeedM1(CLAW4ADR, kiwi[0]);
roboclaw2.SpeedM2(CLAW4ADR, kiwi[1]);
roboclaw2.SpeedM1(CLAW5ADR, kiwi[2]);
}
// Stewart Platform drive to position function
void moveToPos()
{
for(int i = 0; i <3 ; i++)
{
roboclaw.SpeedAccelDeccelPositionM1(address+i,0,linearV,0,targetPos[(2*i)],0);
roboclaw.SpeedAccelDeccelPositionM2(address+i,0,linearV,0,targetPos[(2*i)+1],0);
}
}
void serialDrive()
{
mapVector();
stewartPos(transPos[XX],transPos[YY],transPos[ZZ],euler[A],euler[B],euler[C]);
kiwiDrive(kiwiA, kiwiV, kiwiR);
int tm2 = millis(); //this is to check serial latency only, comment out once fixed
driveBase();
Serial.println(millis()-tm2);
tm2 = millis();
moveToPos();
Serial.println(millis()-tm2);
}
When I set the timeout to 1000 instead of 10000 when defining the roboclaws, the latency drops to 10ms - the esp32 therefor is timing out with communicating to the RoboClaws - given the trouble I was having with requesting info from the controllers, it would seem that the ESP32 isn't reading data back from the controllers?
UPDATE 2:
Even with the timeout set to effectively zero, the latency on the Platform drive is still around 8ms on each communication cycle (with the encoders and actuators not currently connected) - so around 83ms for all nine control commands (I have ran it wirelessly, connected to all the actuators, so the control commands are getting from the ESP32 to the Roboclaws just fine)
Dillon