Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C or C++ for a Robot?

Tags:

c++

c

robotics

Greetings,

I am trying to decide between C and C++ for my robot. I am a 5+ year veteran of Visual Basic.NET, however I'm going with Linux (Ubuntu) on this robot, and there is a compatibility problem between Linux and the .NET Framework. I want to stick with whichever language I choose for all of my projects, so I want to make sure that I choose the most appropriate one for the task. For reference, I will describe my current robot in progress and what I am going to do with it. I am in the process of building a full-sized R4 Astromech (yep, I'm one of those guys). I have incorporated a PC motherboard with an Intel Core 2 2.1 GHz processor, 1 GB RAM. I will be using a scratch-built parallel interface card to control the drive motors, head motor, as well as a secondary parallel interface card (going to a second parallel port) which all of the sensors (IR, Ultrasonic Ranging, Visual Recognition via webcam, etc.) will be going to. Commands will be given using speech recognition (currently have a VB.NET scratch-built recognition program that I will be adapting to the new language). Given the specifications and desired goals listed above, would I be better off with C or C++? I greatly appreciate any suggestions that you might have. Thanks! Thaskalas

like image 294
Thaskalas Avatar asked Feb 11 '11 20:02

Thaskalas


People also ask

Can I use C for robotics?

The C/C++ language is one of the most widely used programming languages in robotics. The Arduino microcontroller uses a programming language based on C and is a great way to learn the basics of this important language whilst doing hands-on robotics.

Which is better C or C++ for robotics?

Both C and C++ are equally important in Robotics.

Can you use C# for robots?

Probably the four most popular languages for robotics are Python, C#, C++ and MATLAB. They are all great options and I have used them many times. For some larger projects, I have even used all three in the same project because each has its own unique strengths.

What is the robot C language?

ROBOTC is a text-based programming language based on the standard C programming language. Commands to the robot are written as text on the screen, processed by the ROBOTC compiler into a machine language file, and then loaded onto the robot, where they can be run. Text written as part of a program is called “code”.


3 Answers

What do you mean by a compatibility problem? Have you looked at Mono? It's an open-source implementation of the .NET libraries. It's geared toward C# not VB.NET but if you're more comfortable in a .NET environment use that. Speed isn't really an issue here as a Core2Duo is plenty fast for what you need to do.

If Mono won't work for you, I'd recommend C++. There are a lot more libraries out there for C++ (or at least, I am familiar with more, e.g. Boost), which can use most C libraries too. There's no real speed penalty for using C++. While using C wouldn't be bad per-se, C++ has some benefits and no drawbacks, so it's probably the better choice.

like image 91
Miles Strombach Avatar answered Oct 04 '22 09:10

Miles Strombach


I would recommend using ROS. It will let you get started with a sophisticated Inter-Process Communications manager, as well as a large library of sophisticated robotics code, including multiple implementations of SLAM and other critical robotics algorithms. ROS also lets you program in multiple languages, including C, C++, and Python, so you aren't stuck with one language or another down the road.

like image 40
Bradley Powers Avatar answered Oct 04 '22 09:10

Bradley Powers


I would also recommend C++ and ROS. In our company we're migrating to it, because there's so many people working on it, expanding it, and adding lots of cool features.

With this, you can forget about implementing most of the basic low-level stuff and start working on what you intend to research.

It's really easy to set up and start developing.

like image 31
Victor Avatar answered Oct 04 '22 11:10

Victor