Shop OBEX P1 Docs P2 Docs Learn Events
Anyone using the Dynamixel AX12A servo?? — Parallax Forums

Anyone using the Dynamixel AX12A servo??

w4fejw4fej Posts: 264
edited 2014-02-17 05:58 in Propeller 1
I just ordered the AX12A but haven't received it yet.

I will be using the AX12A to turn the rudder on a large R/C project boat. I will be using the AX12A to drive the rudder through a 7.2:1 belt drive. I know you can read the position of the servo in servo mode at any time. If the servo is in continuous rotation mode can I still read the position on the fly?? Can I do something like determine when the servo has turned say 665 degrees?? 665 degrees works out to be about 1894 counts if I am able to get info that while its turning. I see in the object in the OBEX (God,I love that place!) that the position data is 0-1023 for one direction and 1024-2048 for the other direction..

Anybody ventured into this area of the AX12A ??

Thanks, Mike B.

Comments

  • PublisonPublison Posts: 12,366
    edited 2014-02-16 07:54
    w4fej wrote: »
    I just ordered the AX12A but haven't received it yet.

    I will be using the AX12A to turn the rudder on a large R/C project boat. I will be using the AX12A to drive the rudder through a 7.2:1 belt drive. I know you can read the position of the servo in servo mode at any time. If the servo is in continuous rotation mode can I still read the position on the fly?? Can I do something like determine when the servo has turned say 665 degrees?? 665 degrees works out to be about 1894 counts if I am able to get info that while its turning. I see in the object in the OBEX (God,I love that place!) that the position data is 0-1023 for one direction and 1024-2048 for the other direction..

    Anybody ventured into this area of the AX12A ??

    Thanks, Mike B.

    I'm thinking not based on this document:

    http://support.robotis.com/en/product/dynamixel/ax_series/dxl_ax_actuator.htm
    Present Position

    Caution: If it is set to Wheel Mode, the value cannot be used to measure the moving distance and the rotation frequency.

    That's my take on it.
  • ratronicratronic Posts: 1,451
    edited 2014-02-16 08:20
    You can not track the servo properly in continues rotation mode.
  • ratronicratronic Posts: 1,451
    edited 2014-02-16 08:42
    The servos get position from a pot and on the course of rotating it has a dead spot that sometimes returns odd #'s. When you get your servo they usually come out of the package set for ID#1 and 1m baud rate. Here is a program that sets servo ID#1 to continuos rotation

    then monitors the servo position on the serial terminal.
    Con                  
                                                               
      _CLKMODE = XTAL1 + PLL16X                              
      _XINFREQ = 5_000_000
    
    Var
      
        
    Obj
    
      pst : "parallax serial terminal"
      dyn : "dynacomv4"
                             
    Pub Main | i
      dyn.start(0, 1_000_000)
      
      pst.start(115_200)
      
      dyn.setcontinrotation(1)
      
      dyn.setsrvspd(1, 500)
      
      repeat
        pst.char(pst#HM)
        pst.dec(dyn.getsrvpos(1))
        pst.char(pst#CE)
        pst.char(pst#NL)
    
  • JonnyMacJonnyMac Posts: 8,927
    edited 2014-02-16 08:53
    I am -- on an animatronics project with a friend. I've attached a link to the code for my Spin Zone column in Nuts & Volts magazine.

    -- http://www.nutsvolts.com/index.php?/magazine/article/november2013_spinzone
  • w4fejw4fej Posts: 264
    edited 2014-02-16 15:58
    JonnyMac wrote: »
    I am -- on an animatronics project with a friend. I've attached a link to the code for my Spin Zone column in Nuts & Volts magazine.

    -- http://www.nutsvolts.com/index.php?/magazine/article/november2013_spinzone

    Very interesting article Jon. (It got me to subscribe to the mag!). Looks like I may have been too quick on ordering the AX12a. Guess it's back to some other method of determining the rudders position.. Was really hoping the device would do the trick.. Maybe continuous rotation with limit detection. we'll figure something out...

    Mike B.
  • JonnyMacJonnyMac Posts: 8,927
    edited 2014-02-16 19:24
    For a rudder to you need 360 degrees of rotation? The device, in servo mode, will give you 300.
  • w4fejw4fej Posts: 264
    edited 2014-02-17 05:58
    JonnyMac wrote: »
    For a rudder do you need 360 degrees of rotation? The device, in servo mode, will give you 300.

    Nope, the rudder only needs say 40-45 degrees left/right. I originally was going to use a 72 tooth cog belt pulley driven by a 10 tooth pinion gear driven by a small geared motor. Then the question became positional feedback at which time someone suggested the AX12A and I said, OK, position problem solved. Thinking I would simply substitute the servo for the geared motor I would run the servo in continuous rotation mode. Can't get the information in that mode. Then your comment (quote above) got me thinking back to my R/C days and came to the realization that why not try the simple push-pull linkage system used in R/C planes??

    Now the only question is if the servo is going to have enough torque to turn the rudder. Oh, a little background. The "rudder" is actually a trolling motor for a real people carrying boat. The trolling motor originally came with a small geared motor and handily turned the motor no problem, so I am keeping my fingers crossed the AX12A has the stones to turn the motor, if so I'm home free.

    Some times you simply can't see the forest through all those darned trees !!

    By the way, do you have a Spin column every month in N&V ??

    Mike B.
  • Sorry to resurrect and old thread but it contains everything I'm working on.

    I have an MX-28T and a AX-12A that aren't playing nicely. I have tried both the N-Channel MOSFET (HRF3205) and the 1k/10k method of connecting the Propeller IO pin to the servos. I read JonnyMac's N&V article and have a good understanding of how these servos work. I'm using external power for the servos, Propeller Protoboard and have a scope attached to the signal pin.

    I've tried reading the position test that always returns "0". When I run JM's pan tilt demo nothing displays on PST. The datasheet packet structure, commands and registers all seem to line up with the code so I don't think anything related to the object changed. Any ideas?
  • xanaduxanadu Posts: 3,347
    edited 2016-05-06 23:58
    The AX-12A was fine, I'm not sure why I couldn't get it to work originally but it worked the next day.

    The MX-28T I ordered was bad. I ended up spending $50 on the stupid USB programmer to verify that, and then mailed it to Robotis RMA.

    I received the MX-28T from RMA and can confirm that the code in this thread works fine with it. There are a couple of minor changes due to the higher resolution of the encoder and 360 degree operation.

    Thanks a million for posting this code!
  • w4fej wrote: »
    JonnyMac wrote: »
    For a rudder do you need 360 degrees of rotation? The device, in servo mode, will give you 300.



    By the way, do you have a Spin column every month in N&V ??

    Mike B.

    I believe it is every other month.
  • Andy,

    That post was two years ago. :)
  • Wow, that's the second time this week I have posted to an old thread. My mind is not what it used to be.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2016-05-09 18:45
    xanadu wrote: »
    There are a couple of minor changes due to the higher resolution of the encoder and 360 degree operation.

    What changes did you try?

    I just changed the limits in a couple places. Does the attached code do what you want?

    Apparently I can only delete code. I can't replace it. I'll post a version with better comments in the next post.

  • I added comments stating this is a modified version of the original driver.
  • Thank you Duane. These actuators are a good deal considering you get 360 degree and absolute encoding down to less than 0.5 degrees. The used servos I purchased were bad, and Dynamixel fixed them for $8 each, another bonus if you're looking to purchase some for less than retail.

    I made sure to test the repaired MX-28T with the USB adapter to verify it is working and reading commands. All seems well there.

    I then used the Propeller code and it was able to read all 4096 positions, and that works great. I figured the communication was okay. Comparing the datasheets for the AX and the MX I see everything is the same except for the actual values, so I assumed I'd be able to change the following -

    Pub SetSrvPos, max value changed to 4095
    Pub WriteData, max value changed to 4095

    I didn't notice if you put in other changes, but I see you did the same. I also tried increasing the txbuffer. Using your modifications I ended up with the same result.

    In servo mode, it will move to a goal position unless the position is over 1024, then it either ignores the command, or moves to a goal position that doesn't match your request. I get about 90 degrees of movement at best.

    This does not work (no movement) you have to have a value under 1024 mixed in.
      repeat                
       dy.setsrvpos(1, 3000)
       waitcnt(clkfreq * 3 + cnt)                                                                           
       dy.setsrvpos(1, 2000)
       waitcnt(clkfreq * 3 + cnt) 
    

    This makes it move about 1 degree, so I'm assuming it is treating 3000 as 1023
      repeat                
       dy.setsrvpos(1, 3000)
       waitcnt(clkfreq * 3 + cnt)                                                                           
       dy.setsrvpos(1, 1018)
       waitcnt(clkfreq * 3 + cnt) 
    

    This makes it move 90 degrees all day, the accuracy is unreal.
      repeat                
       dy.setsrvpos(1, 0)
       waitcnt(clkfreq * 3 + cnt)                                                                           
       dy.setsrvpos(1, 1023)
       waitcnt(clkfreq * 3 + cnt)
    

    This makes it move 90 degrees, just like above, so I'm pretty sure it is ignoring values over 1023.
      repeat                
       dy.setsrvpos(1, 0)
       waitcnt(clkfreq * 3 + cnt)                                                                           
       dy.setsrvpos(1, 2500)
       waitcnt(clkfreq * 3 + cnt)
    



  • I think it's this -
    Pub SetServoMode(id)                                    'set servo back to servo mode from continuous rotation for servo id#
                                                            'example use - dy.setservomode(1)  -  set servo id# '1' to servo mode
      writedata(id, 6, 0)
      writedata(id, 8, $3ff)
    

    http://support.robotis.com/en/product/dynamixel/mx_series/mx-28.htm#Actuator_Address_06

    Apparently setting servo mode also sets limits on travel. Unfortunately, I cannot test this theory until later today.
  • xanaduxanadu Posts: 3,347
    edited 2016-05-09 21:08
    $3ff = 1023, that has to be it, along with your other modifications I think we got this. $fff = 4095, so change the $3ff to $fff

    Change
    Pub SetServoMode(id)                                    'set servo back to servo mode from continuous rotation for servo id#
                                                            'example use - dy.setservomode(1)  -  set servo id# '1' to servo mode
      writedata(id, 6, 0)
      writedata(id, 8, $fff)  
    

    I suppose this would also need to be changed in Pub SetServoModeAll.

    Actually the best thing to do would be adding separate methods, that way the driver works for both the AX and MX at the same time, which is what I am trying to accomplish.

    The MX is a pan servo, and the AX is tilt.
  • That was it. It works now. Thanks for the help!

    Using the attached you can have both AX-12A and MX-28T on the same bus. There are separate commands for each.

Sign In or Register to comment.