6 Years
Discussion Span
Last Post by saly305

I'm not in robotics, so I really can't help too much. Keep an eye out for mike_2000_17, I think he's in robotics, I'm sure he'll be able to help.

Edited by Fbody: n/a


Yups, mike_2000_17. maybe search for him here on daniweb. He will help.
On C++, I guess you have to primarily know the core of AI(Artificial intelligence).
a lot of, control statements; precise algorithms; error control checking and feedback.
Then to interface it with a real robot, you have to learn the robots assembly language... or instructions
*Create/get an interface for connecting the robot to PC or embedded platform (serial, USB, wireless technology etc)
*create a C++ robot driver for the system you want to use.
*Later create a Program to use the driver and manipulate the robot
orcheck this out:
Robot Programming - From Simple Moves to
Complex Robot Tasks


C++ is the language of choice in Robotics. C is also needed very often when dealing with drivers or small micro-controllers that don't provide any better option.

As far as I know, Assembly is not needed in robotics. But you could encounter some domain-specific languages (DSL) depending on the application, and often they are extremely low-level (or very high-level, depending on how you look at it). For example, if you deal with industrial manipulators, then they usually are programmed with a DSL that allows simple point-to-point or path-following commands, they are inspired from CNC machine tools. But, typically, if you deal with such a system you can interface the controller with an external PC with DAQ card and you are free to program it which ever way you like, i.e., using C++.

If you look in the AI department, you will find a lot of stuff in Java (like the various agent-based software platforms). But when you look in the "running robots" department, it is overwhelmed with C++ code (ROS, CLARAty, MaCI, Player/Stage, and many others, including my own). That's the divide between academics and pragmatists.

Frankly, in robotics, the programming language should be the least of your worries to start from. You need to start by designing the system architecture in a language agnostic, hardware agnostic and OS agnostic manner. Then, find hardware that matches your design requirements. Evaluate your software choices and programming language choices, and select. Very often, the programming language will turn out to be a layered cake of C / C++ / Python, with maybe some Java code on the side.

BTW: I'm not an expert on micro-controllers, just an occasional user of them (so don't PM me with the serial number of a micro-controller and ask me what register controls what!).

Edited by mike_2000_17: n/a


mike_2000_17 also had replied my FAQ in this way

I just can say god bless him.

C++ certainly is very suitable for robotics, I mean, I have never encountered a serious robotics project that wasn't programmed in C++ (although you do encounter Java from time to time, but it is either not a very serious project, or it is very academic (as opposed to pragmatic), or a very large system that mix-and-match languages and external libraries).

When it comes to uCs (embedded systems in general), it is pretty much on a case-by-case basis. It all depends on the actual micro-controller that you are using and what you plan to do with it. Some uCs are so small that operating systems can't run on them (and often don't support floating-point operations), while others are big enough to run even a heavy OS like Windows CE. Usually, if an OS can run, then you will be able to use C++, no problem. For other chips that are too small, there might be support for C++ (and maybe even its standard library, or a subset of it), but that depends on the chip and the manufacturer (typically, the vendor supports compilation of C++ code (at least basic features of C++) but no standard library (sometimes there isn't even support for the C standard library functions)). I recommend you get a uC that can at least run one of the micro-kernel OS, and that usually comes with pretty good C++ support (often via a GCC port to that OS, so it's pretty familiar grounds for any programmer). Those include, but not limited to, FreeRTOS, QNX and Micro-Linux (uCLinux). This is just a list of the few I have encountered in the past. FreeRTOS is simply and free, very lightweight. QNX is rock-solid and feature-rich. uCLinux is easy to deal with (if at all familiar with Linux environments).

If C++ is not supported, then C is the language of choice. That is the language that all uC provide. I don't think there is any other choice (at least I haven't seen a uC that doesn't have C). Basically, simplest uCs provide C, slightly better ones provide C and C++, then, even better ones support a micro-kernel OS with C, C++ and whatever other language you can find a compiler/VM port for that OS (typical candidates are the other languages supported by GCC: Fortran, Ada, Java, Objective-C and Python). Higher than that, you leave the world of micro-controllers and enter the world of micro-PCs, which has more power, more weight, more power-consumption, but pretty full support for any OS (including desktop OS distros). I wish I could tell you more about uCs (like specific examples and links) but that really isn't my field (I mean I have done it several times before, but it's not my focus).

Making a robot software/hardware (which are intimately linked in robotics) is a lot of planning in terms of system architecture. You need to find answers to many questions, like: What needs to be done in real-time? Hard or soft? How much work does the inner-loop have to do? Can (some of) the load be shifted to a remote PC? How much bandwidth would be needed for different load-distributions? What are the sensory ambitions of the robot? (i.e. how many and what sensors do you plan or could plan to put on this robot) How much sensor-data throughput do you need? Will you need multi-tasking to interleave sensor/communication latency? Etc. etc.

In most cases, this line of questioning leads to a pretty solid idea of what chip (PCB, FPGA, uC, micro-PC, or PC), what OS (none, micro-kernel RTOS, or regular PC OS) and what programming language you will need (C or C++). Often, typical setups are either:
1) a pretty top-end uC/micro-PC (or even a regular laptop or desktop PC) and a pretty heavy, (semi-)autonomous robot (for example, I work with a mobile manipulator controlled by 4 PCs in LAN (one hard-real-time QNX and three on Windows (two run heavy vision-based sensing and one runs the high-level path-planning); similarly, I have worked with a robot controlled via two laptops (Linux), one PC (QNX) and an array of CAN-bus-linked controllers, all controlled from another computer on a network (it could even be controlled using a cell-phone running Linux, that was pretty cool for demos!)), or
2) a simple uC that just forwards sensory data over a radio signal and executes simple commands (like motor-voltage control or servo control signals) from a remote PC(s) doing all the work (e.g. I work with a lighter-than-air UAV working with simple RC chip on-board, and two remote PCs doing all the work).
The former will put all the complex software and HAL (Hardware Abstraction Layer) on the same chip, on-board the robot, this gives low-bandwidth (only very high level commands), but requires pretty heavy hardware on the robot. The latter option is much lighter on the on-board hardware (sometimes no uC is even needed at all, if you have a clever electronics guy around that can come up with a solid PCB design) and its software is usually simple enough that C will do just fine (and often no OS required), but the bandwidth requirement is high and expect soft-real-time due to the latency in-the-loop (and varying RTT).

There are a few platforms out there that you could be interested in. I can only recommend professional-grade stuff (as opposed to some Lego-mindstorm type of "toy" tools). ROS (Robot Operating System), which is not an OS, despite its name, it sits on top of a Linux OS, is top-of-the-line when it comes to open-source robotics libraries that you can actually use almost plug-and-play to run your robot, and it includes tons of drivers and standard algorithms. Then, CLARAty (from NASA JPL) is a pretty nice one too, much simpler and less feature-rich than ROS, because it's only 30% of the actual library that is released, but you can grab some code and learn some stuff from it. Player-Stage is simple little simulator and HAL you can use to have fun testing some mobile robotics control algorithms. There are plenty of other tools out there, I'm sure.


If you talking Industrial robot then using a PL C to direct the robot Fanuc Kuka
ABB all use there own systems They all got online tutor's.
I industrial robot works with it's own controller if you want to learn that there
is also lots of tutors available.
Search Fanuc Robot.
Planing on building or using a home build robot U need to learn about motors
and controller's first.
C++ is only for user interface to control the outside world.

Awie Spengler
It's from China not always working.

Edited by peter_budo: Keep It Spam-Free - Do not mention, plug or refer to any product, service, or website you are affiliated with


Yeah, I'm pretty sure the OP is talking about either a hobbyist's robot, or some research-grade robot (mobile, or manip, or other), or high-level control on industrial-grade robots (like feeding in joint-space trajectories in real-time to the controller). In which case, C++ is probably the best bet in terms of a suitable programming language. But, of course, for simple operation of industrial robots, there is no C/C++ involved, it's all proprietary CNC-like programming languages (i.e. a DSL) (like KRC/RSI for Kuka), but the capabilities are very limited (but totally sufficient for most of what is done in industrial automation).


help me in this project pleas

Imagine you have a small Robot that you need a way to communicate with, you decide to make a language for such robot, the language would instruct the Robot to move forward and backward by specifing number of steps (units), also you can instruct the Robot to turn left or right by specifing a number that represents the degrees. The following lists are what you need to do ?

1) a winword document that has the BNF language for such language.

2) some text files that represents some programs written in such language.

3) a C source code that analyze the program ( lexical analyzer and syntax analyzer) for such language
