Thread: Robotics Programming

  1. #1
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719

    Cool Robotics Programming

    Guten Tag! I was looking at some of my robotics books and I have been trying to get into it again. I'm really interested in building some simple stuff, and then programming it to do certain tasks (sense a wall, sense light, etc.). I've heard of the BASIC Stamp, and was wondering if it was any good? It's a bit pricey so I don't want to waste money on a crap product! I want something simple to start out with so I can get a feel of programming robots. Is it similar to making programs for computers? I've seen some robots programmed with some crazy assembly language. If it's like that then I don't want any part with it, since that stuff is just insane! Thank you!

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Well the programming end is making sure you remember all the steps. I personally find the hard part of robotics is... well... the robot. I know nothing about most electronics, but I imagine after all the components of the robot are built in, then programming it is exactly like programming anything else. You take your data from your inputs, parse it, analyse it, send your results to the output. I'm most likely not considering the extreme difficulty of actually interpreting whatever signals a motion sensor might send to the processor or how to even make it interpretable, but once you have everything come in as 1s and 0s, it should be no different than making a rendered object move around in a rendered 3d environment.
    Sent from my iPad®

  3. #3
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    If you get sensors, µcontrollers etc make sure you can program in a higher level language like C or whatever, then compile it to the appropriate hex format for the µcontroller. Else you'll have to fiddle in assembly, but I think no matter what, you will have to mess with assembler.

    And yes most manufacturers can have their own instruction set, even 2 diff. µcontrollers from the same manufacturer can have a diff. instruction set ... so yes it can be somewhat difficult to remember all of this ... but then again we have datasheets for something .

    This year there was this project from fellow students and the goal was to build a robot that could follow a line without any intervention from some person. I saw the demo and it was awesome ... not to disapoint you but it was written in assembly, although there was a C compiler provided by the manufacturer of the µcontroller, but they refused to use it.
    Last edited by GanglyLamb; 08-13-2006 at 03:25 PM.

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    This has been on my Christmas list for years:
    http://mindstorms.lego.com/
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    Can anybody introduce me a µcontroller for a simple robot? This robot should:
    -Move by wheel, so µcontroller should control its wheels and movements.
    -Sense light and decide what to do. For example it should move to the source of light. It can have 8 sensors and move to the direction of the sensor that gets the most light.
    -Should have an internal clock and µcontroller should be able to read the time .
    -It should be programable. For example it programed:
    Code:
    do{ 
        check for the most powerful light source. 
        move in its direction for 15 seconds and stop if the light turned off.
        get the average of light sources.
        go in direction of the sensor with nearest value to average.
    }wait ten seconds
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  6. #6
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by siavoshkc
    Can anybody introduce me a µcontroller for a simple robot?
    Just about any of them. Some search terms: 8051, AVR, MSP430, Freescale, Renesas, Z80, ... to name only a few.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  7. #7
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    I've had that Lego Mindstorms for a while now. It's pretty cool, plus it has a simple program interface, and allows for some complex instructions. But I really want to make things from scratch, and program through an actual language.

  8. #8
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by Sentral
    I've had that Lego Mindstorms for a while now. It's pretty cool, plus it has a simple program interface, and allows for some complex instructions. But I really want to make things from scratch, and program through an actual language.
    Well, I've given you some devices to start Googling. Depending on what you want, you could find something right away or you could search for months. I forgot PIC, and there is of course Intel for chips other than x86 or 8051, and I'm probably forgetting too many more.

    Do you want PWM? Any idea of how many timers? A/D? D/A? DMA? UART? SPI? EEPROM? etc. These are things that will help narrow the search of hundreds of possible devices. What you may need to do is translate from "sense a wall, sense light" into sensors and interfaces. And then find a cheap Dev Kit -- I think Atmel and PIC and TI are pretty good (but I haven't had to fork over cash for any of them). And TI's documentation is my favorite -- don't brush that part aside without realizing its value.

    And down deep in the tranches, even C begins to look like "some crazy assembly language" with all kinds of compiler-specifics raining in. (Though I find it much easier to read the C.)
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  9. #9
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    http://www.robotics.com/arobot/build.html this is a nice site! It's a bit more 'custom' than lego mindstorms.
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  10. #10
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    PIC is really good imo for starters, they have nice developer kits, demo boards etc etc...

    @siavoshkc:

    To control movement by motor, as in which direction it should go, a servo motor should do the trick, since you can decide exactly how many degrees it will turn with by using Pulse Proportional Modulation.

    To move forward and backward you can use a DC motor.

    Sense light and decide what to do. For example it should move to the source of light. It can have 8 sensors and move to the direction of the sensor that gets the most light.
    There are numerous sensors out there, decide first if you want an analog or digital sensor, a digital one is probably easier since you don't have to do the A/D conversion yourself, but this implies that your microcontroller needs more I/O ports. When using an analog, you actually only need 1 input on the µcontroller, and ofcourse an A/D converter in the µcontroller.

    Should have an internal clock and µcontroller should be able to read the time .
    Then you would have to look at µcontrollers that can be kept under constant power by perhaps a battery. Else there's no way to accomplish this, unless you want to use an external source to read the time from on startup...

    -It should be programable. For example it programed:
    ....
    µcontrollers are programmable, the only thing you need to check is if its OTP or whatever, this can save alot of frustration/money/time during development.

  11. #11
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    Thanks for the useful inforamtion. Since it is my first time, I need the simplest µcontroller for this purpose. Even if it doesn't have a clock. Simplicity is in the first priority. Now I am going to googling these 8051, AVR, MSP430, Freescale, Renesas, Z80, ... to get some information about them.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  12. #12
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by Dave_Sinkula
    Just about any of them. Some search terms: 8051, AVR, MSP430, Freescale, Renesas, Z80, ... to name only a few.
    Here's some more that I forgot:
    http://microcontroller.com/EmbeddedSystems.asp?c=9

    I thought there was a nice selector guide on embedded.com years ago, but the closest I've found was this:
    http://i.cmpnet.com/embedded/1999/9902/9902sr.pdf

    Minor point: there are sooo many. Perhaps a site dedicated to robotics, such as the one previously posted -- or others you may already know, may have a narrower list.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  13. #13
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    Where can I find a tutorial about µcontrollers?

    [edit]
    Recently I was in a forum and aske a straight question like the above one. Somebody answered "This forum does not owe you any answer". So I am sorry if it is impolite, it is because of my english weakness. Myabe I should ask:
    Can anybody please give me a link to a tutorial about these stuff?
    Last edited by siavoshkc; 08-15-2006 at 03:43 PM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  14. #14
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    Quote Originally Posted by siavoshkc
    Where can I find a tutorial about µcontrollers?
    I had a course last year about 1 µcontroller. The course lasted 2 semesters and I bet we didnt cover all the things the µcontroller had to offer... ( although it was a very advanced µcontroller as in it had alot of functions PIC 18F4550, although it was on a demo board, which is alot easier to get to know everything )

    If you want to know more about what µcontrollers are etc and what what does yes there will be some tutorials out there I guess. But when it comes down to one specific µcontroller, the datasheet of the µcontroller and the instruction set datatsheet will probably be your best friend..
    Last edited by GanglyLamb; 08-15-2006 at 03:57 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Robotics
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 11-01-2003, 06:34 PM