C or C++

Joined
Mar 4, 2007
Messages
391
Reaction score
7
Points
18
Location
London, UK
Your Mac's Specs
Mac Book Pro. 2.3Ghz Intel Core i7 running OSX 10.14.6, 16GB Ram
Hi guys,

I haven't been here for a LONG time! :D
A quick question.
I'm looking to start learning a programming language with an end goal of working with some simple robots. I'm less interested in writing apps, although that may become more interesting to me as time goes on.

So, I get the impression that I should go with C rather than C++, but I'm not really sure of the differences.

Can anyone point me in the right direction?

Thanks in advance.

Sim
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
I would think it would depend on the robot frameworks. Is this something you are doing from scratch or are these robot kits with some documentation of the coding features? Really, you need to answer this question before moving forward on language selection.

C++, Objective-C, etc tend to have extensive libraries today. Straight C is sparse in comparison. Using big libraries may cause you to require much more memory in your robots. Something I suspect would be limited resource.

C++ adds in complication to gain it's object oriented features. Being new to programming, you might not want to jump into that extra difficulty.
 
OP
Simbad54
Joined
Mar 4, 2007
Messages
391
Reaction score
7
Points
18
Location
London, UK
Your Mac's Specs
Mac Book Pro. 2.3Ghz Intel Core i7 running OSX 10.14.6, 16GB Ram
Thanks xstep for your reply.
In answer to your question, I am looking to develop some very simply robots at a later date, probably from scratch.
I have come across some systems, one in particular called brainstem, which is a ready to use control environment for a robot, and I believe it uses C.
I don't know where this may lead, but I would like to not waste time learning a language that would end up being redundant at a later date, for my purposes.

Thanks again.
Sim

I am right at the beginning of all this, and from what you say about extensive libraries, it would seem that C was a better option.
Essentially, robotics is about controlling sensory and motor systems, so perhaps doesn't need a vast library.
 
Joined
May 2, 2009
Messages
480
Reaction score
13
Points
18
Your Mac's Specs
MBP 2.33 4GB: MacPro 8 Core 2.8, 16GB: MacMini 2.26 4GB: MacMin 2.53 4GB: iPhone3GS 32GB
In furtherance of xstep's point, you can never really go wrong with C. It's fairly easy to learn (in some respects) and quite a few other languages (Obj-C, C++, Java etc) all share syntactic similarities. While the spirit and idioms of these languages may be dramatically different, at the very least, the syntax won't be such a shock if you ever choose to move on to something different.

Also, most low level code dealing with hardware typically is done in C: device drivers etc for the reasons xstep has already mentioned.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Essentially, robotics is about controlling sensory and motor systems, so perhaps doesn't need a vast library.

Likely any libraries you'll need will be available in the option you buy into. They also are likely to be efficient tight code. In fact, I'd say research this side of the issue. Some companies may have better developed systems than others.

Look to see how well your companies of choice are supported by the outside world. This can make learning and getting detailed information easier. Also, does the company have use forums.

Consider the open source community for support. Things you may want to do could have already been coded for you. Of course there are possible licensing issues with this option. The thing is, you could at lease look at the code to see how someone else thought to solve a problem.

Sounds like a fun and challenging thing to get into.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top