Let's Make Robots!

TED the BiPed Core Code

 

After building my TED the BiPed (http://letsmakerobots.com/node/35632) and seeing K120189's BoB (http://letsmakerobots.com/node/35865) model take off with the 3D printer members along with a few questions in the ShoutBox about how to code a mini walker I figured I'd share my own version of a "delay-free" core code used on most of my bots. Maybe it will help someone get started at least and more likely someone will re-code it and share their better version. I use the same basic code for the rollers and the walkers but first the disclaimer:

I am NOT an Arduino/C(anything) expert coder - just a self learned BASIC/ASP/VBScript hack that just started looking at Arduino's a few months ago. With that said I am SURE there are many things that should/could be optimized in the code/flow/design... but it works for me at least. If anyone wants to take the core code and optimize/wiz kid it that would be great - but then I'll likely not understand how it works.


Ok, with that out of the way the code is attached here. I originally wrote up a long post explaining how it works but you're all coders and I tried to document the code. Remember, this is the core code to the full TED (and my other bots) and there are features that use some (actually a lot) of the variables, etc elsewhere so the whole thing could be simpler if desired.

Basically the main loop checks for current robot "modes", sets the desired movement, which can then be "subsumed" by sensor and avoidance routines.

The actual WalkForward, etc routines are then split out into the various "frames" or steps required to move and that movement is broken down into "increments" which are updated as the main loop calls the movement routines over and over.

Enough talking - read the code, optimize it for me and then repost it so I can use it - :-)

-Stephen

 

 

AttachmentSize
TEDBiPed_Base.pde29.09 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hello, 

Great project!!

i have a question about the code, what pins are fot the switches and for the LED's ?

 

 

YER!