New dynamixel ax12+ servo driver object 'dynacom'
ratronic
Posts: 1,451
I just submitted this to the object exchange. It is a driver object to use with dynamixel ax12+ digital servos up to 1megabit connection rate. These guys are pretty neat - they have over 200 oz/inch torque and provide feedback for current position, voltage, temperature and other things. Attached is a video showing the arm I am using it with and a spin program 'dyna-arm' that uses just some of it. If anyone has a problem with the program,·let me know.
Edit : Updated to version DynacomV3.spin 10/6/11. You can now change the baud rate for the dynamixels. It now allows using continuous rotation mode. When using the writedata method to write to a 2 byte control register i.e. goal position, moving speed, etc. write the value (up to 11bits) to the first byte address of the 2 byte control register and the program will write the low/high bytes for you. Also updated the example use file to give examples of using the methods.
Edit2: 9/10/13 added version 4 now returns directional torq, can set servos between servo and continuous rotation modes
http://www.youtube.com/watch?v=4gsbQlyYEx4
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
Post Edited (ratronic) : 6/9/2010 2:25:40 PM GMT
Edit : Updated to version DynacomV3.spin 10/6/11. You can now change the baud rate for the dynamixels. It now allows using continuous rotation mode. When using the writedata method to write to a 2 byte control register i.e. goal position, moving speed, etc. write the value (up to 11bits) to the first byte address of the 2 byte control register and the program will write the low/high bytes for you. Also updated the example use file to give examples of using the methods.
Edit2: 9/10/13 added version 4 now returns directional torq, can set servos between servo and continuous rotation modes
http://www.youtube.com/watch?v=4gsbQlyYEx4
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
Post Edited (ratronic) : 6/9/2010 2:25:40 PM GMT
Comments
One observation. The CD_LTC1298 object was not included in the attachments. It only took me a minute to find in in the Object Excahange. I made an attachment with all objects included for those that are OBEX challanged.
Jim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
This PASM driver will handle all the Dynamixel baud settings.
Post Edited (Mike G) : 5/5/2010 5:13:53 PM GMT
edit: sorry Mike I didn't realize that was you! Thank you for the dynabus code that I followed to make this. I'm not sure why anybody would want to use a slower baud rate.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
Post Edited (ratronic) : 5/5/2010 6:12:22 PM GMT
Edit: People want to use a lower baud because the AX-12 allows for different baud rates. It makes the Propeller a more useful AX-12 tool. Just a suggestion
Post Edited (Mike G) : 5/5/2010 6:21:49 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
If you want to do it on the fly, then create a method that gets/sets the baud value in HUB memory. Read the memory location into you PASM code.
There's the the brute force method. Send the reset instruction using the broadcast ID at all possible baud rates.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
Post Edited (ratronic) : 5/5/2010 8:52:58 PM GMT
Do you have any unit test code that highlights the problem?
Post Edited (Mike G) : 5/5/2010 11:12:46 PM GMT
here are the two examples that do the same thing - both turn off the torq for servo 1 and then keep up dating the screen with it's current position using prop i/o #8
dynabus
dBus.Start(8, 1_000_000)····························
bytearray[noparse][[/noparse]0] := 0·················
writedata(1, 24, 1)···············
repeat····························
· readdata(1,36,2)················
· tv.out(1)·······················
· l := dbus.getaxbuffer(5)········
· h := dbus.getaxbuffer(6)········
· n := h * 256 + l················
· tv.dec(n)·······················
· tv.str(string("·· "))
dynacom
········
dy.start(8)··························
dy.srvtqoff(1)·············
repeat·····················
· tv.out(1)················
· tv.dec(dy.getsrvpos(1))··
· tv.str(string("·· "))····
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
Post Edited (ratronic) : 5/6/2010 1:01:04 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
Post Edited (ratronic) : 5/6/2010 12:55:33 PM GMT
Why are you using the old DynamixelAsmBus driver (4/2008) and not the December 2009 build?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
Post Edited (ratronic) : 6/9/2010 2:18:28 PM GMT
Dave, I assume you mean the baud can be set anywhere from 7,843bps to 1M.· 7843k would be pretty fast.
Thanks for the objects, I'll try them soon.· I have a bunch of AX-12s in a robot arm I want use in my chemistry work; these objects·should help.
Duane Degn
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
writedata(1, 33, 1)
and this
writedata(1,32, 1024) (thinking it would fill the first byte at full speed and then change the next bit in # 33)
both don't work.
Help?
Edit: I removed the limitation on the writedata method to write a number bigger than 1023. I know a byte is limited to 255 but because of the communication of the prop to the ax12 you can write a 11bit # to the lowest byte in the two byte control registers in my program. Also the ax12 requires both the low and high bytes communicated to it in a single packet on the communication side of things so you can't write to the high byte by itself in the two byte control registers.
Example: if the dynacom object is named dy - dy.writedata(1, 32, 2000) - that will set servo id#1 register's 32 and 33 to 2000 almost full speed clockwise.
I posted the code a while back but I thought I'd share a link to it here in case anyone else has the same problem.
It's also relatively easy to change the baud and/or ID using the object. I think in Dave's code you can only have one AX-12+ connected when you change its ID (which is a good idea to keep code small). My code asks for the old ID and only changes the one controller's ID. The object is intented as untility and is only useful when the Propeller in connected with a PC to interface with it. You wouldn't want all these seldomly used features to blot your robot's code.
Thanks again Dave and Mike.
Duane
The code I linked to tries to ping to the AX-12 on each baud rate. The AX-12 will answer a ping on the wrong (but close) baud sometimes so I also check register 4 to see if the baud pinged with is really its correct baud. I think your reset idea is probably better in many cases; I didn't want to go that route since I was curious what the settings were and, as I mentioned, it's possible to communicate with the AX-12 with the wrong rate so I wouldn't have been sure what it had been set to if I had sent a reset command.
I also modified your smartarmmouse object to use with a RC controller. It's a lot fun. Thanks for that program too. I think your smartarmmouse (which is great as is) could be even better with some ramping. I haven't tried ramping with my arm yet but I have a camera mount and I made the speed of the AX-12 proportional to it distance to the target position. I thought it smoothed the movement a lot. It takes an extra cog to continously montitor position and update the speed. One of these days I'm going to try some thing like that with my robot arm (I think I have the same kind you have).
Duane
Edit: this is for when the baudrate and or ID is unknown