### Author Topic: converting paint to hex  (Read 671 times)

0 Members and 1 Guest are viewing this topic.

#### Danial

• Beginner
• Posts: 5
##### converting paint to hex
« on: August 31, 2011, 04:55:34 PM »
Hi

I'm planning to make a patrolling robot(it is not remote controlled , I have to draw a way for it to follow). Because I'm not the user of this robot and those who are going to use are not robot programmers I have to design an easy to use GUI. I want to make a program like Microsoft paint so the user just draw the patrolling path and upload the output on the robot.

1.How can I convert my drawing to something which can be programmed on my PIC? Do I have to make a compiler?

2.Because the maps Robot is working on are a bit large I think G codes can be helpful . Dose anyone have a better idea to save my PIC memory?

in fact the robot is going to be a cleaner

#### newInRobotics

• Supreme Robot
• Posts: 1,015
• N.I.R.
##### Re: converting paint to hex
« Reply #1 on: September 01, 2011, 12:42:40 AM »
1.How can I convert my drawing to something which can be programmed on my PIC?
First thing that comes to my head is to:
• Define real world distance match of one pixel of the drawing; say 1px = 1cm.
• Find corners in the path in the image. Now You can get direction and length of the vector (one part of full path)
• When You have all vectors of Your path then You can write these vector coordinates to the uC.

Do I have to make a compiler?
Yes You do. I would call it interpreter rather than compiler.

The idea is good, however it is more complicated than that. Your robot has to have some sort of understanding about where it is, hence it has to have some sort of reference to the outside world. This is necessary to eliminate error buildup. I would suggest using GPS, that way Your robot knows exactly where in the world it is and where it has to be. Or You can use gyro to calculate rotation errors and compensate for them. What is dead necessary for this project is to have wheel shaft encoder, otherwise Your robot will not know how far/fast it is going.

I hope it does make sense.

Good luck.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

#### Danial

• Beginner
• Posts: 5
##### Re: converting paint to hex
« Reply #2 on: September 01, 2011, 04:13:18 PM »
I googled for "interpreting C++ to hex" but I couldn't find anything useful(I think it's because of my poor English) Would you help me how to start? am I searching for the right stuff ?
I would suggest using GPS
GPS Module are very expensive in resolution I need, so I'm going to use Compass Modules and of course encoders to eliminate errors as you said.
thank you.

#### newInRobotics

• Supreme Robot
• Posts: 1,015
• N.I.R.
##### Re: converting paint to hex
« Reply #3 on: September 02, 2011, 12:23:47 AM »
I googled for "interpreting C++ to hex" but I couldn't find anything useful(I think it's because of my poor English)
Ha ha  Your English has nothing to do with it. It is simply not very common to translate bitmap to coordinates (atleast not that I know). I doubt You will find software ready made for that task, hence You have to do it Yourself. Can You program in Java/C/C++/C# or anything similar? If so, You have to write an algorithm to do things stated in the previous post.

am I searching for the right stuff ?
I don't know, You tell me

[...] I'm going to use Compass Modules [...]
Comapss is good solution as well. When I think of it, it is better solution than a gyro.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W