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

libavr/libbioloid C library for CM5 released!

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
289 postsPage 16 of 201 ... 13, 14, 15, 16, 17, 18, 19, 20
289 postsPage 16 of 201 ... 13, 14, 15, 16, 17, 18, 19, 20

Post by RandomMatt » Mon May 10, 2010 10:37 pm

Post by RandomMatt
Mon May 10, 2010 10:37 pm

This seems to come up a lot... perhaps I'll write a better FM. Anyway, short answer, read doc/programmer.html


long answer:

robot terminal (or whatever it is called that robotis install on windows) transfers .hex files. Although you do have to get into the bootloader (use the '#' key).

tools/programmer (in libbioloid) works if you give it the .bin file.

some-random-other-terminal-program will work if you give it the .bin file - but it won't send the checksum information, and you'll need to mess around with the bootloader.
This seems to come up a lot... perhaps I'll write a better FM. Anyway, short answer, read doc/programmer.html


long answer:

robot terminal (or whatever it is called that robotis install on windows) transfers .hex files. Although you do have to get into the bootloader (use the '#' key).

tools/programmer (in libbioloid) works if you give it the .bin file.

some-random-other-terminal-program will work if you give it the .bin file - but it won't send the checksum information, and you'll need to mess around with the bootloader.
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

Post by Dimitris » Sat May 15, 2010 12:20 pm

Post by Dimitris
Sat May 15, 2010 12:20 pm

OK Matt, I will have to check it out over the weekend, thanks!

animemastr: As Matt mentions, you can use any terminal-emulation program to transfer the .bin file.
If you use /tools/programmer (run "make" in /tools first) you can send the .bin file directly since it enters the bootloader for you, with a terminal command along the lines of: "programmer -t /dev/ttyUSB0 example_cm5.bin".
I used putty or minicom, even a terminal command line should work (e.g. "example_cm5.bin > /dev/ttyUSB0"), but first you have to enter the bootloader with your program of choice by sending # constantly, then pressing the red button on the CM5.
Transmitting a .hex file using the above methods won't work, you have to use the Windows robot-terminal.
OK Matt, I will have to check it out over the weekend, thanks!

animemastr: As Matt mentions, you can use any terminal-emulation program to transfer the .bin file.
If you use /tools/programmer (run "make" in /tools first) you can send the .bin file directly since it enters the bootloader for you, with a terminal command along the lines of: "programmer -t /dev/ttyUSB0 example_cm5.bin".
I used putty or minicom, even a terminal command line should work (e.g. "example_cm5.bin > /dev/ttyUSB0"), but first you have to enter the bootloader with your program of choice by sending # constantly, then pressing the red button on the CM5.
Transmitting a .hex file using the above methods won't work, you have to use the Windows robot-terminal.
Last edited by Dimitris on Wed May 19, 2010 12:04 am, edited 1 time in total.
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by limor » Tue May 18, 2010 2:07 pm

Post by limor
Tue May 18, 2010 2:07 pm

Hi Matt, have you thought of adding a small circuit on the AX12 to allow the M1 do torque control by measuring current draw by the motor and linking to an ADC port on the ATmega8 ?
Hi Matt, have you thought of adding a small circuit on the AX12 to allow the M1 do torque control by measuring current draw by the motor and linking to an ADC port on the ATmega8 ?
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by Dimitris » Wed May 19, 2010 12:33 am

Post by Dimitris
Wed May 19, 2010 12:33 am

Updating from my last reply,

Matt: I seem to be able to communicate with the AX-12 servos whether downloading the hex (windows) or the bin of the compiled example. I can turn on/off a servo's LED for example, by hitting 'w', selecting a servo ID and writing to byte 25.
But if I write to 'Goal Position' (byte 30) any value, for example 0, 0x3ff (I assume from the supervisor code that hex notation is enabled when 'x' is pressed), there is no response. The AX-12 manual mentions however that both bytes (30 & 31) need to be written at the same time as one instruction packet, so I guess I'm getting it wrong, but how else could I test servo positioning using the example program?
Updating from my last reply,

Matt: I seem to be able to communicate with the AX-12 servos whether downloading the hex (windows) or the bin of the compiled example. I can turn on/off a servo's LED for example, by hitting 'w', selecting a servo ID and writing to byte 25.
But if I write to 'Goal Position' (byte 30) any value, for example 0, 0x3ff (I assume from the supervisor code that hex notation is enabled when 'x' is pressed), there is no response. The AX-12 manual mentions however that both bytes (30 & 31) need to be written at the same time as one instruction packet, so I guess I'm getting it wrong, but how else could I test servo positioning using the example program?
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by siempre.aprendiendo » Fri May 21, 2010 8:34 pm

Post by siempre.aprendiendo
Fri May 21, 2010 8:34 pm

Will you update the library to support the new CM-510 with the "new" sensors? :)
Will you update the library to support the new CM-510 with the "new" sensors? :)
siempre.aprendiendo
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

so close!

Post by animemastr » Sat May 22, 2010 3:47 am

Post by animemastr
Sat May 22, 2010 3:47 am

thanks for the replies guys, but im a total n00b! :oops:
i run the command

Code: Select all
../tools/programmer -t /dev/ttyUSB0 example_cm5.bin


but when it drops into the terminal, it doesnt seem like it flashed it, and it wont take any of my commands. here is the initial output:



Code: Select all
 SYSTEM O.K. (CM5 Boot loader V1.41)
 - ##############
 - l
 Write Address : 00000000
 Ready..Success
 Rewriting:0X0005
 Size:0X0000262B  Checksum:CD-CD


i try to send some q's to turn one of the servos, but it doesnt like it so then i type help and it looks like the robotis firmware was never replaced...
doc/programmer.html says to push the red button on the CM5 while programmer is still running to reset it, but i get this:
Code: Select all
 - �a/A: authorise, b/B: bridge 1M/57600, g/start button: go, h: help, i/I: info,
m/M: dump memory, n: repeatedly dump memory, p: power+battery status,
r: renumber, w: write, x: rescan, !: reset id, #: reboot, ~: enter supervisor
(capital letter versions of the commands operate on all ids)
>


what now? am i doing things right so far? any advice would be greatly appreciated. :oops: :oops:
thanks for the replies guys, but im a total n00b! :oops:
i run the command

Code: Select all
../tools/programmer -t /dev/ttyUSB0 example_cm5.bin


but when it drops into the terminal, it doesnt seem like it flashed it, and it wont take any of my commands. here is the initial output:



Code: Select all
 SYSTEM O.K. (CM5 Boot loader V1.41)
 - ##############
 - l
 Write Address : 00000000
 Ready..Success
 Rewriting:0X0005
 Size:0X0000262B  Checksum:CD-CD


i try to send some q's to turn one of the servos, but it doesnt like it so then i type help and it looks like the robotis firmware was never replaced...
doc/programmer.html says to push the red button on the CM5 while programmer is still running to reset it, but i get this:
Code: Select all
 - �a/A: authorise, b/B: bridge 1M/57600, g/start button: go, h: help, i/I: info,
m/M: dump memory, n: repeatedly dump memory, p: power+battery status,
r: renumber, w: write, x: rescan, !: reset id, #: reboot, ~: enter supervisor
(capital letter versions of the commands operate on all ids)
>


what now? am i doing things right so far? any advice would be greatly appreciated. :oops: :oops:
animemastr
Newbie
Newbie
Posts: 5
Joined: Sun Jul 12, 2009 6:43 pm

Post by Dimitris » Sat May 22, 2010 11:03 am

Post by Dimitris
Sat May 22, 2010 11:03 am

animemastr: Yes, that's exactly what's supposed to happen! After downloading the new program, pressing the red button or '#' reboots the CM-5. The output you see is the new menu which the supervisor displays. Here you can perform various functions such as:
Pressing 'i' and then the ID of a servo (and Enter) will output info about that servo.
Pressing 'x' scans for servos connected to the CM-5. You will notice that the program returns an 'ok' or 'missing' message if it finds or fails to find servos with ID 1,2,3 and returns 'surplus' for the others. This is because the example main program is set up to control the position of the first 3 servos.
Pressing 'g' or the CM-5 start button will start this main program, constantly displaying the positions of the 3 servos. Pressing q,w,e moves servos one way, and a,s,d the other way. Uppercase commands make the increments larger.
The best way to get an initial understanding of the code is to have a look at the supervisor.c code (in /libbioloid/bioloid), and the main function of example.c.
The problem I have is that most menu functions work, apart from the part which controls the servos using the keyboard. Let me know if you have better luck.
animemastr: Yes, that's exactly what's supposed to happen! After downloading the new program, pressing the red button or '#' reboots the CM-5. The output you see is the new menu which the supervisor displays. Here you can perform various functions such as:
Pressing 'i' and then the ID of a servo (and Enter) will output info about that servo.
Pressing 'x' scans for servos connected to the CM-5. You will notice that the program returns an 'ok' or 'missing' message if it finds or fails to find servos with ID 1,2,3 and returns 'surplus' for the others. This is because the example main program is set up to control the position of the first 3 servos.
Pressing 'g' or the CM-5 start button will start this main program, constantly displaying the positions of the 3 servos. Pressing q,w,e moves servos one way, and a,s,d the other way. Uppercase commands make the increments larger.
The best way to get an initial understanding of the code is to have a look at the supervisor.c code (in /libbioloid/bioloid), and the main function of example.c.
The problem I have is that most menu functions work, apart from the part which controls the servos using the keyboard. Let me know if you have better luck.
Dimitris
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 53
Joined: Thu Jun 29, 2006 1:00 am

Post by RandomMatt » Sun May 23, 2010 10:27 am

Post by RandomMatt
Sun May 23, 2010 10:27 am

siempre.aprendiendo wrote:Will you update the library to support the new CM-510 with the "new" sensors? :)


That depends... if I had the hardware I'd be tempted - but as I don't I won't be doing it anytime soon. But... it should be easy to do - so I'm sure someone will get around to it.
siempre.aprendiendo wrote:Will you update the library to support the new CM-510 with the "new" sensors? :)


That depends... if I had the hardware I'd be tempted - but as I don't I won't be doing it anytime soon. But... it should be easy to do - so I'm sure someone will get around to it.
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

Post by RandomMatt » Sun May 23, 2010 10:31 am

Post by RandomMatt
Sun May 23, 2010 10:31 am

Dimitris wrote:Updating from my last reply,

Matt: I seem to be able to communicate with the AX-12 servos whether downloading the hex (windows) or the bin of the compiled example. I can turn on/off a servo's LED for example, by hitting 'w', selecting a servo ID and writing to byte 25.
But if I write to 'Goal Position' (byte 30) any value, for example 0, 0x3ff (I assume from the supervisor code that hex notation is enabled when 'x' is pressed), there is no response. The AX-12 manual mentions however that both bytes (30 & 31) need to be written at the same time as one instruction packet, so I guess I'm getting it wrong, but how else could I test servo positioning using the example program?


Ahhhh... you have found an annoyance of the supervisor - it can only understand bytes (not words). So you need to write to offset 30, and then write to offset 31. The other really important memory location is torque enable (24), you may find that nothing happens until you write a non-zero value there.
Dimitris wrote:Updating from my last reply,

Matt: I seem to be able to communicate with the AX-12 servos whether downloading the hex (windows) or the bin of the compiled example. I can turn on/off a servo's LED for example, by hitting 'w', selecting a servo ID and writing to byte 25.
But if I write to 'Goal Position' (byte 30) any value, for example 0, 0x3ff (I assume from the supervisor code that hex notation is enabled when 'x' is pressed), there is no response. The AX-12 manual mentions however that both bytes (30 & 31) need to be written at the same time as one instruction packet, so I guess I'm getting it wrong, but how else could I test servo positioning using the example program?


Ahhhh... you have found an annoyance of the supervisor - it can only understand bytes (not words). So you need to write to offset 30, and then write to offset 31. The other really important memory location is torque enable (24), you may find that nothing happens until you write a non-zero value there.
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

Post by RandomMatt » Sun May 23, 2010 10:40 am

Post by RandomMatt
Sun May 23, 2010 10:40 am

Dimitris wrote:animemastr: Yes, that's exactly what's supposed to happen! After downloading the new program, pressing the red button or '#' reboots the CM-5. The output you see is the new menu which the supervisor displays.


The other thing you can do is at the bootloader prompt send 'g<CR>'... this does the same thing as a reset (i.e. takes you to the supervisor).

'#' only works when libbioloid code is running - i.e. in the program or the supervisor. In practice, this means that unless you've done something quite special (like disabled interrupts) you will always be able to get back to the bootloader and supervisor.

This is quite useful to me, because my CM5 is partially dead. Specifically the reset button doesn't work anymore, and as far as I can tell that is the only failure. For what it is worth - you really don't want to connect 12v to the datawire of the bus.
Dimitris wrote:animemastr: Yes, that's exactly what's supposed to happen! After downloading the new program, pressing the red button or '#' reboots the CM-5. The output you see is the new menu which the supervisor displays.


The other thing you can do is at the bootloader prompt send 'g<CR>'... this does the same thing as a reset (i.e. takes you to the supervisor).

'#' only works when libbioloid code is running - i.e. in the program or the supervisor. In practice, this means that unless you've done something quite special (like disabled interrupts) you will always be able to get back to the bootloader and supervisor.

This is quite useful to me, because my CM5 is partially dead. Specifically the reset button doesn't work anymore, and as far as I can tell that is the only failure. For what it is worth - you really don't want to connect 12v to the datawire of the bus.
RandomMatt
Savvy Roboteer
Savvy Roboteer
Posts: 117
Joined: Sat Dec 20, 2008 11:16 pm

Post by Mirko » Thu Jun 03, 2010 4:36 pm

Post by Mirko
Thu Jun 03, 2010 4:36 pm

Hi everybody, I'm a complete beginner in using the Bioloid Comprehensive Kit (and not a very good C programmer), and after a survey on the interesting forums on this site I am still a bit confused. I'd like to program the CM5 using libbioloid libraries, but I have two major problems:
1)using WinAVR (and MinGW installed) I can't get the example.c compiled, instead I have the following:
Code: Select all
gcc -Wall -g -std=gnu99 -I../libbioloid -I../libcompat -DHOST -lm -o ../libbioloid/bioloid/trig_tables._ ../libbioloid/bioloid/make_trig_tables.c
process_begin: CreateProcess(NULL, gcc -Wall -g -std=gnu99 -I../libbioloid -I../libcompat -DHOST -lm -o ../libbioloid/bioloid/trig_tables._ ../libbioloid/bioloid/make_trig_tables.c, ...) failed.
make (e=2): Impossibile trovare il file specificato.

make.exe: *** [../libbioloid/bioloid/trig_tables.c] Error 2

It seems the same error someone else has already posted some time ago, but in this case I should have gcc installed, and I can't understand where I am wrong.
2) It seems that the code in battery.c doesn't attempt to charge the batteries, so I am supposed to use LiPos and a charger. I am forced to use the NiMH batteries for the moment, so I was wondering if I could safely reuse the old conservative code (that from Bioloid, and the first developed by StuartL), sacrificing battery life.
Thanks to everyone who will help, and sorry if this are stupid questions :roll:
Hi everybody, I'm a complete beginner in using the Bioloid Comprehensive Kit (and not a very good C programmer), and after a survey on the interesting forums on this site I am still a bit confused. I'd like to program the CM5 using libbioloid libraries, but I have two major problems:
1)using WinAVR (and MinGW installed) I can't get the example.c compiled, instead I have the following:
Code: Select all
gcc -Wall -g -std=gnu99 -I../libbioloid -I../libcompat -DHOST -lm -o ../libbioloid/bioloid/trig_tables._ ../libbioloid/bioloid/make_trig_tables.c
process_begin: CreateProcess(NULL, gcc -Wall -g -std=gnu99 -I../libbioloid -I../libcompat -DHOST -lm -o ../libbioloid/bioloid/trig_tables._ ../libbioloid/bioloid/make_trig_tables.c, ...) failed.
make (e=2): Impossibile trovare il file specificato.

make.exe: *** [../libbioloid/bioloid/trig_tables.c] Error 2

It seems the same error someone else has already posted some time ago, but in this case I should have gcc installed, and I can't understand where I am wrong.
2) It seems that the code in battery.c doesn't attempt to charge the batteries, so I am supposed to use LiPos and a charger. I am forced to use the NiMH batteries for the moment, so I was wondering if I could safely reuse the old conservative code (that from Bioloid, and the first developed by StuartL), sacrificing battery life.
Thanks to everyone who will help, and sorry if this are stupid questions :roll:
Mirko
Robot Builder
Robot Builder
Posts: 7
Joined: Thu Jun 03, 2010 3:54 pm

Post by Mirko » Fri Jun 04, 2010 5:37 pm

Post by Mirko
Fri Jun 04, 2010 5:37 pm

Ok, it seems that my first question was a really stupid one...don't know why, but I forgot to change the PATH variable :oops: .
It compiles, but something strange is going on: when I tried to move the dynamixels, they didn't react at all; and now that I have put again the original Bioloid firmware in, the CM5 can't see anything no more! I mean, typing 'search' I got the correct answer (Found! etc...), but no Dynamixel appears elsewhere, and there is no answer to my commands...
Has anyone had such a problem?
Ok, it seems that my first question was a really stupid one...don't know why, but I forgot to change the PATH variable :oops: .
It compiles, but something strange is going on: when I tried to move the dynamixels, they didn't react at all; and now that I have put again the original Bioloid firmware in, the CM5 can't see anything no more! I mean, typing 'search' I got the correct answer (Found! etc...), but no Dynamixel appears elsewhere, and there is no answer to my commands...
Has anyone had such a problem?
Mirko
Robot Builder
Robot Builder
Posts: 7
Joined: Thu Jun 03, 2010 3:54 pm

Post by Fritzoid » Fri Jun 04, 2010 5:56 pm

Post by Fritzoid
Fri Jun 04, 2010 5:56 pm

Hi Mirko,

Search looks for dynamixels at all baud rates but the firmware only sees dynamixels at 1Mbs. Are your servos being found at 1Mbs or at a different speed?
Hi Mirko,

Search looks for dynamixels at all baud rates but the firmware only sees dynamixels at 1Mbs. Are your servos being found at 1Mbs or at a different speed?
Fritzoid
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 331
Joined: Mon Dec 18, 2006 1:00 am

Post by Mirko » Sat Jun 05, 2010 4:07 pm

Post by Mirko
Sat Jun 05, 2010 4:07 pm

Using 'search', all dynamixels are found, with BAUD_REG: 001 and their correct ID, while in manage mode I got 000(0X00)dynamixels found.
I tried to change the bus cable, and connected a new AX12 which had never been used, having the same results, so I think it must be some sort of trouble in the CM5. In fact, when I first run example.c from libbioloid, it claimed there was a bus error, and after a while, in the terminal window I could see only meaningless words, as if the communication was not synchronized...
Using 'search', all dynamixels are found, with BAUD_REG: 001 and their correct ID, while in manage mode I got 000(0X00)dynamixels found.
I tried to change the bus cable, and connected a new AX12 which had never been used, having the same results, so I think it must be some sort of trouble in the CM5. In fact, when I first run example.c from libbioloid, it claimed there was a bus error, and after a while, in the terminal window I could see only meaningless words, as if the communication was not synchronized...
Mirko
Robot Builder
Robot Builder
Posts: 7
Joined: Thu Jun 03, 2010 3:54 pm

Post by Mirko » Mon Jun 07, 2010 7:45 am

Post by Mirko
Mon Jun 07, 2010 7:45 am

@ Fritzoid

You were right! This weekend I didn't have the Bioloid with me, so I couldn't verify, but I've just turned it on, and the baudrate was set at 2Mbps. Now it works.

Thank you for your help!
@ Fritzoid

You were right! This weekend I didn't have the Bioloid with me, so I couldn't verify, but I've just turned it on, and the baudrate was set at 2Mbps. Now it works.

Thank you for your help!
Mirko
Robot Builder
Robot Builder
Posts: 7
Joined: Thu Jun 03, 2010 3:54 pm

PreviousNext
289 postsPage 16 of 201 ... 13, 14, 15, 16, 17, 18, 19, 20
289 postsPage 16 of 201 ... 13, 14, 15, 16, 17, 18, 19, 20