Results 1 to 7 of 7

Thread: PID Control for Dynamixel servos using Arbotix-M

  1. PID Control for Dynamixel servos using Arbotix-M

    Hi all,

    I am currently working on a three joint robotic arm with MX64T,MX28T and AX12A used for joint 1, 2 and 3 respectively. I am using the Arbotix-M Robocontroller to control them.

    I am currently using the 'AX12.h' library for controlling the servos. I was just wondering if you can use the same library to change the P,I and D values in the MX-28 and MX64 using the Arbotix controller. Can I just directly write to the register of the servos? Also do I need to use a separate library for writing to the MX series?

    Any help will be greatly appreciated. Thanks.

  2. #2

    Re: PID Control for Dynamixel servos using Arbotix-M

    Yes, you can directly write to the registers of the servos.
    The MX series use the same TTL protocol as the AX series, but the register layout is slightly different.
    Check the manual for each of them to get the details:
    http://support.robotis.com/en/product/dxl_main.htm

  3. Re: PID Control for Dynamixel servos using Arbotix-M

    Quote Originally Posted by jwatte View Post
    Yes, you can directly write to the registers of the servos.
    The MX series use the same TTL protocol as the AX series, but the register layout is slightly different.
    Check the manual for each of them to get the details:
    http://support.robotis.com/en/product/dxl_main.htm
    Thank you for your reply.

    I have checked the register layout and I have been able to use the 'AX12.h' library for controlling the MX series servos. The P, I and D registers for MX series servos are 28, 27 and 26 respectively. On the 'AX12.h' library, they are defined as different registers for Compliance slope of the AX series servos. But if I writing to a specific register, does it matter how it is defined in the library?
    For example, this is how the P,I and D registers are stated in the AX12.h library.

    //
    #define AX_CW_COMPLIANCE_MARGIN 26
    #define AX_CCW_COMPLIANCE_MARGIN 27
    #define AX_CW_COMPLIANCE_SLOPE 28
    //

    Can I then still use the same library to write the PID values or do I need to use a different one or edit the defined registers myself?

    Any help will be greatly appreciated. Thanks.

  4. #4

    Re: PID Control for Dynamixel servos using Arbotix-M

    So as you found from the e-manual for the MX-28
    http://support.robotis.com/en/produc...ries/mx-28.htm

    P/I/D are at register 28/27/26

    The simplest way to set the values would be with set register (we'll assume servo ID 1 ans that we're setting all the PID values to they're default values of 32/0/0
    Code:
     ax12SetRegister(1, 28, 32) //set servo ID 1's register 28(P) to the value of 32
     ax12SetRegister(1, 27, 0) //set servo ID 1's register 27(I) to the value of 0
     ax12SetRegister(1, 26, 0) //set servo ID 1's register 26(D) to the value of 0

    Alternative, you could define P,I, and D registers

    Code:
    #define MX_P 28
    #define MX_I 27
    #define MX_D 26
    
    
    ax12SetRegister(1, MX_P , 32) //set servo ID 1's register 28(P) to the value of 32
    ax12SetRegister(1, MX_I , 0) //set servo ID 1's register 27(I) to the value of 0
    ax12SetRegister(1, MX_D , 0) //set servo ID 1's register 26(D) to the value of 0
    This will have the same effect as the first 3 lines of code, but might be easier to read.

    I've got some updates to the arbotix libraries in the works to better address some of the #define issues like this.

  5. #5

    Re: PID Control for Dynamixel servos using Arbotix-M

    if I writing to a specific register, does it matter how it is defined in the library?
    Not really, no. As long as the integer values are correct, the servo doesn't know what symbol the code is using.
    In fact, I could do this:

    Code:
    #define PIE_IS_DELICIOUS 28
    
    ax12SetRegister(1, PIE_IS_DELICIOUS, 32);
    As soon as the compiler sees "PIE_IS_DELICIOUS" it will replace it with the text 28, which gets turned into the integer value 28, which is what the ax12SetRegister actually uses to send data on the TTL bus. The servo will just see "set register 28 of servo id 1 to the value 32." (The exact rules for how a C/C++ compiler turns source code into machine code are somewhat complex, and something that a C/C++ programmer will eventually have to learn and memorize.)

    Also: Kyle's code, while great and helpful, is missing terminating semicolons from the calls to ax12SetRegister(), so it won't quite compile the way it is.

  6. Re: PID Control for Dynamixel servos using Arbotix-M

    Thank you both for the help.

    I also wanted to query if it is possible to adjust the P,I and D values for the AX-12A. There is no specific register dedicated for it, but is there any way around it? Can the compliance registers be used for this purpose?

  7. #7
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,313
    Images
    27
    Rep Power
    278

    Re: PID Control for Dynamixel servos using Arbotix-M

    Only the MX servos, and I think the XL-320, have PID control. AX, RX, DX, EX all use a simpler and purely proportional controller (compliance slope, compliance margin, and punch as described in the Robotis documentation). Punch is minimum attempted driving PWM; margin is how close to the goal position where the algorithm will say 'good enough'; slope is the number of encoder ticks over which the driving PWM will change from minimum (punch) to maximum (torque limit). Punch is generally never changed. Margin affects how 'loose' the servo is in attempting to hold a goal position (larger margin requires greater deviation from goal position to get any response). Slope affects how 'soft' the servo is in attempting to hold a goal position (larger slope means slower change in driving PWM value in response to deviation from goal position beyond the margin).
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    [git][mech][hack]
    gives free advice only on public threads

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How do I control Dynamixel servos using Arduino from python code?
    By OOrmOnIzArGoR in forum Arbotix, Microcontrollers, Arduino
    Replies: 4
    Last Post: 12-04-2014, 08:36 AM
  2. 18 Dynamixel Ax-12A with ArbotiX/Arduino - How to connect the dynamixel?
    By Snuuq in forum Arbotix, Microcontrollers, Arduino
    Replies: 20
    Last Post: 02-14-2014, 11:29 AM
  3. Question(s) EX-106 servos with arbotix
    By tduv in forum Robotics General Discussion
    Replies: 14
    Last Post: 05-29-2012, 01:57 PM
  4. Question(s) EX-106 servos with arbotix
    By tduv in forum Project Showcase
    Replies: 0
    Last Post: 05-26-2012, 12:50 PM
  5. Question(s) Wheels for Dynamixel Servos
    By SamQ in forum DYNAMIXEL & Robot Actuators
    Replies: 1
    Last Post: 07-27-2011, 07:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •