C++ robotic programming without robots

17 posts

Flag Post

I’ve been learning C++ lately, and its a really interesting language. I made a pretty complicated version of pong.

Down to brass tacks, I’m learning C++ primarily to learn how to program robots. This is a very, very, general broad thing, I understand. The thing is, I don’t have the money currently to get a robot, to program.

How would I go about making a “pretend” robot.
This may sound very confusing, its a very confusing thing to ask. But could I make a “software robot”.
Would making an object on the screen move/do things be the same as telling a robot to do such things.



For example: If I had a little physical bot with wheels, and programmed it to move North 20 inches, then move East 20 inches, South 20 inches, then end with moving West 20 inches, how different would this be from telling an object on screen to do the same.

I understand (or think that I do) in order to move the actual robot, I would have to program the wheels to rotate in accordance to how I want it to move.
If we are looking at the robot from the side, and its pointing to the right, this means that the wheels closest to you rotate clockwise and the wheels farther away from you (assuming they are on the opposite side of the robot) rotate counter-clockwise.
In the program this would be as easy as changing the X & Y variables. But if I only allowed the object to move if variables specificWheelA == rotatingClockwise. Is this correct?

or maybe this is all way too much trouble, and I would be better off getting a physical robot to toy with.
If it is, I would love you guys for sharing the cheapest schematics for a robot you can think of.

 
Flag Post

There’s no adequate substitute for tinkering with real robots. Why not try Lego Mindstorms? It costs less than an XBox 360 with Kinect.

 
Flag Post

There are arduino boards with which you can experiment. http://www.arduino.cc/ A friend of mine has the exact one on the front page.
And yes, C++ is a very interesting language. My favorite. :)

 
Flag Post

Well Elyzius, I can’t even afford an Xbox 360, let alone get kinect as well.
Last console I got was a PS1 in 1994. Also I think you’re right. I simply can’t substitute it.
I’m going to miss being able to recompile and play test code within a few seconds to see if I fixed bugs though.

lieutenant swat llama I didn’t know you knew C++, thats awesome.
But these boards don’t support C++ from what I’ve read… do they? I thought they had their own specific language.

 
Flag Post

it’s java-based, but this is free and should give you something to play with:
http://robocode.sourceforge.net

 
Flag Post

If you want to interact with hardware at a low level interface, you’d want to use arduino.

 
Flag Post

I thought C++ was a low level interface?



E: nope, nope, nope. This is getting way too off track. We already had this discussion.

I’m not sure I got the type of answer I was looking for. Perhaps I’m wasting my time learning C++ and should simply learn C. : \ (I take it back. Making windows programs is too much fun.)
Because it seems Arduino is a derivative of C anyway.

 
Flag Post
Originally posted by alecz127:

I thought C++ was a low level interface?



E: nope, nope, nope. This is getting way too off track. We already had this discussion.

I’m not sure I got the type of answer I was looking for. Perhaps I’m wasting my time learning C++ and should simply learn C. : \ (I take it back. Making windows programs is too much fun.)
Because it seems Arduino is a derivative of C anyway.

I think you can program arduino with more than 1 language. I think it’s a subset of C and you can also use processing, based on java.

 
Flag Post

I just read that C++ is a superset of C. Which means that any programming available to C is also available to C++.
C++ is an object orientated programming language, C is a procedural programming language.
I believe this means I could still do it with C++

I appreciate the advice though. I’m not interested in Java programming, but I might still get into Arduino if this C++ road doesn’t get me very far.

 
Flag Post

lieutenant swat llama I didn’t know you knew C++, thats awesome.
But these boards don’t support C++ from what I’ve read… do they? I thought they had their own specific language.

Sozzy, it doesn’t use C++, but it uses something that is very very similar. So learning C++ is a very good idea since I think its’ language is more of a modification of C++.

If it uses a modification of C that is not object oriented, you cannot do it with C++.
If it uses C++ or a derivative of C++, I don’t think you can use C either.

 
Flag Post

BTW, GCC has AVR support (the architecture Arduino uses) so in principle you can use that to program the Arduino in any language GCC supports. In practice, you can use C and a subset of C++.

All the tutorials I see for building Arduino programs with GCC assume that you’re using Linux and that you already know your way around the Linux CLI—nothing terribly noob-friendly. I can dig deeper if you really want me to.

 
Flag Post

With arduino You are basically controlling the hardware by sending data (0s and 1s) that the hardware executes. For each hardware should come with a manual to tell you what data you want to be sending to the hardware. I’ve only made flashing lights before buts that should be about what you want to be doing.

 
Flag Post
Originally posted by alecz127:


Would making an object on the screen move/do things be the same as telling a robot to do such things.

In theory, there is no difference between theory and practice.

 
Flag Post

In practice, there is a difference between theory and practice.

 
Flag Post

I think the quote actually ends with “But, in practice, there is.” which appears to be kinda obvious as JM came to the same conclusion. But then again, this thread is about the unobvious conclusions.

So alecz, taken the first part of the quote, would you have considered the second part of it to be the way it is?

 
Flag Post

Try making some AI for a virtual robot.
Then learn how to make a robot from scratch.
Then make a robot with your own AI and program it to do things/just let it break stuff.

 
Flag Post

I never tried it, but Microsoft has some software for robotics that says it has a simulator that could give you some experience with the types of issues that come up in real life.
http://msdn.microsoft.com/library/bb483024

I think it uses C# though, which is roughly C-based but closer to Java than C++.