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.
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));
}
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.
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.