Hi guys, I'm using a servo Dynamixel MX-64T and I'm having a problem in feedback position command or reading position and temperature.
I'm using the library Dynamixel_Serial - V2.0 at Google Code Archive - Long-term storage for Google Code Project Hosting.
I use Arduino 1.0.4 environment with Pololu Orangutan B-328 robot controller with connection to TX and RX.I have connected RX and TX together because MX-64T uses half duplex serial.
The VIN is 12 VDC regulated. Attached picture is the wiring. Using the example code that comes with the library :
#include <Dynamixel_Serial.h> // Library needed to control Dynamixal servo
#define SERVO_ID 0x01 // ID of which we will set Dynamixel too
#define SERVO_ControlPin 0x10 // Control pin of buffer chip, NOTE: this does not matter becasue we are not using a half to full contorl buffer.
#define SERVO_SET_Baudrate 57600 // Baud rate speed which the Dynamixel will be set too (57600)
#define LED13 0x0D // Pin of Visual indication for runing "heart beat" using onboard LED
#define TX_DEALY 2000 // in uSec
#define CW_LIMIT_ANGLE 0x001 // lowest clockwise angle is 1, as when set to 0 it set servo to wheel mode
#define CCW_LIMIT_ANGLE 0xFFF // Highest anit-clockwise angle is 0XFFF, as when set to 0 it set servo to wheel mode
void setup(){
delay(1000); // Give time for Dynamixel to start on power-up
Dynamixel.begin(SERVO_SET_Baudrate, SERVO_ControlPin, TX_DEALY); // We now need to set Ardiuno to the new Baudrate speed
Dynamixel.setMode(SERVO_ID, SERVO, CW_LIMIT_ANGLE, CCW_LIMIT_ANGLE); // set mode to SERVO and set angle limits
}
void loop(){
Dynamixel.servo(SERVO_ID,0x001,0x100); // Move servo to angle 1(0.088 degree) at speed 100
delay(4000);
Dynamixel.servo(SERVO_ID,0xFFF,0x3FF); // Move servo to max angle at max speed
delay(4000);
}
This works fine.The servo moves to the specified position every 4s.
The problem is when I tried to receive feedback from the servo. Based on this thread
http://arduino.cc/forum/index.php/topic,116011.0.html
I tried using the Dynamixel.readPosition(SERVO_ID);
#include <Dynamixel_Serial.h> // Library needed to control Dynamixal servo
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4 , 7); // RX, TX
int Position;
#define SERVO_ID 0x01 // ID of which we will set Dynamixel too
#define SERVO_ControlPin 0x10 // Control pin of buffer chip, NOTE: this does not matter becasue we are not using a half to full contorl buffer.
#define SERVO_SET_Baudrate 57600 // Baud rate speed which the Dynamixel will be set too (57600)
#define LED13 0x0D // Pin of Visual indication for runing "heart beat" using onboard LED
#define TX_DEALY 2000 // in uSec
#define CW_LIMIT_ANGLE 0x001 // lowest clockwise angle is 1, as when set to 0 it set servo to wheel mode
#define CCW_LIMIT_ANGLE 0xFFF // Highest anit-clockwise angle is 0XFFF, as when set to 0 it set servo to wheel mode
void setup(){
mySerial.begin(57600);
delay(1000); // Give time for Dynamixel to start on power-up
Dynamixel.begin(SERVO_SET_Baudrate, SERVO_ControlPin, TX_DEALY); // We now need to set Ardiuno to the new Baudrate speed
Dynamixel.setMode(SERVO_ID, SERVO, CW_LIMIT_ANGLE, CCW_LIMIT_ANGLE); // set mode to SERVO and set angle limits
}
void loop(){
Dynamixel.servo(SERVO_ID,0x001,0x100); // Move servo to angle 1(0.088 degree) at speed 100
delay(3000);
Position = Dynamixel.readPosition(SERVO_ID);
mySerial.print(Position);
delay(1000);
Dynamixel.servo(SERVO_ID,0xFFF,0x3FF); // Move servo to max angle at max speed
delay(3000);
Position = Dynamixel.readPosition(SERVO_ID);
mySerial.print(Position);
delay(1000);
}
I use Arduino 1.0.4 with the serial monitor for the incoming mySerial feedback. I always get value 3968 no matter the position. I have also tried Dynamixel.readTemperature with no correct results. Just to eliminate other potential problems, I have double checked mySerial UART and it works fine for other applications.
I'm not sure if Im getting the correct results.Im also unsure about the wiring and using the read function correctly.I greatly appreciate any help to get me in the right direction.