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:
2:971b320e1e8b
Parent:
1:874d1f42989c
Child:
3:3aa495712025
--- a/herkulex.h	Mon Jan 14 06:46:31 2013 +0000
+++ b/herkulex.h	Mon Jan 14 07:12:46 2013 +0000
@@ -178,7 +178,7 @@
 
 // Torque CMD
 #define TORQUE_FREE                         0x00
-#define BREAK ON                            0x40
+#define BREAK_ON                            0x40
 #define TORQUE_ON                           0x60
 
 // Register Size
@@ -200,18 +200,50 @@
 {
 public:
 
+    /** Create an Herkulex servo object connected to the serial pins and baudrate
+     *
+     * @param tx Transmit pin.
+     * @param rx Receive pin. 
+     * @param baudRate The serial tx/rx speed. 
+     */
     Herkulex(PinName tx, PinName rx, uint32_t baudRate);
+    
+    /** Destroy an Herkulex servo object
+     */
     ~Herkulex(); 
 
+    /** Transmit packet datas
+     *        
+     * @param packetSize The packet size.
+     * @param data The transmit packet data array.
+     */  
     void txPacket(uint8_t packetSize, uint8_t* data);
     
+    /** 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)
+     */      
     void setTorque(uint8_t id, uint8_t cmdTorue);
     
+    /** move position
+     *        
+     * @param id The herkulex servo ID.
+     * @param pos 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);
             
 private :
 
+    /** PC serial connection used in debug mode.
+    */
     Serial *pc;
+    
+    /** Serial connection (mbed <-> herkulex).
+    */  
     Serial *txd, *rxd;
 };