Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: Programming Languages for Robotics

  1. #1

    Programming Languages for Robotics

    I thought I would create a place to discuss various programming languages used for Robotics, pros and cons of each, hardware usage, etc.

    For instance, I use C and Python at present. Python can interface with C/C++ modules for speed and to do things it can not do natively. This is how Python is extended. Python is an interpreted scripting language, so it won't be as fast as a compiled language such as C/C++. However, Python code can be easily modified on the fly and results can be seen instantly because there is no compile step as with C/C++ and other compiled languages.

    I plan to use Python on W.A.L.T.E.R. because of its interpreted nature and the ability to login to the robot and change code, and then let it continue running. I will be able to optimize speed on critical modules by writing them in C/C++ and interfacing them to Python. One other nice aspect of Python and other scripting languages, is they can be embedded within an application to allow customization and modification of behaviors.

    Python also takes up much less space than having a native C/C++ toolchain on a robot, so would be better for a very storage limited system. Other interpreted languages, such as Ruby, TCL, PHP (yes, I said PHP), and others, would have similar benefits.

    8-Dale
    I can handle complexity. It's the simple things that confound me.
    Do everything in moderation, ESPECIALLY, moderation..
    Sometimes the only way to win, is not to play.. -- Stephen Falken

  2. Re: Programming Languages for Robotics

    I use Squeak, which is a version of Smalltalk. Squeak, like Python, is an interpreted language, and it has all the same benefits.

    The main reason I use Squeak is because I have been programming in Smalltalk for 20 years now, and I can make it sing and dance quite nicely...

    Some example Squeak robotics stuff I have written:

    http://www.huv.com/roboMagellan - go to the bottom of the page to see my old mission editor

    MicroRaptor GUIs - some user interface front-ends for my current "brain" system.

    Of course, for both of those, all you are seeing there is the front end - there is a much larger "back end" that is actually doing all the interesting stuff.

    - Jon

  3. #3

    Re: Programming Languages for Robotics

    Quote Originally Posted by JonHylands View Post
    I use Squeak, which is a version of Smalltalk. Squeak, like Python, is an interpreted language, and it has all the same benefits.
    I would also like to be able to use Squeak, but it does not seem to have any facilities for low level access to devices using I2C or SPI. I need that for my robot because I will be using I2C as a communications medium for sensors and 'smart' modules. For Squeak, I would probably want to use a small Seaside image, because I want my robot to have a web as well as IRC presence on the internet.

    Quote Originally Posted by JonHylands View Post
    Some example Squeak robotics stuff I have written:

    http://www.huv.com/roboMagellan - go to the bottom of the page to see my old mission editor

    MicroRaptor GUIs - some user interface front-ends for my current "brain" system.
    You software is beyond cool, Jon!

    Quote Originally Posted by JonHylands View Post
    Of course, for both of those, all you are seeing there is the front end - there is a much larger "back end" that is actually doing all the interesting stuff.
    I'd be very interested in seeing what is behind the Squeak doors, Jon, but that should be left for a new thread on "Squeak and Robotics." I love the idea of using an AI type language for Robotics, because it opens up many more possibilities.

    8-Dale
    I can handle complexity. It's the simple things that confound me.
    Do everything in moderation, ESPECIALLY, moderation..
    Sometimes the only way to win, is not to play.. -- Stephen Falken

  4. #4

    Re: Programming Languages for Robotics

    <Crossposted>

    Quote Originally Posted by tom_chang79 View Post
    The way I "translate" code from language to language is just understand the algorithm and the program flow and the data structures, and implement those with syntax of the other...
    For the conversions I was doing, the new C software version had to spit out numbers just as close as possible to the original BASIC code. The documentation couldn't require more than the most minor of changes.

    Quote Originally Posted by tom_chang79 View Post
    It's true that languages only differ only in syntax, but before choosing any language, one must consider what "level" the language sits at. The higher the level a language is, the further away you are from the hardware with layers of abstraction...
    There are more differences than just syntax. The way a language does things comes into play also. It's not a matter of how high level a language is (all that are not assembly are high level, IMO), but whether the language allows you to get the job done you are trying to do. Some languges are meant for specific purposes, such as APL (Mathematics, might be great for IK/FK and complex navigation calculations, etc). There is also FORTH, ADA, JAVA, and others, in no particular order.

    Quote Originally Posted by tom_chang79 View Post
    For every application, a developer must fully understand what their objectives are in the project. After you fully understand what your objectives are then you can choose which language/level you should develop in.
    This is only true in an ideal situation, which most are not. You also have to look at the capabilities of the programming language(s) you are considering using, any OS you are going to use, etc. You do have to understand your objectives before going too far though, or you will almost always get into problems right away. You have to properly define what you want to accomplish overall, not just one part of your project. Some programming languages will be fine to start with but then start causing you problems further into implementation.

    Quote Originally Posted by tom_chang79 View Post
    Please don't misconstrue "High Level" and "Low Level" as a measure of difficulty. A "Low Level" just means "closer to the hardware" and "High Level" means "further from the hardware."
    Being closer to or further from the hardware just means having the right device driver or other device code available. It really hasn't got anything to do with the programming language itself. An OS can get in the way of accessing hardware. For instance, Windows makes it more difficult to access drivers and devices directly than Linux or UNIX does. Programming bare metal makes it the easiest to access the hardware because you don't have any OS to potentially get in the way. Even Linux, or any other OS, gets in the way of hardware access to varying degrees.

    8-Dale
    I can handle complexity. It's the simple things that confound me.
    Do everything in moderation, ESPECIALLY, moderation..
    Sometimes the only way to win, is not to play.. -- Stephen Falken

  5. #5
    Join Date
    Mar 2008
    Location
    Jupiter
    Posts
    238
    Rep Power
    40

    Re: Programming Languages for Robotics

    And thats were i get confused... im always puzzled how other languages come out for microcontroller but dont work on others... For example the Propellor is programmed in Spin and Assembler but doesnt have Basic... The same as Basic stamp only has basic and doesnt have spin and assembler or other languages.

    That kind of thing just really confuses me, and pretty much intimidates me from getting new chips like the dsPIC or the prop.

    For some reason i guess i have it in my head that for every new controller i get im always almost going to have to learn a new language.

  6. #6

    Re: Programming Languages for Robotics

    Quote Originally Posted by Wingzero01w View Post
    And thats were i get confused... im always puzzled how other languages come out for microcontroller but dont work on others... For example the Propellor is programmed in Spin and Assembler but doesnt have Basic... The same as Basic stamp only has basic and doesnt have spin and assembler or other languages.
    It has to do with what the manufacturer of the chip has in mind for it.

    In the case of the Propeller Chip, Parallax no doube felt that a new language was needed for several reasons.

    1) They didn't want the Propeller to be confused with other microcontrollers. The Propeller is a multitasking chip, very different from other current microcontrollers

    2) The PBASIC dialect did not have the language constructs because the Basic STAMP has no capability to multitask at all.

    3) The Propeller has a completely difference architecture from existing microcontrollers, such as the Basic STAMP, Basic Micro Atom/Atom PRO, etc. A new language was clearly needed to accomodate this new chip.

    4) It was easier to create a brand new language rather than try extending an existing one. This way, all new features of the Propeller could be accommodated from the start.

    I can't say any of these reasons influenced Parallax for sure, because they are just guesses and I don't have any inside information from Parallax and don't currently use the Propeller.

    Quote Originally Posted by Wingzero01w View Post
    That kind of thing just really confuses me, and pretty much intimidates me from getting new chips like the dsPIC or the prop.
    Welcome to the land of embedded computing! Other than C/C++ and similar languages, you won't likely find any standard amongst microcontrollers. Even with C, there will be different constructs for access to registers and other memory and I/O features based on the specific microcontroller. If you don't know C, then I strongly suggest you learn it because this will be as close to a language standard amongst microcontrollers as you will find. That is, at least until you get into the ARM9, Blackfin, Coldfire, i.MX21 (and other i.MX series controllers), and of course the x86 and other similar platforms, you won't have much of a choice of languages.

    Quote Originally Posted by Wingzero01w View Post
    For some reason i guess i have it in my head that for every new controller i get im always almost going to have to learn a new language.
    This will be true until you get away from the proprietary, closed door, microcontroller platforms. Once you get to the ARM9 and larger or faster platforms, you will be stuck learning a new variant of language for each microcontroller. You need to be into a C programmable microcontroller for this to change (Microchip PICs/dsPICs, Atmel AVRs, etc).

    8-Dale
    I can handle complexity. It's the simple things that confound me.
    Do everything in moderation, ESPECIALLY, moderation..
    Sometimes the only way to win, is not to play.. -- Stephen Falken

  7. #7
    Join Date
    Mar 2008
    Location
    Jupiter
    Posts
    238
    Rep Power
    40

    Re: Programming Languages for Robotics

    Wow, thanks Robotguy that really really cleared things up.

    For a starter in embedded computing, what would be a good way to learn about chips and programming them (dsPIC, C) that wont really intimidate the living daylights out of a newbie (and that wont totally demolish my robotics budget.) I really would like to learn this type of stuff so one day i could develop interface boards for robotics and such. My current project i want to work on is controlling a dynamixel bus, standard servo bus, and motor control all from some type of micro controller or two on the same board.

    I also wouldn't mind learning C, i think it would be really beneficial for the type of job i want to get eventually. And well, what would be the best way of learning this?

  8. #8

    Re: Programming Languages for Robotics

    Quote Originally Posted by Wingzero01w View Post
    Wow, thanks Robotguy that really really cleared things up.
    One is glad to be of service.

    Quote Originally Posted by Wingzero01w View Post
    For a starter in embedded computing, what would be a good way to learn about chips and programming them (dsPIC, C) that wont really intimidate the living daylights out of a newbie (and that wont totally demolish my robotics budget.)
    If you are really serious about getting into embedded computing, not just for robots, I suggest looking at the PICs/ds/PICs or AVRs. Microchip is happy to send you samples and you can place orders twice every 30 days. MPLAB and the Student Edition C compilers for both PIC and dsPIC are FREE even after the trial runs out - you just lose some compiler optimizations people tell me won't really be missed. You will be working in Windows for this development. I would start with the PIC18F2550, 18F2620, 18F4550, and 18F4620. Oricom Technologis makes a board you can put the 18F4620, 18F4680, and any pin compatible PIC right on. The 18F4550 (40 pin) and 18F2550 (28 pin) have USB and can be bootloaded once you have flashed a bootloader to them. For programming/debugging, I strongly recommed the Olimex USB ICD2 - I have and use one of these everytime I work with PICs/dsPICs.

    For the Atmel AVRs like the Atmega168 (chips are inexpensive) and Atmega128 (Spark Fun has inexpensive breakout boards, programmers, etc) there are also free tools available such as AVRStudio (Windows) and free tools for Linux. I don't have a recommendation for a programmer/debugger for AVRs because I have not gotten into using them yet.

    Quote Originally Posted by Wingzero01w View Post
    I really would like to learn this type of stuff so one day i could develop interface boards for robotics and such. My current project i want to work on is controlling a dynamixel bus, standard servo bus, and motor control all from some type of micro controller or two on the same board.
    Start out by writing a program to blink one LED, then add more, then sequence them. This is how I started out with PICs, and it is a good and fun way to start out with any new microcontroller. Then you can learn to control the brightness of one LED using PWM, then several. Check your local bookstore for PIC programming and project books. There are some with an emphasis on robotics also.

    Quote Originally Posted by Wingzero01w View Post
    I also wouldn't mind learning C, i think it would be really beneficial for the type of job i want to get eventually. And well, what would be the best way of learning this?
    Learning C (and C++) is a requirement for most of the really good jobs that have anything to do with software development. Learn it well! Learn about what goes on under the hood when your software project is being built. JAVA would also be a good one to learn, but I have not gotten much into it yet.

    8-Dale
    I can handle complexity. It's the simple things that confound me.
    Do everything in moderation, ESPECIALLY, moderation..
    Sometimes the only way to win, is not to play.. -- Stephen Falken

  9. #9
    Join Date
    Sep 2006
    Location
    Carol Stream, Illinois
    Posts
    1,695
    Images
    118
    Rep Power
    105

    Re: Programming Languages for Robotics

    Has anybody messed around with the OOPic? I've heard some really good things about them, but it's going back a number of years:

    http://www.oopic.com/

    For some reason they're using frames on their site, so the only way to link to the about page is to link to the page inside the frame:

    http://www.oopic.com/about.htm

    �In the long history of humankind (and animal kind, too) those who learned to collaborate and improvise most effectively have prevailed�
    - Charles Darwin

  10. #10

    Re: Programming Languages for Robotics

    [quote=Alex;9197]Has anybody messed around with the OOPic? I've heard some really good things about them, but it's going back a number of years:

    http://www.oopic.com/[quote]

    I had an ooPIC for awhile and was just starting to get into working with it when it ummm, well, let its magic smoke out. I heard later that the ooPIC-R boards are very prone to this sort of thing. When I can afford it, I want to get one of them (ooPIC II+, 40 pin version) on an Oricom Technology ooBOT-II board - one of the same boards that will accept some 40 pin PICs. In fact, the ooPIC II+ is a programmed PIC16F877A! I also want to use the ooBOT-II board for PICs.

    I really like things that are object oriented and easy to use.

    8-Dale
    I can handle complexity. It's the simple things that confound me.
    Do everything in moderation, ESPECIALLY, moderation..
    Sometimes the only way to win, is not to play.. -- Stephen Falken

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Speecys SPC-101C Programming
    By cdraptor in forum Humanoids, Walkers & Crawlers
    Replies: 8
    Last Post: 01-26-2012, 10:00 PM
  2. [ANNOUNCE] Rat's Life: robot programming contest
    By omichel in forum Robotics General Discussion
    Replies: 4
    Last Post: 09-19-2008, 02:13 PM
  3. Good robot for programming
    By zack in forum Robotics General Discussion
    Replies: 29
    Last Post: 04-16-2008, 08:54 AM
  4. New To Robotics And Programming
    By El Espada in forum Robotics General Discussion
    Replies: 11
    Last Post: 01-08-2008, 11:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •