Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

How can we read a number of dynamixels in a single go?

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
27 postsPage 2 of 21, 2
27 postsPage 2 of 21, 2

Post by billyzelsnack » Sat Sep 06, 2008 4:03 am

Post by billyzelsnack
Sat Sep 06, 2008 4:03 am

ok. I guess it's not so obvious. I download the ax12 rom from tribotix and it is..

34,490 bytes! How does that work?
ok. I guess it's not so obvious. I download the ax12 rom from tribotix and it is..

34,490 bytes! How does that work?
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by StuartL » Sat Sep 06, 2008 7:24 am

Post by StuartL
Sat Sep 06, 2008 7:24 am

Sneak a look at my code :)

Each byte is encoded as a word xored with an incrementing word. It's obsfucation rather than encryption :)
Sneak a look at my code :)

Each byte is encoded as a word xored with an incrementing word. It's obsfucation rather than encryption :)
StuartL
Savvy Roboteer
Savvy Roboteer
Posts: 350
Joined: Mon Jun 04, 2007 3:46 pm
Location: Thatcham, Berkshire, UK

Post by billyzelsnack » Sat Sep 06, 2008 8:03 am

Post by billyzelsnack
Sat Sep 06, 2008 8:03 am

I see. I was thinking you ran your code after you removed the header.

So running your code on a rom will generate a file 17,245 bytes. The three files you have are..

bootloader 2048
flash 8192
firmware 6143 ( why not 6144 to make all three an even 16k? )

Which is 16383.

17,245 - 16383 = 862

So I don't know how you ended up with the header size you mentioned. Also looking at the decrypted rom I generated with your code I don't see it matching your 3 files. Do I need to run hex2bin or something on it? I tried running it, but I don't get an output file. I guess maybe I need to skip in however far the header is.

btw. How many releases of the rom file have there been? I've only seen the one REV0x16.
I see. I was thinking you ran your code after you removed the header.

So running your code on a rom will generate a file 17,245 bytes. The three files you have are..

bootloader 2048
flash 8192
firmware 6143 ( why not 6144 to make all three an even 16k? )

Which is 16383.

17,245 - 16383 = 862

So I don't know how you ended up with the header size you mentioned. Also looking at the decrypted rom I generated with your code I don't see it matching your 3 files. Do I need to run hex2bin or something on it? I tried running it, but I don't get an output file. I guess maybe I need to skip in however far the header is.

btw. How many releases of the rom file have there been? I've only seen the one REV0x16.
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by billyzelsnack » Sat Sep 06, 2008 8:19 am

Post by billyzelsnack
Sat Sep 06, 2008 8:19 am

Maybe not. I tried offsets from 0 to 22 with hex2bin and it just generates all 0 size files. Oh well.
Maybe not. I tried offsets from 0 to 22 with hex2bin and it just generates all 0 size files. Oh well.
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by bootstrap » Thu Oct 09, 2008 9:10 am

Post by bootstrap
Thu Oct 09, 2008 9:10 am

Also if any one is looking to create a better servo than the AX-12 or the open servo with Full 360 degree control,and a resolution of 0.35 deg take a look at the following non-contact magnetic encoder (which is also shipped as a free sample)
http://www.austriamicrosystems.com/eng/ ... ers/AS5035

People from Carnegie Mellon Univ have modified the Hitech 5595 (30kg-cm) torque servos on the lines of Open Servo and Dynamixels.(It is a project in collaboration with NASA).

Also if one is also looking to bring the cost down.Look at the metal gear train and the servo casing for cheap here (exact gears of Hitec)
http://servocity.com/html/hitec_metal_gearsets.html

and servo casing:
http://servocity.com/html/hitec_servo_case_sets.html

All you need is a control circuit (with Atmega8 ,bootloader ...which you already have or can be built on the lines of Open servo's PCB)

Hope one creates an entire servo of better quality,better features and at a lesser price than the Bioloid
Also if any one is looking to create a better servo than the AX-12 or the open servo with Full 360 degree control,and a resolution of 0.35 deg take a look at the following non-contact magnetic encoder (which is also shipped as a free sample)
http://www.austriamicrosystems.com/eng/ ... ers/AS5035

People from Carnegie Mellon Univ have modified the Hitech 5595 (30kg-cm) torque servos on the lines of Open Servo and Dynamixels.(It is a project in collaboration with NASA).

Also if one is also looking to bring the cost down.Look at the metal gear train and the servo casing for cheap here (exact gears of Hitec)
http://servocity.com/html/hitec_metal_gearsets.html

and servo casing:
http://servocity.com/html/hitec_servo_case_sets.html

All you need is a control circuit (with Atmega8 ,bootloader ...which you already have or can be built on the lines of Open servo's PCB)

Hope one creates an entire servo of better quality,better features and at a lesser price than the Bioloid
bootstrap
Robot Builder
Robot Builder
Posts: 13
Joined: Wed Sep 03, 2008 7:01 pm

Post by StuartL » Fri Oct 10, 2008 9:56 am

Post by StuartL
Fri Oct 10, 2008 9:56 am

bootstrap wrote:Also if any one is looking to create a better servo than the AX-12 or the open servo with Full 360 degree control,and a resolution of 0.35 deg take a look at the following non-contact magnetic encoder (which is also shipped as a free sample)
http://www.austriamicrosystems.com/eng/ ... ers/AS5035


It's 1.4 degrees resolution as it's an 8-bit encoder. The analogue encoder in the AX-12 is 10-bit, although only 330 degree coverage. It's horses for courses, if you want full coverage you normally end up putting two 330 degree potentiometers 180 degrees apart. This is approach that all big name servo manufacturers use because you can get much better accuracy than the current range of digital solutions.

Hope one creates an entire servo of better quality,better features and at a lesser price than the Bioloid


That's just the thing. THe AX12 may have its limitations (relatively heavy, 330 deg coverage) but it's also one of the best servos on the market for the price. It's got the wonderful 1Mbit bus and relatively high torque and lends it self well to Robotics. There's definitely better out there, and there's definitely ways to improve it, but few solutions for a comparable price.
bootstrap wrote:Also if any one is looking to create a better servo than the AX-12 or the open servo with Full 360 degree control,and a resolution of 0.35 deg take a look at the following non-contact magnetic encoder (which is also shipped as a free sample)
http://www.austriamicrosystems.com/eng/ ... ers/AS5035


It's 1.4 degrees resolution as it's an 8-bit encoder. The analogue encoder in the AX-12 is 10-bit, although only 330 degree coverage. It's horses for courses, if you want full coverage you normally end up putting two 330 degree potentiometers 180 degrees apart. This is approach that all big name servo manufacturers use because you can get much better accuracy than the current range of digital solutions.

Hope one creates an entire servo of better quality,better features and at a lesser price than the Bioloid


That's just the thing. THe AX12 may have its limitations (relatively heavy, 330 deg coverage) but it's also one of the best servos on the market for the price. It's got the wonderful 1Mbit bus and relatively high torque and lends it self well to Robotics. There's definitely better out there, and there's definitely ways to improve it, but few solutions for a comparable price.
StuartL
Savvy Roboteer
Savvy Roboteer
Posts: 350
Joined: Mon Jun 04, 2007 3:46 pm
Location: Thatcham, Berkshire, UK

Post by billyzelsnack » Fri Oct 10, 2008 11:44 pm

Post by billyzelsnack
Fri Oct 10, 2008 11:44 pm

VERY interesting idea bootstrap. To make it even cheaper Trossen sells the servo case for $5 minus the middle section. That at least gives you the parts that hold the gears.

I guess the big question is if the gear set comes with the motor pinion too.

My LHS ( local hobby shop ) is a big hitec distributor and they just might have these in stock. Maybe I'll go have a looksy tonight.
VERY interesting idea bootstrap. To make it even cheaper Trossen sells the servo case for $5 minus the middle section. That at least gives you the parts that hold the gears.

I guess the big question is if the gear set comes with the motor pinion too.

My LHS ( local hobby shop ) is a big hitec distributor and they just might have these in stock. Maybe I'll go have a looksy tonight.
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by billyzelsnack » Sat Oct 11, 2008 4:11 am

Post by billyzelsnack
Sat Oct 11, 2008 4:11 am

I went to my LHS and they had the case for $8 and some gears marked 5995 for $7.

It looked like this pack..

http://www3.towerhobbies.com/cgi-bin/wt ... XPVU3&P=WR

Which looked like just karbonite gears.

55014 which is the same that's listed on the servocity page.. So I don't think these'll work.
I went to my LHS and they had the case for $8 and some gears marked 5995 for $7.

It looked like this pack..

http://www3.towerhobbies.com/cgi-bin/wt ... XPVU3&P=WR

Which looked like just karbonite gears.

55014 which is the same that's listed on the servocity page.. So I don't think these'll work.
billyzelsnack
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 618
Joined: Sat Dec 30, 2006 1:00 am

Post by Doms » Wed Oct 15, 2008 3:03 pm

Post by Doms
Wed Oct 15, 2008 3:03 pm

Hi Stuart!

Thanks for sharing your experiences with us!

I am interested in flashing some of the RX series servos (RX-28 and RX-64) using your method.
So I first tried to reproduce your results using an AX-12+, but without success.
I don't have a CM5 so I use a PC with a USB2TTL converter and a simple Python script to do the communication with the servos. This usually works very well to setup the servo parameters before using them in a robot.

I was hoping you could give me some more detailed information about the steps:

StuartL wrote:When ready to flash the CM5 sends a digital reset packet to the desired servo and switches the bus into 57600.

I assume the 'digital reset packet' is a packet with instruction code 6 and no data.

StuartL wrote:It then sends several '#' characters which is enough to put the servo into a MUCH reduced CM5-a-like bootloader over the half duplex bus.

How much are several? And how do I know when to stop?
I tried sending 10, 100 or 1000 '#'-characters...

StuartL wrote:As soon as the CM5 gets a response from the servo bootloader at 57600 it sends the load command and transmits the servo ROM from its own flash to the servo.

What does the response look like? Is it the 'System O.K...' plain text message that is shown in the CM5 documentation and that can also be seen in the bootloader bin file you posted in some other thread?

Thanks for your time!
Dorian
Hi Stuart!

Thanks for sharing your experiences with us!

I am interested in flashing some of the RX series servos (RX-28 and RX-64) using your method.
So I first tried to reproduce your results using an AX-12+, but without success.
I don't have a CM5 so I use a PC with a USB2TTL converter and a simple Python script to do the communication with the servos. This usually works very well to setup the servo parameters before using them in a robot.

I was hoping you could give me some more detailed information about the steps:

StuartL wrote:When ready to flash the CM5 sends a digital reset packet to the desired servo and switches the bus into 57600.

I assume the 'digital reset packet' is a packet with instruction code 6 and no data.

StuartL wrote:It then sends several '#' characters which is enough to put the servo into a MUCH reduced CM5-a-like bootloader over the half duplex bus.

How much are several? And how do I know when to stop?
I tried sending 10, 100 or 1000 '#'-characters...

StuartL wrote:As soon as the CM5 gets a response from the servo bootloader at 57600 it sends the load command and transmits the servo ROM from its own flash to the servo.

What does the response look like? Is it the 'System O.K...' plain text message that is shown in the CM5 documentation and that can also be seen in the bootloader bin file you posted in some other thread?

Thanks for your time!
Dorian
Doms
Newbie
Newbie
Posts: 5
Joined: Wed Oct 15, 2008 2:38 pm

Post by StuartL » Fri Oct 17, 2008 9:32 pm

Post by StuartL
Fri Oct 17, 2008 9:32 pm

Doms wrote:
StuartL wrote:When ready to flash the CM5 sends a digital reset packet to the desired servo and switches the bus into 57600.

I assume the 'digital reset packet' is a packet with instruction code 6 and no data.


I think it's instruction seven rather than six but yes, that packet.

Doms wrote:
StuartL wrote:It then sends several '#' characters which is enough to put the servo into a MUCH reduced CM5-a-like bootloader over the half duplex bus.

How much are several? And how do I know when to stop?
I tried sending 10, 100 or 1000 '#'-characters...


Matt ended up sending one, waiting for a character back, after a few ms sending another one, rinse and repeat until you get a '#' back.

Doms wrote:
StuartL wrote:As soon as the CM5 gets a response from the servo bootloader at 57600 it sends the load command and transmits the servo ROM from its own flash to the servo.

What does the response look like? Is it the 'System O.K...' plain text message that is shown in the CM5 documentation and that can also be seen in the bootloader bin file you posted in some other thread?


It's a '#' prompt, I think. If you've a way of sniffing the bus you should see the prompt arrive.

Doms wrote:Thanks for your time!


Any time :) I have boundless patience for those who help themselves.
Doms wrote:
StuartL wrote:When ready to flash the CM5 sends a digital reset packet to the desired servo and switches the bus into 57600.

I assume the 'digital reset packet' is a packet with instruction code 6 and no data.


I think it's instruction seven rather than six but yes, that packet.

Doms wrote:
StuartL wrote:It then sends several '#' characters which is enough to put the servo into a MUCH reduced CM5-a-like bootloader over the half duplex bus.

How much are several? And how do I know when to stop?
I tried sending 10, 100 or 1000 '#'-characters...


Matt ended up sending one, waiting for a character back, after a few ms sending another one, rinse and repeat until you get a '#' back.

Doms wrote:
StuartL wrote:As soon as the CM5 gets a response from the servo bootloader at 57600 it sends the load command and transmits the servo ROM from its own flash to the servo.

What does the response look like? Is it the 'System O.K...' plain text message that is shown in the CM5 documentation and that can also be seen in the bootloader bin file you posted in some other thread?


It's a '#' prompt, I think. If you've a way of sniffing the bus you should see the prompt arrive.

Doms wrote:Thanks for your time!


Any time :) I have boundless patience for those who help themselves.
StuartL
Savvy Roboteer
Savvy Roboteer
Posts: 350
Joined: Mon Jun 04, 2007 3:46 pm
Location: Thatcham, Berkshire, UK

Post by Doms » Thu Oct 23, 2008 5:25 pm

Post by Doms
Thu Oct 23, 2008 5:25 pm

Thanks a lot!
It worked!
I managed to get an DX-117 into boot loader mode and play around with the few commands it has...
I used my Laptop with a USB2RS485 converter and a small Python script:
Code: Select all
#! /usr/bin/python
import serial

# change these settings to fit your setup
serialPortName = '//./COM9'
standardBaudrate = 57600 # 57600 for DX and RX series, 1000000 for AX series
bootloaderBaudrate = 57600 # 57600 for all series
serialTimeout = 0.02 # [sec] 0.01s to 1s seems to work, depending on how long the serial port take to switch to the new baudrate after the reset
firmwareBinaryFilename = 'c:\\myNewRx28Firmware.bin'

resetPacketString = '\xff\xff\x01\x02\x06\xf6' # servo id 1, instruction 6 (reset)

# open serial port
serialPort = serial.Serial(port = serialPortName, baudrate = standardBaudrate, timeout = serialTimeout)
print 'serial connection: %s' % serialPort

# send reset packet
print 'sending: ' + repr(resetPacketString)
serialPort.write(resetPacketString)

# switch to the bootloaders baudrate
serialPort.baudrate = bootloaderBaudrate
print 'serial connection: %s' % serialPort

print 'sending: ',

response = ''
while response != '\x20':
  print '#',
  serialPort.write('#')
  response = serialPort.read(1)

print '\nservo is now in boot loader:'

# read boot loader message
serialPort.timeout = 1.0
print serialPort.read(1000)

# here we can download a custom firmware to the servo
#serialPort.write('l')

# now send the data
# should this be send direcly in binary or in hex format or whatever?
#serialPort.write(open(firmwareBinaryFilename, 'rb').read())

# do we need to confirm the checksum here?

# execute new firmware
serialPort.write('g')


The resulting output is this:

Code: Select all
serial connection: Serial<id>(port='//./COM9', baudrate=57600, bytesize=8, parity='N', stopbits=1, timeout=0.02, xonxoff=0, rtscts=0, dsrdtr=0)
sending: '\xff\xff\x01\x02\x06\xf6'
serial connection: Serial<id>(port='//./COM9', baudrate=57600, bytesize=8, parity='N', stopbits=1, timeout=0.02, xonxoff=0, rtscts=0, dsrdtr=0)
sending:  # # # # # # # # # # # # # # # # # # # # # # # #
servo is now in boot loader:
SYSTEM O.K.
 *
 *
 *
 *°Command : L(oad),G(o),S(ystem),A(pplication),R(eset),D(ump),C(lear)
 *


But as you can see in the last lines of code, there are a few more question marks...

StuartL wrote:As soon as the CM5 gets a response from the servo bootloader at 57600 it sends the load command and transmits the servo ROM from its own flash to the servo.

In which format do I transmit the new firmware? Just straight binary I guess. But after reading the piece of code you had to use to decode the ROM file...

StuartL wrote:It confirms the checksum is ok and if so reboots the servo, which then comes up at 1Mbit.

Do I have to confirm the checksum to the servo, or just make sure the transmission worked correctly and send the servo a GO?

By the way, are you going to open source your new firmware for the AX-12?
Since I am about to write a new firmware for the DX/RX series, I was wondering, whether we could join our efforts. Maybe we could make this a sourceforge project or something like that...

cheers
Dorian
Thanks a lot!
It worked!
I managed to get an DX-117 into boot loader mode and play around with the few commands it has...
I used my Laptop with a USB2RS485 converter and a small Python script:
Code: Select all
#! /usr/bin/python
import serial

# change these settings to fit your setup
serialPortName = '//./COM9'
standardBaudrate = 57600 # 57600 for DX and RX series, 1000000 for AX series
bootloaderBaudrate = 57600 # 57600 for all series
serialTimeout = 0.02 # [sec] 0.01s to 1s seems to work, depending on how long the serial port take to switch to the new baudrate after the reset
firmwareBinaryFilename = 'c:\\myNewRx28Firmware.bin'

resetPacketString = '\xff\xff\x01\x02\x06\xf6' # servo id 1, instruction 6 (reset)

# open serial port
serialPort = serial.Serial(port = serialPortName, baudrate = standardBaudrate, timeout = serialTimeout)
print 'serial connection: %s' % serialPort

# send reset packet
print 'sending: ' + repr(resetPacketString)
serialPort.write(resetPacketString)

# switch to the bootloaders baudrate
serialPort.baudrate = bootloaderBaudrate
print 'serial connection: %s' % serialPort

print 'sending: ',

response = ''
while response != '\x20':
  print '#',
  serialPort.write('#')
  response = serialPort.read(1)

print '\nservo is now in boot loader:'

# read boot loader message
serialPort.timeout = 1.0
print serialPort.read(1000)

# here we can download a custom firmware to the servo
#serialPort.write('l')

# now send the data
# should this be send direcly in binary or in hex format or whatever?
#serialPort.write(open(firmwareBinaryFilename, 'rb').read())

# do we need to confirm the checksum here?

# execute new firmware
serialPort.write('g')


The resulting output is this:

Code: Select all
serial connection: Serial<id>(port='//./COM9', baudrate=57600, bytesize=8, parity='N', stopbits=1, timeout=0.02, xonxoff=0, rtscts=0, dsrdtr=0)
sending: '\xff\xff\x01\x02\x06\xf6'
serial connection: Serial<id>(port='//./COM9', baudrate=57600, bytesize=8, parity='N', stopbits=1, timeout=0.02, xonxoff=0, rtscts=0, dsrdtr=0)
sending:  # # # # # # # # # # # # # # # # # # # # # # # #
servo is now in boot loader:
SYSTEM O.K.
 *
 *
 *
 *°Command : L(oad),G(o),S(ystem),A(pplication),R(eset),D(ump),C(lear)
 *


But as you can see in the last lines of code, there are a few more question marks...

StuartL wrote:As soon as the CM5 gets a response from the servo bootloader at 57600 it sends the load command and transmits the servo ROM from its own flash to the servo.

In which format do I transmit the new firmware? Just straight binary I guess. But after reading the piece of code you had to use to decode the ROM file...

StuartL wrote:It confirms the checksum is ok and if so reboots the servo, which then comes up at 1Mbit.

Do I have to confirm the checksum to the servo, or just make sure the transmission worked correctly and send the servo a GO?

By the way, are you going to open source your new firmware for the AX-12?
Since I am about to write a new firmware for the DX/RX series, I was wondering, whether we could join our efforts. Maybe we could make this a sourceforge project or something like that...

cheers
Dorian
Doms
Newbie
Newbie
Posts: 5
Joined: Wed Oct 15, 2008 2:38 pm

Post by Doms » Thu Oct 23, 2008 8:41 pm

Post by Doms
Thu Oct 23, 2008 8:41 pm

So after a few hours of trying this and that and actually installing the AVR toolchain and compiling a simple "hello led"-program, I'll just answer my own questions ;-)

Doms wrote:
StuartL wrote:As soon as the CM5 gets a response from the servo bootloader at 57600 it sends the load command and transmits the servo ROM from its own flash to the servo.

In which format do I transmit the new firmware? Just straight binary I guess. But after reading the piece of code you had to use to decode the ROM file...

Yeah, it is actually straight binary data. The type you get when objcopying your elf-file to binary target:
avr-objcopy -O binary fw.elf fw.bin

Doms wrote:
StuartL wrote:It confirms the checksum is ok and if so reboots the servo, which then comes up at 1Mbit.

Do I have to confirm the checksum to the servo, or just make sure the transmission worked correctly and send the servo a GO?

Yeah, i had to calc the 8-bit checksum and send it directly after the binary data.
It's simply calculated by summing up all the binary's bytes into one byte...

The code got a little to big to inline it here, so you can get it at:
http://robosavvy.com/Builders/Doms/flash.py

Doms wrote:By the way, are you going to open source your new firmware for the AX-12?
Since I am about to write a new firmware for the DX/RX series, I was wondering, whether we could join our efforts. Maybe we could make this a sourceforge project or something like that...

Still hoping for a positive reply ;-)

cheers
Dorian
So after a few hours of trying this and that and actually installing the AVR toolchain and compiling a simple "hello led"-program, I'll just answer my own questions ;-)

Doms wrote:
StuartL wrote:As soon as the CM5 gets a response from the servo bootloader at 57600 it sends the load command and transmits the servo ROM from its own flash to the servo.

In which format do I transmit the new firmware? Just straight binary I guess. But after reading the piece of code you had to use to decode the ROM file...

Yeah, it is actually straight binary data. The type you get when objcopying your elf-file to binary target:
avr-objcopy -O binary fw.elf fw.bin

Doms wrote:
StuartL wrote:It confirms the checksum is ok and if so reboots the servo, which then comes up at 1Mbit.

Do I have to confirm the checksum to the servo, or just make sure the transmission worked correctly and send the servo a GO?

Yeah, i had to calc the 8-bit checksum and send it directly after the binary data.
It's simply calculated by summing up all the binary's bytes into one byte...

The code got a little to big to inline it here, so you can get it at:
http://robosavvy.com/Builders/Doms/flash.py

Doms wrote:By the way, are you going to open source your new firmware for the AX-12?
Since I am about to write a new firmware for the DX/RX series, I was wondering, whether we could join our efforts. Maybe we could make this a sourceforge project or something like that...

Still hoping for a positive reply ;-)

cheers
Dorian
Doms
Newbie
Newbie
Posts: 5
Joined: Wed Oct 15, 2008 2:38 pm

Previous
27 postsPage 2 of 21, 2
27 postsPage 2 of 21, 2