Herkulex drs 0101 problem

Hello, I´m trying to use two herkulex 0101 servos with the library of this site: Dongbu Herkulex Arduino Library « Robottini using an Arduino Mega. I can communicate with the servos and get feedback normally, these things are okay, but the problem is that when I put in the continous rotation mode one servo is slightly faster than the other (5% I think) and I would be very happy if someone figured out the reason why(The margin shouldn´t be under the 1% because of the PID and other algorithms of speed control of the motor?). I also put the code.
PS: I don´t know why the Herkulex.torqueON and torqueOFF stands for, i cant see any differences in the motor.
#include <Herkulex.h>

void setup()
{
delay(2000); //a delay to have time for serial monitor opening
Serial.begin(115200); // Open serial communications
Serial.println("Begin");
Herkulex.beginSerial2(115200); //open serial port 1
//Herkulex.set_ID(253, 252);
Herkulex.torqueOFF(252);
Herkulex.torqueOFF(253);
Herkulex.reboot(252); //reboot first motor
Herkulex.reboot(253); //reboot second motor
delay(500);
Herkulex.initialize(); //initialize motors

// read status
Serial.println("");
Serial.print("Status1:");
Serial.println(Herkulex.stat(252));
Serial.print("Status2:");
Serial.println(Herkulex.stat(253));

// move servos in continous rotation at unison
Serial.println("");
Serial.println("MoveSpeedALL ");
Herkulex.moveSpeedAll(253,300,1);
Herkulex.moveSpeedAll(252,300,1);
Herkulex.actionAll(672);
delay(2500);

// move all to position
Serial.println("");
Serial.println("Move All to position");
Serial.println("Move Position1: 200");
Serial.println("Move Position2: 420");
Herkulex.moveAll(253, 200, 2); //move to position 200
Herkulex.moveAll(252, 420, 2); //move to position 820
Herkulex.actionAll(1000); //start movement in 1500 milliseconds

delay(1100);
Serial.print("Get Position servo 1:");
Serial.println(Herkulex.getPosition(253)); //get position
Serial.print("Get Position servo 2:");
Serial.println(Herkulex.getPosition(252));//get position

delay(10);

// move all to angle
Serial.println("");
Serial.println("Move All to Angle");
Serial.println("Move Angle1: 120.5 degrees");
Serial.println("Move Position2: -120.5 degrees");
Herkulex.moveAllAngle(252, 120.5, 2);;
Herkulex.moveAllAngle(253, -120.5, 2);
Herkulex.actionAll(2000);
delay(2100);
Serial.print("Get Angle1:");
Serial.println(Herkulex.getAngle(252));
Serial.print("Get Angle2:");
Serial.println(Herkulex.getAngle(253));

Herkulex.setLed(252,LED_PINK); //set the led
Herkulex.setLed(253,LED_GREEN2); //set the led
delay(1000);
for(int contador = 0; contador < 15; contador++){
Herkulex.moveSpeedOne(252, 1000, 0, 2);
Herkulex.moveSpeedOne(253, 1000, 0, 2);
delay(700);
Herkulex.moveSpeedOne(252, -1000, 0, 2);
Herkulex.moveSpeedOne(253, -1000, 0, 2);
delay(700);
}
Herkulex.moveSpeedOne(252, 0, 0, 2);
Herkulex.moveSpeedOne(253, 0, 0, 2);
delay(5000);
while(1){
Herkulex.moveSpeedOne(252, 1000, 0, 2);
Herkulex.moveSpeedOne(253, 1000, 0, 2);
}

Herkulex.end();
}

void loop(){
}

Hi, do you have the same diferrence using the library from Benoit Puel? The newest version is the 1.2: HerkuleXLib v1.2 – Le blog de Benoit Puel

Thank you for your reply, alegiaco. I am going to download it tomorrow, and test for a few hours and by the end of the day I will put the feedback here!

I decided to test the library today, but i do not have good news. There is one example sketch that had compile errors, and the others that uploaded to the board but did nothing to the motors, they dont stop blinking red, here is one of them that uploaded but did nothing:

/*
exampleGroupPosControl_MEGA
Drives group of HerkuleX servos thanks to the HerkuleXLib (see
Téléchargements – Le blog de Benoit Puel) using an Arduino MEGA board.

The serial terminal is used to printout messages.

This example code is in the public domain.

modified 10 February 2016
by Benoit Puel
*/

#include <HkxGroupPosControl.h>

void setup() {
// INPUT
const byte nbServos = 2;
byte IDs[nbServos] = {252, 253};

delay(5000); // wait 5 seconds to open the serial monitor
HkxPrint printoutLib = HkxPrint(Serial, 9600); // Printout errors on the serial monitor
HkxPrint printoutCode = HkxPrint(printoutLib, true, true, true); // Printout errors on the serial monitor
HkxCommunication communication = HkxCommunication(HKX_666666, Serial1, printoutLib); // Communication with the servo on Serial1
HkxPosControl servo0 = HkxPosControl(IDs[0], communication, printoutLib);
HkxPosControl servo1 = HkxPosControl(IDs[1], communication, printoutLib);
HkxPosControl* arrayServos[nbServos] = {&servo0, &servo1};
HkxGroupPosControl HerkGroupServo = HkxGroupPosControl(nbServos, arrayServos, printoutLib);

// Set the torque to free and the LED off
HerkGroupServo.setAllTorqueLEDControl(HKX_TORQUE_FREE, HKX_LED_OFF);
delay(5000); // wait 5 seconds

// Set the torque to break and the LED to yellow
HerkGroupServo.setAllTorqueLEDControl(HKX_TORQUE_BREAK, HKX_LED_YELLOW);
printoutCode.infoPrint("Torque is break, LED is yellow");
delay(5000); // wait 5 seconds

// Move servos to positions {45°, 30°, 15°} in 2 seconds, leds turned to pink,
// wait for the end of the move
printoutCode.infoPrint("Start moving to 45°, 30° and 15° in 2 seconds, pink LED");
int16_t tabPos[] = {450, 300};
HkxMaybe tabLed[] = {HKX_LED_PINK, HKX_LED_PINK, HKX_LED_PINK};
HerkGroupServo.moveSyncAllPosition(tabPos, 2000, tabLed, true);
printoutCode.infoPrint("The move is finished, torque is break and LED back to yellow");
delay(5000); // wait 5 seconds

// Move servos to positions {-45°, -30°, -15°} in 2, 1, 0.5 seconds, leds turned to pink,
// wait for the end of the move
printoutCode.infoPrint("Start moving to -45°, -30° and -15° in 2, 1, .5 seconds, pink LED");
int16_t tabPos2[] = {-450, -300};
uint16_t tabTime[] = {2000, 1000};
HerkGroupServo.moveAsyncAllPosition(tabPos2, tabTime, tabLed, true);
printoutCode.infoPrint("The move is finished, torque is break and LED back to yellow");
}

void loop() {
// put your main code here, to run repeatedly:

}

//I am using 2 servos with IDs 252 and 253 and they were at serial 1

Please use the right speed for the Herkulex communication. The speed in the robottini example is 115200 baud, and it works.

Change this line:

HkxCommunication communication = HkxCommunication(HKX_666666, Serial1, printoutLib); // Communication with the servo on Serial1

With:

HkxCommunication communication = HkxCommunication(HKX_115200, Serial1, printoutLib); // Communication with the servo on Serial1

This is an old post, but the solution I found might help somebody else out there.

I had a very similar issue. It wasn't until I tried to run the code using the power supply that came with my Arduino and it worked fine. The power provided over the USB from my computer must have been off enough to cause the servo to go into error mode. I would have checked but I can't locate my multi-meter.