Canada
Asked — Edited

Communicating With A Dynamixel Servo

Today is the first time I really had a chance to play with the EZB-4. I've connected a Dynamixel servos and had mixed results. The resolution is 0 to 170 but the servos are unresponsive from 81 to 89 for some reason.

I tried communicating with the servos with EZ script using UART 2 with no luck.

I'm using the communication protocol for the servos. This works with Python through a serial connection.

UARTInit(0,1,1000000)

$AX_Write_Data=3 #Dynamixel Instruction Code $AX_ID=14 #Servo ID $length=7
$table=30 #this is the entry code for setting the goal position of the servo

$position=100 #set goal position for servo

$speed=20 #set the speed of the servo

$MSB=Round($position/256,0) $LSB=$position%256 $MSB2=Round($Speed/256,0) $LSB2=$Speed%256

$checksum= 255-(($AX_ID+$length+$AX_Write_Data+$table+$MSB+$LSB+$MSB2+$LSB2)%256)

$handshake=GetAsByte(255) $AX_ID=GetAsByte(14) $length=GetAsByte(5) $AX_Write_Data=GetAsByte($AX_Write_Data) $table=GetAsByte($table) $LSB=GetAsByte($LSB) $MSB=GetAsByte($MSB) $LSB2=GetAsByte($LSB2) $MSB2=GetAsByte($MSB2) $checksum=GetAsByte($checksum)

UARTWrite(0,1,$handshake) UARTWrite(0,1,$handshake) UARTWrite(0,1,$AX_ID) UARTWrite(0,1,$AX_Write_Data) UARTWrite(0,1,$table) UARTWrite(0,1,$LSB) UARTWrite(0,1,$MSB) UARTWrite(0,1,$LSB2) UARTWrite(0,1,$MSB2) UARTWrite(0,1,$checksum)

Thanks


ARC Pro

Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.

PRO
Synthiam
#9  

Robert, I am able to communicate with UART2 and Dynamixel at the same time without any issues. Here is my example that I just used with success...

As you can see, I initialize UART 2 at 9600. I then write the word "Banana" to UART2 on every loop. The Dynamixels work great:)


uartinit(0, 2, 9600)

:loop

uartwrite(0, 2, "bannaa")

$position = 50

goto(SetPosition)

sleep(1000)

$position = 100

goto(SetPosition)

sleep(1000)

goto(loop)



:setPosition

servo(ax7, $position)

servo(ax4, $position)

servo(ax5, $position)

servo(ax6, $position)

servo(ax3, $position)

servo(ax18, $position)

return

#10  

Thanks DJ , I'll have to wait for tomorrow to try it out.

#11  

It works, no more dead spots, yay !

Now I don't want to be a pain in the butt. The torque release and enable for the dynamixel is instruction code 24. To have the servo send it's present position is instruction code 36 but you would have to receive data from the servo from UART port D6.

Thanks DJ

PRO
Synthiam
#12  

One day we will add a way to receive data - but right now it's not our highest priority due to supporting Revolution:)

As for Torque Release, I will add that for you:)

We also have support for the XL-320's - but that hasn't been added yet. Maybe i'll do that tonight or tomorrow.

#13  

Awesome, you have created a great platform for us hackers. Nice work.

Thanks

PRO
Synthiam
#14  

Thanks for the compliment:)