DXL_SDK_For_F446RE. Now test with MX64AR, MX28AR with 1Mbps

Dependents:   RoboticArm DXL_SDK_Porting_Test

Committer:
stanley1228
Date:
Wed Feb 08 15:49:35 2017 +0800
Revision:
4:44560391db99
Parent:
3:e2e9064c668d
Child:
5:edccfcb47ab8
add ROM parameter setting to limit torque=55,multiturn offset=-1024,multiturn mode

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stanley1228 0:bf4774b25188 1 // Dynamixel SDK platform independent header
stanley1228 0:bf4774b25188 2 #ifndef _DYNAMIXEL_HEADER
stanley1228 0:bf4774b25188 3 #define _DYNAMIXEL_HEADER
stanley1228 0:bf4774b25188 4
stanley1228 0:bf4774b25188 5
stanley1228 0:bf4774b25188 6 #ifdef __cplusplus
stanley1228 0:bf4774b25188 7 extern "C" {
stanley1228 0:bf4774b25188 8 #endif
stanley1228 0:bf4774b25188 9
stanley1228 0:bf4774b25188 10
stanley1228 0:bf4774b25188 11 ///////////// device control methods ////////////////////////
stanley1228 0:bf4774b25188 12 int dxl_initialize( int devIndex, int baudnum );
stanley1228 0:bf4774b25188 13 void dxl_terminate(void);
stanley1228 0:bf4774b25188 14
stanley1228 0:bf4774b25188 15
stanley1228 0:bf4774b25188 16 ///////////// set/get packet methods //////////////////////////
stanley1228 0:bf4774b25188 17 void dxl_set_txpacket_id( int id );
stanley1228 0:bf4774b25188 18 #define BROADCAST_ID (254)
stanley1228 0:bf4774b25188 19
stanley1228 0:bf4774b25188 20 void dxl_set_txpacket_instruction( int instruction );
stanley1228 0:bf4774b25188 21 #define INST_PING (1)
stanley1228 0:bf4774b25188 22 #define INST_READ (2)
stanley1228 0:bf4774b25188 23 #define INST_WRITE (3)
stanley1228 0:bf4774b25188 24 #define INST_REG_WRITE (4)
stanley1228 0:bf4774b25188 25 #define INST_ACTION (5)
stanley1228 0:bf4774b25188 26 #define INST_RESET (6)
stanley1228 0:bf4774b25188 27 #define INST_SYNC_WRITE (131)
stanley1228 0:bf4774b25188 28
stanley1228 0:bf4774b25188 29 #define MAXNUM_TXPARAM (150)
stanley1228 0:bf4774b25188 30 void dxl_set_txpacket_parameter( int index, int value );
stanley1228 0:bf4774b25188 31 void dxl_set_txpacket_length( int length );
stanley1228 0:bf4774b25188 32
stanley1228 0:bf4774b25188 33 int dxl_get_rxpacket_error( int errbit );
stanley1228 0:bf4774b25188 34 #define ERRBIT_VOLTAGE (1)
stanley1228 0:bf4774b25188 35 #define ERRBIT_ANGLE (2)
stanley1228 0:bf4774b25188 36 #define ERRBIT_OVERHEAT (4)
stanley1228 0:bf4774b25188 37 #define ERRBIT_RANGE (8)
stanley1228 0:bf4774b25188 38 #define ERRBIT_CHECKSUM (16)
stanley1228 0:bf4774b25188 39 #define ERRBIT_OVERLOAD (32)
stanley1228 0:bf4774b25188 40 #define ERRBIT_INSTRUCTION (64)
stanley1228 0:bf4774b25188 41
stanley1228 0:bf4774b25188 42 #define MAXNUM_RXPARAM (60)
stanley1228 0:bf4774b25188 43 int dxl_get_rxpacket_parameter( int index );
stanley1228 0:bf4774b25188 44 int dxl_get_rxpacket_length(void);
stanley1228 0:bf4774b25188 45
stanley1228 0:bf4774b25188 46 // utility for value
stanley1228 0:bf4774b25188 47 int dxl_makeword( int lowbyte, int highbyte );
stanley1228 0:bf4774b25188 48 int dxl_get_lowbyte( int word );
stanley1228 0:bf4774b25188 49 int dxl_get_highbyte( int word );
stanley1228 0:bf4774b25188 50
stanley1228 0:bf4774b25188 51
stanley1228 0:bf4774b25188 52 ////////// packet communication methods ///////////////////////
stanley1228 0:bf4774b25188 53 void dxl_tx_packet(void);
stanley1228 0:bf4774b25188 54 void dxl_rx_packet(void);
stanley1228 0:bf4774b25188 55 void dxl_txrx_packet(void);
stanley1228 0:bf4774b25188 56
stanley1228 0:bf4774b25188 57 int dxl_get_result(void);
stanley1228 0:bf4774b25188 58 #define COMM_TXSUCCESS (0)
stanley1228 0:bf4774b25188 59 #define COMM_RXSUCCESS (1)
stanley1228 0:bf4774b25188 60 #define COMM_TXFAIL (2)
stanley1228 0:bf4774b25188 61 #define COMM_RXFAIL (3)
stanley1228 0:bf4774b25188 62 #define COMM_TXERROR (4)
stanley1228 0:bf4774b25188 63 #define COMM_RXWAITING (5)
stanley1228 0:bf4774b25188 64 #define COMM_RXTIMEOUT (6)
stanley1228 0:bf4774b25188 65 #define COMM_RXCORRUPT (7)
stanley1228 0:bf4774b25188 66
stanley1228 0:bf4774b25188 67
stanley1228 0:bf4774b25188 68 //MX64 Register stanley///
stanley1228 4:44560391db99 69 #define ID_ADDRESS 3
stanley1228 0:bf4774b25188 70 #define GOAL_POSITION 30
stanley1228 0:bf4774b25188 71 #define PRESENT_POS 36
stanley1228 4:44560391db99 72 #define RETURN_DELAY_TIME 5
stanley1228 0:bf4774b25188 73 #define CW_ANGLE_LIMIT_L 6
stanley1228 0:bf4774b25188 74 #define CW_ANGLE_LIMIT_H 7
stanley1228 0:bf4774b25188 75 #define CCW_ANGLE_LIMIT_L 8
stanley1228 0:bf4774b25188 76 #define CCW_ANGLE_LIMIT_H 9
stanley1228 4:44560391db99 77 #define MAX_TORQUE 14
stanley1228 4:44560391db99 78 #define MULTITURN_OFFSET 20
stanley1228 3:e2e9064c668d 79 #define GOAL_POSITION 30
stanley1228 4:44560391db99 80 #define GOAL_SPEED 32
stanley1228 4:44560391db99 81 #define TORQUE_LIMIT 34
stanley1228 3:e2e9064c668d 82 #define PRESENT_POS 36
stanley1228 4:44560391db99 83
stanley1228 4:44560391db99 84 #define STILL_MOVING 46
stanley1228 4:44560391db99 85
stanley1228 4:44560391db99 86
stanley1228 4:44560391db99 87 #define ADDRESS_LED 25
stanley1228 0:bf4774b25188 88
stanley1228 0:bf4774b25188 89
stanley1228 0:bf4774b25188 90 //////////// high communication methods ///////////////////////
stanley1228 0:bf4774b25188 91 void dxl_ping( int id );
stanley1228 0:bf4774b25188 92 int dxl_read_byte( int id, int address );
stanley1228 0:bf4774b25188 93 void dxl_write_byte( int id, int address, int value );
stanley1228 4:44560391db99 94 int dxl_read_word( short int id, short int address );
stanley1228 4:44560391db99 95 void dxl_write_word( short int id, short int address, short int value );
stanley1228 3:e2e9064c668d 96 int syncWrite_u16base(short int start_addr, short int data_length, short int *param, short int param_length); // WORD(16bit) syncwrite() for DXL
stanley1228 0:bf4774b25188 97 void setPosition(int ServoID, int Position, int Speed);//stanley
stanley1228 0:bf4774b25188 98
stanley1228 0:bf4774b25188 99
stanley1228 0:bf4774b25188 100
stanley1228 0:bf4774b25188 101
stanley1228 0:bf4774b25188 102
stanley1228 0:bf4774b25188 103 #ifdef __cplusplus
stanley1228 0:bf4774b25188 104 }
stanley1228 0:bf4774b25188 105 #endif
stanley1228 0:bf4774b25188 106
stanley1228 0:bf4774b25188 107 #endif