herkulex servo control library

Dependents:   HerkuleX-HelloWorld

This herkulex library is based on DongBu Robot documentation and protocol.

http://dasarobot.com/guide/herkulexeng.pdf

/media/uploads/passionvirus/mbedandherkulex_i.png /media/uploads/passionvirus/range.png

Revision:
5:f737e5c70115
Parent:
4:e6873d42df32
Child:
6:1dacff31b77a
--- a/herkulex.h	Mon Jan 14 07:25:00 2013 +0000
+++ b/herkulex.h	Mon Jan 14 16:24:05 2013 +0000
@@ -186,12 +186,12 @@
 #define BYTE2                               2
 
 // Jog Set CMD
-#define SET_STOP                            0x01
-#define SET_MODE_POS                        0x00
-#define SET_MODE_TURN                       0x02
-#define SET_LED_GREEN_ON                    0x04
-#define SET_LED_BLUE_ON                     0x08
-#define SET_LED_RED_ON                      0x10
+#define STOP                                0x01
+#define POS_MODE                            0x00
+#define TURN_MODE                           0x02
+#define GLED_ON                             0x04
+#define BLED_ON                             0x08
+#define RLED_ON                             0x10
 
 //------------------------------------------------------------------------------
 /** herkulex Servo control class, based packet protocol on a serial
@@ -245,7 +245,13 @@
      */  
     void txPacket(uint8_t packetSize, uint8_t* data);
     
-    /** Set Torque setting
+    /** Clear error status
+     *        
+     * @param id The herkulex servo ID.
+     */      
+     void clear(uint8_t id);
+    
+    /** Set torque setting
      *        
      * @param id The herkulex servo ID.
      * @param cmdTorue The Command for setting of torque (TORQUE_FREE 0x00,BREAK_ON 0x40, TORQUE_ON 0x60)
@@ -255,13 +261,21 @@
     /** move position
      *        
      * @param id The herkulex servo ID.
-     * @param pos The goal position of herkulex servo.
+     * @param position The goal position of herkulex servo.
      * @param playtime Time to target position.
-     * @param setMode The mode of position control or infinite turn (SET_MODE_POS 0x00, SET_MODE_TURN 0x02)
      * @param setLED Select LED and on/off controll (SET_LED_GREEN_ON 0x00,SET_LED_BLUE_ON 0x08, SET_LED_RED_ON 0x10)
      */          
-    void movePos(uint8_t id, uint16_t pos, uint8_t playtime, uint8_t setMode, uint8_t setLED);
-            
+    void movePos(uint8_t id, uint16_t position, uint8_t playtime, uint8_t setLED);
+
+    /** turn
+     *        
+     * @param id The herkulex servo ID.
+     * @param speed The goal position of herkulex servo.
+     * @param setLED Select LED and on/off controll (SET_LED_GREEN_ON 0x00,SET_LED_BLUE_ON 0x08, SET_LED_RED_ON 0x10)
+     */             
+    void turn(uint8_t id, int16_t speed,uint8_t setLED);
+    
+         
 private :
 
     /** PC serial connection used in debug mode.