Society of Robots - Robot Forum

Software => Software => Topic started by: smashing robots on January 18, 2011, 08:47:06 AM

Title: Best programming language for robots
Post by: smashing robots on January 18, 2011, 08:47:06 AM
Hello All,

Which is the best programming language to create programs for robots? For example, if I want to create a program for robot vision to detect object from environment, which is the best program language?

Also which is the best toolset for development programs for robots?
Title: Re: Best programming language for robots
Post by: mstacho on January 18, 2011, 09:07:02 AM
That's a really general question :-P  If your goal is robot vision, then I'd go with C, and I'd use OpenCV, which does most of the computer vision stuff for you (I'd also be using a PC, rather than a microcontroller, since a uC might be too underpowered for the job).

Most of the robots I've worked in have been programmed in C or Assembly.  Assembly is *fast*, and most microcontroller programming programs take C code and convert it into assembly.  Problem is that most uCs have their own versions of assembly language, and I've always found that the programmer is just much better at optimizing my assembly code than I am, so I tend to stick with C.

That being said, many industrial robots are moving towards languages that are easier to use, like C# or Java.  Some hobby robotics uCs use visual basic (the Basic Stamp being the most prominent example of this).

My recommendation is to learn C and learn it really, really well, though.  I've encountered C far more often than anything else, and PICs can be programmed in C, along with many other microcontrollers.

As for the actual packages to use, it depends entirely upon your project.  If you're using the Axon microcontroller, then the libraries for its uC and the utilities built by Admin are a must.  If you're using a PIC, you may even have to write some of the libraries yourself.  As I said before, computer vision and OpenCV are a good match, although probably not the only one out there. 

What kind of project are you working on?

MIKE
Title: Re: Best programming language for robots
Post by: blackbeard on January 18, 2011, 09:15:43 AM
it sounds like you're just starting out so let me say this. Computer vision is freaking hard! Anyway back on your points of interest. for languiges C is your friend and virtually any platform you use will either have a C compiler or be exclusively programmed in C. The best toolkit available for robotics at the hobbiest level (and maybe a bit beyond) is the axon II microcontroler sold right here by admin. if you're going for sensory capabilities involving more then range finding or obstacle detection then your best bet would be to go with a laptop or netbook running linux using a microcontroller to control the hardware. if you are dead set on computer vision and your pockets are deep then you should look into openkinect and use the XBOX kinect as your sensor. there's already been some major progress with it and if you're a "computer wiz" so to speak then you could probably do some really cool things.
Title: Re: Best programming language for robots
Post by: airuno2l on January 18, 2011, 09:19:29 AM
I agree with MIKE, I use C++. And I think Arduino is the besttoolset (although I bet most people on this site will say axon II) it's really just a preferance. If I were doing vision I would use a laptop with Matlab on in, but I've never done it.
Title: Re: Best programming language for robots
Post by: Admin on January 18, 2011, 09:20:02 AM
http://www.societyofrobots.com/robot_faq.shtml#robot_language (http://www.societyofrobots.com/robot_faq.shtml#robot_language)
Title: Re: Best programming language for robots
Post by: mstacho on January 18, 2011, 09:22:43 AM
I wouldn't recommend MATLAB for computer vision.  Although MATLAB is infinitely easier to use than anything else, it has some severe drawbacks (not the least of which being its cost, which can range into the thousands for all the toolboxes you'd need).

MATLAB's vision toolbox (or "image processing" toolbox...) is really for offline stuff unless you have a crazy fast computer.  We tried it once and OpenCV ran circles around it in terms of speed.  Plus, with MATLAB, you have all the overhead of actually running MATLAB, whereas in a C program (or whatever) you only have the overhead related to your own code.

MIE 
Title: Re: Best programming language for robots
Post by: smashing robots on January 18, 2011, 10:17:26 AM
I want to thank you for all answers, and I understand that C is the  best programming language, this is good because I have some knowledge about C.