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

C library update

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

C library update

Post by StuartL » Mon Apr 14, 2008 9:07 am

Post by StuartL
Mon Apr 14, 2008 9:07 am

The last few weeks have seen big progress in my C library for CM-5/dynamixel development. Particular progress has been made by my mate Matt whose girlfriend is currently out of the country and he has nothing better to do than fix code ;)

It seems that the example.c supplied by Robotis has a million bugs, most of which are stupid errors like using bit indices as mask values instead of _BV(). It also does lots of silly things like turn on the charging circuit by default, which I think may have caused some of my battery woes (see other threads) by overcharging the packs without realising it.

Lesson learned: Don't trust the example.c if you're writing your own code. By all means use it as an indicator of capability and methodology but DO get the Atmel M128 PDF and made sure all the register initialisations do exactly what they should. Pay particular attention to their use of masking bits with #defines...

The library is coming along, although it's still not a library at the moment, and now has a few more features (auto detecting zigbee/serial cable, Delta-V charging (thanks Dewey), printf() support on serial or zigbee, full version control in Mercurial).

Next stage, I think, is to split it into a real library with its own Makefile so that Matt can play with my snake (not a euphenism) and I can play with the humanoid (again not a euphenism) without having two separate copies of the library source.

If anyone wishes to donate hardware I'm happy to write library support for it. I'm thinking of Hamid's camera and Jon's IMU here. Tasteless touting for freebies, I know, but it'll save me paying money for them when I inevitably decide I need to... ;)
The last few weeks have seen big progress in my C library for CM-5/dynamixel development. Particular progress has been made by my mate Matt whose girlfriend is currently out of the country and he has nothing better to do than fix code ;)

It seems that the example.c supplied by Robotis has a million bugs, most of which are stupid errors like using bit indices as mask values instead of _BV(). It also does lots of silly things like turn on the charging circuit by default, which I think may have caused some of my battery woes (see other threads) by overcharging the packs without realising it.

Lesson learned: Don't trust the example.c if you're writing your own code. By all means use it as an indicator of capability and methodology but DO get the Atmel M128 PDF and made sure all the register initialisations do exactly what they should. Pay particular attention to their use of masking bits with #defines...

The library is coming along, although it's still not a library at the moment, and now has a few more features (auto detecting zigbee/serial cable, Delta-V charging (thanks Dewey), printf() support on serial or zigbee, full version control in Mercurial).

Next stage, I think, is to split it into a real library with its own Makefile so that Matt can play with my snake (not a euphenism) and I can play with the humanoid (again not a euphenism) without having two separate copies of the library source.

If anyone wishes to donate hardware I'm happy to write library support for it. I'm thinking of Hamid's camera and Jon's IMU here. Tasteless touting for freebies, I know, but it'll save me paying money for them when I inevitably decide I need to... ;)
StuartL
Savvy Roboteer
Savvy Roboteer
Posts: 350
Joined: Mon Jun 04, 2007 3:46 pm
Location: Thatcham, Berkshire, UK

Post by i-Bot » Mon Apr 14, 2008 3:44 pm

Post by i-Bot
Mon Apr 14, 2008 3:44 pm

Does your C library have a function to play motion files ?

I don't see this capability in the C library of the expert kit either.

Has anyone written one yet ? It would be a valuable addition.
Does your C library have a function to play motion files ?

I don't see this capability in the C library of the expert kit either.

Has anyone written one yet ? It would be a valuable addition.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by limor » Tue Apr 15, 2008 11:16 pm

Post by limor
Tue Apr 15, 2008 11:16 pm

please share the new library :lol:

you can upload it here
please share the new library :lol:

you can upload it here
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by kennethw » Fri Apr 18, 2008 2:38 am

Post by kennethw
Fri Apr 18, 2008 2:38 am

Awesome! I had just started to peek at the example.c file and it seemed quite hairy. I hope we can see your lib at some point. =)
Awesome! I had just started to peek at the example.c file and it seemed quite hairy. I hope we can see your lib at some point. =)
kennethw
Robot Builder
Robot Builder
Posts: 17
Joined: Wed Dec 19, 2007 12:17 am

Post by StuartL » Fri Apr 18, 2008 7:54 am

Post by StuartL
Fri Apr 18, 2008 7:54 am

We're getting closer :)
We're getting closer :)
StuartL
Savvy Roboteer
Savvy Roboteer
Posts: 350
Joined: Mon Jun 04, 2007 3:46 pm
Location: Thatcham, Berkshire, UK

Post by StuartL » Wed Jun 11, 2008 4:47 pm

Post by StuartL
Wed Jun 11, 2008 4:47 pm

Right, the C library is imminently going to be available for release.

Release will initially be under a stock open source licence, will take the form of a 'lib' directory, a Makefile and an example main.c. There will be NO documentation released with the library although obviously I'll help out where I can.

The intention initially is for those with experience in embedded C to be able to use the library without having to troubleshoot all of those horrible interrupt handlers, volatile global variables and double buffering of packets.

Community contribution, patches, documentation and suggestions are very welcome. I will probably set up a distribution list for this.

Right now there are two outstanding issues to be resolved and it'll be released. Unless I think of something else I want in the initial release.

The latest and greatest feature, after finding the servos repeatedly renumbering each other to ID '1', is that on startup it will ping each and every servo ID (yes, that takes time at the moment) and verify that you have the exact configuration you've defined in your application. If your robot is not configured how you expect it will refuse to execute your application, prompting you to fix the configuration first.

Right now there are no steps made towards playing back motion files although this is something I will very willingly incorporate if someone can start reverse engineering/documenting the file format.
Right, the C library is imminently going to be available for release.

Release will initially be under a stock open source licence, will take the form of a 'lib' directory, a Makefile and an example main.c. There will be NO documentation released with the library although obviously I'll help out where I can.

The intention initially is for those with experience in embedded C to be able to use the library without having to troubleshoot all of those horrible interrupt handlers, volatile global variables and double buffering of packets.

Community contribution, patches, documentation and suggestions are very welcome. I will probably set up a distribution list for this.

Right now there are two outstanding issues to be resolved and it'll be released. Unless I think of something else I want in the initial release.

The latest and greatest feature, after finding the servos repeatedly renumbering each other to ID '1', is that on startup it will ping each and every servo ID (yes, that takes time at the moment) and verify that you have the exact configuration you've defined in your application. If your robot is not configured how you expect it will refuse to execute your application, prompting you to fix the configuration first.

Right now there are no steps made towards playing back motion files although this is something I will very willingly incorporate if someone can start reverse engineering/documenting the file format.
StuartL
Savvy Roboteer
Savvy Roboteer
Posts: 350
Joined: Mon Jun 04, 2007 3:46 pm
Location: Thatcham, Berkshire, UK

Flash Motion pages playback in C

Post by joerg.wolf » Wed Jun 11, 2008 7:18 pm

Post by joerg.wolf
Wed Jun 11, 2008 7:18 pm

There is a motion playback software I made last year:

it can be downloaded here:

http://www.swrtec.de/swrtec/hurosot/

( click on Download BL Version 0.12 )

If this is any help ?

regards,
Joerg
There is a motion playback software I made last year:

it can be downloaded here:

http://www.swrtec.de/swrtec/hurosot/

( click on Download BL Version 0.12 )

If this is any help ?

regards,
Joerg
joerg.wolf
Robot Builder
Robot Builder
User avatar
Posts: 8
Joined: Wed Jun 20, 2007 4:57 pm

Re: Flash Motion pages playback in C

Post by limor » Wed Jun 11, 2008 11:29 pm

Post by limor
Wed Jun 11, 2008 11:29 pm

joerg.wolf wrote:There is a motion playback software I made last year:

it can be downloaded here:

http://www.swrtec.de/swrtec/hurosot/

( click on Download BL Version 0.12 )

If this is any help ?

regards,
Joerg


Thanks for sharing the code!!
there's not a lot of documentation in the code so please correct the following:
1) this is code that runs on the CM5?
2) the CM5 is linked to an analog input gyro ?
3) the code reads from the PDA commands and executes motions there were produced by standard Motion-Editor and are stored on EEPROM?
joerg.wolf wrote:There is a motion playback software I made last year:

it can be downloaded here:

http://www.swrtec.de/swrtec/hurosot/

( click on Download BL Version 0.12 )

If this is any help ?

regards,
Joerg


Thanks for sharing the code!!
there's not a lot of documentation in the code so please correct the following:
1) this is code that runs on the CM5?
2) the CM5 is linked to an analog input gyro ?
3) the code reads from the PDA commands and executes motions there were produced by standard Motion-Editor and are stored on EEPROM?
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by joerg.wolf » Thu Jun 12, 2008 10:46 am

Post by joerg.wolf
Thu Jun 12, 2008 10:46 am

1) this is code that runs on the CM5?
2) the CM5 is linked to an analog input gyro ?
3) the code reads from the PDA commands and executes motions there were produced by standard Motion-Editor and are stored on EEPROM?


Hi Limor,

1) The code is for a CM5 correct.
2) There is code for an analog input Gyro, correct, but it is not active, is just something to play around with.
3) You can make it play pages from the Motion editor when you send a command from the PC or PDA to the CM5.
The command is described in "BLC-Protocol.h":
Code: Select all
0  1  2  3  4  5  6  7  8  9
   C                 C  C
[  O  P1 P2 P3 P4 P5 R  R  ]
   M                 C  C


COM stands for "command"
Px stands for "Parameter"

if COM == DO_PAGE then P1 contains the page number
if COM == DO_POSE then P1 contains the page number and P2 the pose number
if COM == STOP_NOW then the robot will freeze imidiately
if COM == STOP_POSE then the robot will stop at the end of the next pose
if COM == STOP_PAGE then the robot will stop at the end of the next page
if COM == VERSION then the robot will reply with a text string [BLV1.11]
(Useful command to see if the robot controller is connected)
if COM == TURN_SERVO then P1 = servono , P2 = HSB Pos , P3 = LSB Pos, P4 = HSB Speed , P5 = LSB Speed

regards,
Joerg :)
1) this is code that runs on the CM5?
2) the CM5 is linked to an analog input gyro ?
3) the code reads from the PDA commands and executes motions there were produced by standard Motion-Editor and are stored on EEPROM?


Hi Limor,

1) The code is for a CM5 correct.
2) There is code for an analog input Gyro, correct, but it is not active, is just something to play around with.
3) You can make it play pages from the Motion editor when you send a command from the PC or PDA to the CM5.
The command is described in "BLC-Protocol.h":
Code: Select all
0  1  2  3  4  5  6  7  8  9
   C                 C  C
[  O  P1 P2 P3 P4 P5 R  R  ]
   M                 C  C


COM stands for "command"
Px stands for "Parameter"

if COM == DO_PAGE then P1 contains the page number
if COM == DO_POSE then P1 contains the page number and P2 the pose number
if COM == STOP_NOW then the robot will freeze imidiately
if COM == STOP_POSE then the robot will stop at the end of the next pose
if COM == STOP_PAGE then the robot will stop at the end of the next page
if COM == VERSION then the robot will reply with a text string [BLV1.11]
(Useful command to see if the robot controller is connected)
if COM == TURN_SERVO then P1 = servono , P2 = HSB Pos , P3 = LSB Pos, P4 = HSB Speed , P5 = LSB Speed

regards,
Joerg :)
joerg.wolf
Robot Builder
Robot Builder
User avatar
Posts: 8
Joined: Wed Jun 20, 2007 4:57 pm

Post by JavaRN » Thu Jun 12, 2008 4:07 pm

Post by JavaRN
Thu Jun 12, 2008 4:07 pm

I downloaded this code (to play motions stored in eeprom) a couple of days ago and played around with it to get working version for my own needs (removing the communication with the PDA etc) if jeorg.wolf gives me permission I can post it on the forum.

Charles
I downloaded this code (to play motions stored in eeprom) a couple of days ago and played around with it to get working version for my own needs (removing the communication with the PDA etc) if jeorg.wolf gives me permission I can post it on the forum.

Charles
F'dan il-passatemp ghandek bzonn zewg affarijiet - FLUS u HIN. Zewg affarijiet li huma skarsi hafna u li jien minnhom ghandi vera ftit!
JavaRN
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 282
Joined: Fri Mar 02, 2007 11:01 pm

Post by joerg.wolf » Thu Jun 12, 2008 6:08 pm

Post by joerg.wolf
Thu Jun 12, 2008 6:08 pm

Hi Charles alias JavaRN,

Ofcourse you can publish the modified version of BLV012. Just keep a reference to the original authors and include yourself.

If you point out in the header file somewhere what is different between our and your code it would help to make it clear to others.

If a view people are interested we can set up a open-source project for it.

Joerg
Hi Charles alias JavaRN,

Ofcourse you can publish the modified version of BLV012. Just keep a reference to the original authors and include yourself.

If you point out in the header file somewhere what is different between our and your code it would help to make it clear to others.

If a view people are interested we can set up a open-source project for it.

Joerg
joerg.wolf
Robot Builder
Robot Builder
User avatar
Posts: 8
Joined: Wed Jun 20, 2007 4:57 pm

Post by JavaRN » Thu Jun 12, 2008 7:17 pm

Post by JavaRN
Thu Jun 12, 2008 7:17 pm

The part I used from the BLV02 project are the files motion.h and motion.c (the other parts (to communicate with dynamixels I got them from example.c and some other programs I found on the net, and of course some of my own code). Since I don't have a library yet, I mean a .O file I placed everything in a .h file. I will try to place the code this weekend, I'll add some other comments to it, and may be people can modify it for their own needs.

Charles
The part I used from the BLV02 project are the files motion.h and motion.c (the other parts (to communicate with dynamixels I got them from example.c and some other programs I found on the net, and of course some of my own code). Since I don't have a library yet, I mean a .O file I placed everything in a .h file. I will try to place the code this weekend, I'll add some other comments to it, and may be people can modify it for their own needs.

Charles
F'dan il-passatemp ghandek bzonn zewg affarijiet - FLUS u HIN. Zewg affarijiet li huma skarsi hafna u li jien minnhom ghandi vera ftit!
JavaRN
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 282
Joined: Fri Mar 02, 2007 11:01 pm

Post by StuartL » Tue Jun 17, 2008 7:25 am

Post by StuartL
Tue Jun 17, 2008 7:25 am

Ok, release is now available. However I haven't yet created any example files. Without them it'd be hard work for any of you to figure out what's going on.

Quick straw poll, then, do you want the zip with the library now or wait until I have a spare evening to throw together some examples? Given the Thinktank event is in 10 days this may not be soon... :)
Ok, release is now available. However I haven't yet created any example files. Without them it'd be hard work for any of you to figure out what's going on.

Quick straw poll, then, do you want the zip with the library now or wait until I have a spare evening to throw together some examples? Given the Thinktank event is in 10 days this may not be soon... :)
StuartL
Savvy Roboteer
Savvy Roboteer
Posts: 350
Joined: Mon Jun 04, 2007 3:46 pm
Location: Thatcham, Berkshire, UK

Post by Fritzoid » Mon May 03, 2010 12:07 pm

Post by Fritzoid
Mon May 03, 2010 12:07 pm

A simple program that sends ASCII commands to the CM-510 firmware can initiate a motion using the PLAY command. Try it in terminal mode.
A simple program that sends ASCII commands to the CM-510 firmware can initiate a motion using the PLAY command. Try it in terminal mode.
Fritzoid
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 331
Joined: Mon Dec 18, 2006 1:00 am

Post by roeiki11 » Tue May 04, 2010 7:35 am

Post by roeiki11
Tue May 04, 2010 7:35 am

I tried doing that on my CM-5 with no success
can you help?
I tried doing that on my CM-5 with no success
can you help?
roeiki11
Newbie
Newbie
Posts: 3
Joined: Sun May 02, 2010 11:32 am

Next
18 postsPage 1 of 21, 2
18 postsPage 1 of 21, 2