HerkuleX DRS-0101 feedbacks does not work

Hi guys!

I have two HerkuleX DRS-0101. It works good but I can not get any position feedback.

I used the following code:

#include <Herkulex.h>

int n=0xfd; //motor ID - verify your ID !!!!

void setup()  
{
  delay(2000);  //a delay to have time for serial monitor opening
  Serial.begin(115200);    // Open serial communications
  Serial.println("Begin");
  Herkulex.begin(115200,10,11); //open serial with rx=10 and tx=11 
  Herkulex.reboot(n); //reboot first motor
  delay(500); 
  Herkulex.initialize(); //initialize motors
  delay(200);  
}

void loop(){
  Serial.println("Move Angle: -100 degrees");
  Herkulex.moveOneAngle(n, -100, 1000, LED_BLUE); //move motor with 300 speed  
  delay(1200);
  Serial.print("Get servo Angle:");
  Serial.println(Herkulex.getAngle(n));
  Serial.println("Move Angle: 100 degrees");
  Herkulex.moveOneAngle(n, 100, 1000, LED_BLUE); //move motor with 300 speed  
  delay(1200);
  Serial.print("Get servo Angle:");
  Serial.println(Herkulex.getAngle(n));
  
}

The motor is working as it should but in the serial monitor I got this:
Begin
Move Angle: -100 degrees
Get servo Angle:-166.72
Move Angle: 100 degrees
Get servo Angle:-166.72
Move Angle: -100 degrees
Get servo Angle:-166.72
Move Angle: 100 degrees
Get servo Angle:-166.72
Move Angle: -100 degrees
Get servo Angle:-166.72
Move Angle: 100 degrees
Get servo Angle:-166.72

I always got servo angle -166.72
For the position I got -1…

I have tried with the other library HerkuleX, but the same problem, the motor is working but the position feedback not.

If I just unplug the RX wire, I have got the same values, so I thought it is connection problem. I have replaced the wire, I have tried with different pin, but still does not work.

What can be a problem?

Thanks

Szotyi,

I have experienced the same problem. I have been able do many things with the servos, but every time I request feedback from the motor it returns errors or incorrect values.

Here is an example sketch that I was using:

#include <Herkulex.h>  
int n = 0xfd;

void setup()
{
  Serial.begin(57600); 
  Herkulex.begin(57600,RX,TX); // Open servo serial port 
 Herkulex.reboot(n);            // Restart motor after changes
  Serial.println("Starting up...");
  delay(500);
  Herkulex.initialize();         // initialize motors
}
void loop()
{  
  Serial.println("Move Angle: -100 degrees");
  Herkulex.moveOneAngle(n, -100, 1000, LED_BLUE); 
  delay(1200);
  Serial.print("Get servo Angle:");
  Serial.println(Herkulex.getPosition(n));
  Serial.println("Move Angle: 100 degrees");
  Herkulex.moveOneAngle(n, 100, 1000, LED_BLUE);  
  delay(1200);
  Serial.print("Get servo Angle:");
  Serial.println(Herkulex.getPosition(n));
}

Here is a link to the Arduino library: http://robottini.altervista.org/dongbu-herkulex-arduino-library-2

I have tried to clear errors, check the status, etc. I will continue to scour the manual for a solution. I know the motor’s encoder or potentiometer is working because using commands like Herkulex.moveOneAngle(n,90,150,LED_BLUE) move the servo to exactly 90 degrees.

Hopefully someone with more experience with these motors can help.

Herkulex Manual: http://www.hovis.co.kr/guide/herkulexeng.pdf

Continuing to peck away at the Herkulex servo and library. New discovery shows that feedback works ONLY at 115200 bps!

I switched my board over to a Arduino Mega and was able to get position,angle, and speed.

Unfortunately for my application I was very set on using the Arduino FIO due to the size and wireless built in radio. Is it possible that the library is not correct for using a lower baud rate? What could cause this issue?

I also tried to use software serial on the FIO at 115200 baud but it was unsuccessful (too fast?)

Hopefully someone would like to help on this one, any insight could be helpful here.

Thanks!

Here is a link to the library: http://freetexthost.com/zkc3dgvevc

And here is part of the GetPosition function C file:

// get Position
 int HerkulexClass::getPosition(int servoID) {
	int Position  = 0;

    pSize = 0x09;               // 3.Packet size 7-58
	pID   = servoID;     	    // 4. Servo ID - 253=all servos
	cmd   = HRAMREAD;           // 5. CMD
	data[0]=0x3A;               // 8. Address
	data[1]=0x02;               // 9. Lenght
	
	lenghtString=2;             // lenghtData
  	
	ck1=checksum1(data,lenghtString);	//6. Checksum1
	ck2=checksum2(ck1);					//7. Checksum2

	dataEx[0] = 0xFF;			// Packet Header
	dataEx[1] = 0xFF;			// Packet Header	
	dataEx[2] = pSize;	 		// Packet Size
	dataEx[3] = pID;			// Servo ID
	dataEx[4] = cmd;			// Command Ram Write
	dataEx[5] = ck1;			// Checksum 1
	dataEx[6] = ck2;			// Checksum 2
	dataEx[7] = data[0];      	// Address  
	dataEx[8] = data[1]; 		// Length
	
	sendData(dataEx, pSize);

    delay(1);
	readData(13);

        	
	pSize = dataEx[2];           // 3.Packet size 7-58
	pID   = dataEx[3];           // 4. Servo ID
	cmd   = dataEx[4];           // 5. CMD
	data[0]=dataEx[7];
    data[1]=dataEx[8];
    data[2]=dataEx[9];
    data[3]=dataEx[10];
    data[4]=dataEx[11];
    data[5]=dataEx[12];
    lenghtString=6;

    ck1=checksum1(data,lenghtString);	//6. Checksum1
	ck2=checksum2(ck1);					//7. Checksum2

    if (ck1 != dataEx[5]) return -1;
	if (ck2 != dataEx[6]) return -1;

	Position = ((dataEx[10]&0x03)<<8) | dataEx[9];
        return Position;
	
}