Insight for soon-future project connecting robot's parts to the code

Hi.

Well, born on Earth, and learning c++ (had to figure out what's the best language and has biggest arsenal), and wanting to build a AI code, in a real robot, I face problems, because man has not, well, given any manual or path for me or you to learn HOW DO I LEARN WHAT TO BUY AND HOW TO CONNECT THE CODE TO EX. THE CAMERA, because give it some thoughts - is Google, or other places you may be learning c++ (should be 1 best place) giving us a link to the knowledge, no, so I do not know if I must write code ex. servo input cam usb; or somethin and how to get it to ya know....ya know?

How will I connect any camera/robot to my code, and what will be the code that identifies it, and will there be code showing all recorded images 0&1s and will it give names automaticaly from the input else howd you get it if not.

I have to know, because I'm learning c++, and will face this terrible issue that I have no path to learn it.
You'll have to do some research into the devices available. You want a camera that has an API that lets you access it via code. Ditto for whatever other real-world devices you want to access.

A bit of caution: accessing devices in the real world can be tricky. You have to check all calls to see if they succeeded. Want to move the robot forward 1 inch? You better see if it succeeded because maybe it hit an obstacle. Maybe it ran out of battery power. Maybe the motor seized up. Another example is reading keyboard input or input from any type of switch. All switches bounce when pressed so instead of the switch going from off to on, it goes off on off on off on off on. It only takes a couple of milliseconds for the bouncing to settle down, but the code has to account for this. Hopefully most APIs will include debouncing logic, but you'll have to verify that.
What does getting the image from the camera have to do with its reinforcement of guessing a move say forward by accident? I need to know what code I'm looking for, more precisely:

I know cout is the output for all things right? So will I end up puting numbers in cout for motor output? Same with cin is the input, is this where I get my images from camera?

New question: if the camera saves images every moment, then how can the code's sequence go on if it is always at image retrival saving, or does it save 1 image actually every other eon not at lightspeed?
Last edited on
I know cout is the output for all things right?

No. cout is just the standard output stream for the program, just like cin is the standard input stream. You don't have to use them and you can open other streams or files as you please. For your program, I suspect that you won't be using cin or cout.
New question: if the camera saves images every moment, then how can the code's sequence go on if it is always at image retrival saving

Well that's where the API comes in. Most likely you'll tell the camera to take a picture and it will send you the results.
I wanna start to format it though, including knowing what will go above & below "this" code, so the API from the say Arduino will give me its "cout" and "cin"? Also for each image will it actually put all its millions of 0s&1s in the code to play with or just its name it'll give? Ya know what I mean...What am I going to see and be looking for...Maybe that^ made more understandment to you.
If you still don't get me, try this --- I now want to start connecting my c++ code, to, this camera I'll end up with buying, and I want to know where itssss input cout or images's 0s&1s or names given will be in the code plus how to get them....>>>I want to know how to get, and what they'll be, to then check if match the input image to my preinstalled image and if does saves actions it outputed.
Last edited on
I think you misunderstood the capabilities of C++.
moreover there is no single programing language capable of doing "everything" one can imagine.

Usually when you connect hardware such as camera or "robot" to PC, and you want to communicate with that hardware trough programming language, then your code (be it C, C++ or whatever else) needs to implement OS specific API's as well as hardware specific capabilities / API's.

Since you just started learning C++, you'll have very hard time learning all this at once because there is a very big learning curve involved that requires hell a lot of time.

For example on Windows you need to master all of this:
Drivers programming:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff554690%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
Windows API:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff818516(v=vs.85).aspx
C++ in general:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf

In addition you'll need to read hardware/"robot" specific documentation, and learn the API's provided by that hardware.

Once you master all this you'll get too old, and probably gave up from communicating with devices which is a topic far beyond standard C++ language.
Last edited on
@codekiddy
Once you master all this you'll get too old
That makes no sense.

There's a lot of material about robotic in the internet. And it's fast-growing.

I would suggest to start small with toys available (like lego) and getting more and grasp of it.

Take a look at arduino/rasperry pi.
@coder777
well if all that OP want's is to learn robotics then it probably makes sense.
What I wanted to point out is that there should be some order on which things gets learned first.

learning all at once without some basic background can be frustrating and I do not recommend that path to anyone.

If there are no good meterials on the net then probably taking a course is better than struggling on forums asking questions.
Please understand I am a special case, I stay home all day and have already learned c++ by a strong grip of what most words mean and how they work in just 4 days yes, and, all I want to do is build my discovery, my AI, that'll match each new image to check if matches preinstalled image, if does then it saves actions.

New problem - I heard MAT is a image's name if using opencv, I know I can put the image up against another by ex. ==, BUT, as each of the thousands of images are saved are they going to appeaarrrrr in the code with its own name else how would each-one match by == to preinstalled image? Or must I specify how many variables at start ex. images[780, 000]; ? But no they must each appear in the code so each is saved unless memory is forgotten.

Also would it be easier to put my code to a Blender 3D robot to move him around?
Last edited on
Well that's the hard part isn't it? Look up dynamic memory allocation to get a sense of how to store a variable amount of data. But if there are thousands of images, you probably don't want to store them all in memory for fear of running out. Images are big. Also, it's unlikely that your new image will EXACTLY match one of the stored ones. Even if you set up a tripod and take two pictures of the same room an hour apart, the images will probably be different due to slight differences in lighting and, more importantly, random noise from the camera.

I know almost nothing about image processing but I heard a guy once describe a technique of taking an image, reducing it to low resolution and comparing the low-res version of low-res versions of stored images. That helps rule out most of the images. Then you could read the high-res versions from disk files and compare the result.
Topic archived. No new replies allowed.