C Coding

Korean company maker of Robot kits and servos designed for of articulated robots. Re-incarnation of Megarobotics.
57 postsPage 1 of 41, 2, 3, 4
57 postsPage 1 of 41, 2, 3, 4

C Coding

Post by i-Bot » Tue Jul 01, 2008 3:28 pm

Post by i-Bot
Tue Jul 01, 2008 3:28 pm

I don't have my Robobuilder yet, but I did make a new version of the C example with English comments and also to work under AVR Studio and avr-gcc instead of Codevision AVR.

I still need to test it fully on robot, so just to save anybody else the trouble, and also so you don't need to buy Codevision compiler.

The include file generated by the motion editor can still be used, just a simple define required to change the "flash" to "PROG_P". The C code is also changed to the avr-gcc style of using program memory.
I don't have my Robobuilder yet, but I did make a new version of the C example with English comments and also to work under AVR Studio and avr-gcc instead of Codevision AVR.

I still need to test it fully on robot, so just to save anybody else the trouble, and also so you don't need to buy Codevision compiler.

The include file generated by the motion editor can still be used, just a simple define required to change the "flash" to "PROG_P". The C code is also changed to the avr-gcc style of using program memory.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by i-Bot » Tue Jul 01, 2008 5:38 pm

Post by i-Bot
Tue Jul 01, 2008 5:38 pm

Sorry, that should have been:
#define flash PROGMEM

I can't get the examples to compile under Codevision 2 without major changes either, so I think gcc-acr is the way forward.
Sorry, that should have been:
#define flash PROGMEM

I can't get the examples to compile under Codevision 2 without major changes either, so I think gcc-acr is the way forward.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by Florent_Lyon » Tue Jul 08, 2008 6:44 pm

Post by Florent_Lyon
Tue Jul 08, 2008 6:44 pm

Hello,
I have now received my Robobuilder, and in fact I am surprised because I thought the programming tools were supplied in the kit!!

So I'm very interested with this solution using AVR studio.
Furthermore, I already have it installed because I am starting to program easier robots based on an ATmega8.

Waiting for the news... if needed I can make some tests :-)

@+
Florent JANIN, Lyon, France
Hello,
I have now received my Robobuilder, and in fact I am surprised because I thought the programming tools were supplied in the kit!!

So I'm very interested with this solution using AVR studio.
Furthermore, I already have it installed because I am starting to program easier robots based on an ATmega8.

Waiting for the news... if needed I can make some tests :-)

@+
Florent JANIN, Lyon, France
Florent_Lyon offline
Robot Builder
Robot Builder
User avatar
Posts: 12
Joined: Tue Jun 17, 2008 5:44 pm

Re: C Coding

Post by PedroR » Wed Jul 09, 2008 5:07 pm

Post by PedroR
Wed Jul 09, 2008 5:07 pm

i-Bot wrote: .. The include file generated by the motion editor can still be used, just a simple define required to change the "flash" to "PROG_P". The C code is also changed to the avr-gcc style of using program memory.


Hi iBot

I was thinking about creating a simple script/PHP file on the website to make the conversion automatically, so that everybody can convert to avr-gcc easilly.

Could you provide some more info and sample files (original and modified) so that we could get people going?

Thanks
Pedro :)
i-Bot wrote: .. The include file generated by the motion editor can still be used, just a simple define required to change the "flash" to "PROG_P". The C code is also changed to the avr-gcc style of using program memory.


Hi iBot

I was thinking about creating a simple script/PHP file on the website to make the conversion automatically, so that everybody can convert to avr-gcc easilly.

Could you provide some more info and sample files (original and modified) so that we could get people going?

Thanks
Pedro :)
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by limor » Thu Jul 10, 2008 1:00 pm

Post by limor
Thu Jul 10, 2008 1:00 pm

hi, i-Bot have you succeeded in compiling example code in GCC and programming the robot successfully ?

if so it would be great if you post some initial code so that others can help in evolving a GCC compatible library for Robobuilder
hi, i-Bot have you succeeded in compiling example code in GCC and programming the robot successfully ?

if so it would be great if you post some initial code so that others can help in evolving a GCC compatible library for Robobuilder
limor offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by i-Bot » Thu Jul 10, 2008 1:10 pm

Post by i-Bot
Thu Jul 10, 2008 1:10 pm

Here is the code from the example modified to compile under AVR Studio and GCC.
http://robosavvy.com/Builders/i-Bot/ex_avrs.zip


It uses a header file directly built in motion builder from the HunoBasic motion. No changes were made to the header file

It only makes a left punch when PF1 is pressed.
Here is the code from the example modified to compile under AVR Studio and GCC.
http://robosavvy.com/Builders/i-Bot/ex_avrs.zip


It uses a header file directly built in motion builder from the HunoBasic motion. No changes were made to the header file

It only makes a left punch when PF1 is pressed.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by i-Bot » Mon Jul 21, 2008 4:11 pm

Post by i-Bot
Mon Jul 21, 2008 4:11 pm

Is anyone else programming in C for the Robobuilder ?

Got the IR working under C this weekend, and will next do the battery, distance sensor, tilt sensor, and EEPROM. This is unless someone else has already done them. Already added the AVRlib routines for the PC serial port.

I did the IR because I try the PS2 wireless controller into the RBC emulating the IR controller to maintain backward compatibility to the standard code.
Is anyone else programming in C for the Robobuilder ?

Got the IR working under C this weekend, and will next do the battery, distance sensor, tilt sensor, and EEPROM. This is unless someone else has already done them. Already added the AVRlib routines for the PC serial port.

I did the IR because I try the PS2 wireless controller into the RBC emulating the IR controller to maintain backward compatibility to the standard code.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

I'd be interested in seeing the code

Post by l3v3rz » Tue Jul 22, 2008 5:28 pm

Post by l3v3rz
Tue Jul 22, 2008 5:28 pm

i-Bot wrote:Is anyone else programming in C for the Robobuilder ?
Got the IR working under C this weekend, and will next do the battery, distance sensor, tilt sensor, and EEPROM.


have you posted it any where ?

Thanks
i-Bot wrote:Is anyone else programming in C for the Robobuilder ?
Got the IR working under C this weekend, and will next do the battery, distance sensor, tilt sensor, and EEPROM.


have you posted it any where ?

Thanks
l3v3rz offline
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by i-Bot » Tue Jul 22, 2008 6:09 pm

Post by i-Bot
Tue Jul 22, 2008 6:09 pm

I have not posted it, though am very happy to share it.

I was not sure from the post from Limor if others may be taking a more structured approach to building a library. I would be willing to fall in with that.

Also the level of interest for programming in C is not clear. Seems sort of quiet so far.
I have not posted it, though am very happy to share it.

I was not sure from the post from Limor if others may be taking a more structured approach to building a library. I would be willing to fall in with that.

Also the level of interest for programming in C is not clear. Seems sort of quiet so far.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by Florent_Lyon » Wed Jul 23, 2008 6:07 am

Post by Florent_Lyon
Wed Jul 23, 2008 6:07 am

I-bot,
I am also very interested in C programming,
but I would say I have school level... so I wait for the holidays to have more time to spend on it.

I think you have been the quickest to start with C coding, but of course it's interesting and constructive!

I would like to help on that, but I think I'll have more questions than solutions...

Florent JANIN, Lyon, France
I-bot,
I am also very interested in C programming,
but I would say I have school level... so I wait for the holidays to have more time to spend on it.

I think you have been the quickest to start with C coding, but of course it's interesting and constructive!

I would like to help on that, but I think I'll have more questions than solutions...

Florent JANIN, Lyon, France
Florent_Lyon offline
Robot Builder
Robot Builder
User avatar
Posts: 12
Joined: Tue Jun 17, 2008 5:44 pm

Post by careyg » Wed Jul 23, 2008 12:49 pm

Post by careyg
Wed Jul 23, 2008 12:49 pm

Got my RoboBuilder last week, currently still learning how to make workable motions (it's not as easy as it looks, is it? anyone have pointers) - once i'm happy here, I'll be looking to turn to C Coding for control.

However, all being well, a new dog arrives to us next week, so I guess it'll be a week or two until I get back to it :)

Gav.
Got my RoboBuilder last week, currently still learning how to make workable motions (it's not as easy as it looks, is it? anyone have pointers) - once i'm happy here, I'll be looking to turn to C Coding for control.

However, all being well, a new dog arrives to us next week, so I guess it'll be a week or two until I get back to it :)

Gav.
careyg offline
Robot Builder
Robot Builder
Posts: 21
Joined: Tue Jul 01, 2008 10:20 pm

Post by i-Bot » Thu Jul 24, 2008 11:40 am

Post by i-Bot
Thu Jul 24, 2008 11:40 am

I put the IR code I worked on here:
http://robosavvy.com/Builders/i-Bot/RobobuilderIR.zip

The example only checks the IR for a character and sends the character to the CPU serial port in the example. To make the IR change the moves, it just needs a to change the pointers at the bottom of the comm.c file based on the received code. I will do this, but am rather busy on the PS2 controller and hip rotation.

The IR receive is done mainly in the interrupt routine for the external interrupt 6, though it also uses timer 2 for timing the receiver and for a timeout interrupt.

My IR controller has the address
#define IR_ADDRESS 0x2B // Address code from IR
I don't know if they vary, so please try it and let me know. I do check the address, though this could be disabled.

gIRReady is TRUE when a code is received and gIRData contains the code. The code is according to the pdf file and ranges from 0x01 to 0x3f.

I am using the AVRlib from Pascal Stang, which contains lots of other useful bits of code.
I put the IR code I worked on here:
http://robosavvy.com/Builders/i-Bot/RobobuilderIR.zip

The example only checks the IR for a character and sends the character to the CPU serial port in the example. To make the IR change the moves, it just needs a to change the pointers at the bottom of the comm.c file based on the received code. I will do this, but am rather busy on the PS2 controller and hip rotation.

The IR receive is done mainly in the interrupt routine for the external interrupt 6, though it also uses timer 2 for timing the receiver and for a timeout interrupt.

My IR controller has the address
#define IR_ADDRESS 0x2B // Address code from IR
I don't know if they vary, so please try it and let me know. I do check the address, though this could be disabled.

gIRReady is TRUE when a code is received and gIRData contains the code. The code is according to the pdf file and ranges from 0x01 to 0x3f.

I am using the AVRlib from Pascal Stang, which contains lots of other useful bits of code.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by l3v3rz » Thu Jul 24, 2008 6:16 pm

Post by l3v3rz
Thu Jul 24, 2008 6:16 pm

Tried the code out. Required me to remove the Address check on the IR for it to work. But once done, everything worked perfectly. Nice looking code. Mic and PSD sensor next ?

BTW how have you got access to the hip rotation brackets ?- or are you making your own?
Tried the code out. Required me to remove the Address check on the IR for it to work. But once done, everything worked perfectly. Nice looking code. Mic and PSD sensor next ?

BTW how have you got access to the hip rotation brackets ?- or are you making your own?
l3v3rz offline
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by i-Bot » Fri Jul 25, 2008 9:45 am

Post by i-Bot
Fri Jul 25, 2008 9:45 am

I am please it worked for you.

The format of the message from the IR controller is 4 bytes. The last byte contains the button pressed data.

On my controller the first byte is 0x2B and the second is 0x02, and I assumed the first is the address. All 4 bytes are in IRTemp[], so can be read. You could read IRTemp[0] for your own address. It would be also good to know if IRTEmp[1] is also 0x02 for you.

Maybe Robobuilder can confirm ?

For the hip rotation, I am making my own till we see availability and price from Robobuilder. There seem to be two styles from Robobuilder, one with the side to side hip servos (0 and 5) horizontal in the manual, and one with them at an angle in pictures from Pedro. I decided to use carbon fibre because the aluminium looks too weak to me. I am still waiting for the CF angle to be delivered. I bought a couple of 1111K and fitted these as servo 1 and 6. I made CF thigh plates to add strength there. Original servos 1 and 6 become the hip rotation as servo 16 and 17. The pivot of the servos 0 and 5 now seems to be about 2 cm lower, so I'm not sure how the moves will be affected.
I am please it worked for you.

The format of the message from the IR controller is 4 bytes. The last byte contains the button pressed data.

On my controller the first byte is 0x2B and the second is 0x02, and I assumed the first is the address. All 4 bytes are in IRTemp[], so can be read. You could read IRTemp[0] for your own address. It would be also good to know if IRTEmp[1] is also 0x02 for you.

Maybe Robobuilder can confirm ?

For the hip rotation, I am making my own till we see availability and price from Robobuilder. There seem to be two styles from Robobuilder, one with the side to side hip servos (0 and 5) horizontal in the manual, and one with them at an angle in pictures from Pedro. I decided to use carbon fibre because the aluminium looks too weak to me. I am still waiting for the CF angle to be delivered. I bought a couple of 1111K and fitted these as servo 1 and 6. I made CF thigh plates to add strength there. Original servos 1 and 6 become the hip rotation as servo 16 and 17. The pivot of the servos 0 and 5 now seems to be about 2 cm lower, so I'm not sure how the moves will be affected.
i-Bot offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by l3v3rz » Fri Jul 25, 2008 5:01 pm

Post by l3v3rz
Fri Jul 25, 2008 5:01 pm

I have got the PSD sensor working. Moving on to Mic and Voltage. Same basic routine so will post code when I have all three going.
I have got the PSD sensor working. Moving on to Mic and Voltage. Same basic routine so will post code when I have all three going.
l3v3rz offline
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Next
Next
57 postsPage 1 of 41, 2, 3, 4
57 postsPage 1 of 41, 2, 3, 4
cron