Author Topic: mapping with visual c++  (Read 2983 times)

0 Members and 1 Guest are viewing this topic.

Offline twist_bestTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
mapping with visual c++
« on: May 03, 2007, 10:47:56 PM »
somebody help me please!!!  ???
i have a problem with my assignment..
how to show data from robot to be a map in PC by visual C++??
I use a rotary encoder in my robot which the data is sent to PC and then PC will show it to be a tracer map
may you know the source code...please tell me...
thanks for your help.. ;D
[email protected]

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: mapping with visual c++
« Reply #1 on: May 07, 2007, 10:10:45 AM »
this is the simplest (although not best) method to do this . . .

create a matrix of X and Y coordinates.

have your robot only turn at 90 degree angles. (if you are really good at math, you could also use trig for any angle)

keep track of your robots location by noting turns made, and distances covered, by using the encoder. output this information to your computer, then use excel to graph the data points recorded.

Offline twist_bestTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: mapping with visual c++
« Reply #2 on: May 09, 2007, 07:16:52 AM »
Unfortunately... I have some difficulties to find another solution for this project. Gimme a good idea plz...

Offline sdk32285

  • Supreme Robot
  • *****
  • Posts: 418
  • Helpful? 0
Re: mapping with visual c++
« Reply #3 on: May 09, 2007, 08:34:33 AM »
I don't really understand your last post. Whats the difficulty? It is hard to recommend other ways without knowing what the constraints are.
Robots for Roboticists Blog - http://robotsforroboticists.com/

Offline twist_bestTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: mapping with visual c++
« Reply #4 on: May 15, 2007, 07:43:10 AM »
my problem is how to proccess the data that i get from my rotary encoder become a XY map..
when i check my encoder's output, it give data like mechanical encoder in http://www.vishay.com/docs/57089/110e.pdf
or may you have mouse optical encoder datasheet so i know the data output from it exactly..
thanx

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: mapping with visual c++
« Reply #5 on: May 15, 2007, 07:59:45 AM »
hmmmm nice encoder!

Ok so the encoder sends out pulses, right? And your microcontroller can detect these pulses already, right? Well after each pulse, your robot has traveled Z distance.

So if your robot travels in the X direction, add Z to the X counter. If your robot travels in the Y direction, add Z to the Y counter. As long as your robot only does 90 degree turns, this will always work. If you are confident in math, you can do trig to go at any angle. If you dont know what you are doing, just stick with 90 degree turns for right now, and dont use the quadrature feature. :P

Now someone else recently asked about calculating distance and velocity of your robot with an encoder:
http://www.societyofrobots.com/robotforum/index.php?topic=1051.0
You will find it useful.

Ok so you now have X and Y data from your encoder, right? For example:
X Y
1 0
2 0
3 0
3 1
3 2
4 2

Basically the counter always knows the location of your robot. Put that data into excel, and hit the line graph button. This will give you an instant easy to view map.

Offline twist_bestTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: mapping with visual c++
« Reply #6 on: May 25, 2007, 10:31:48 AM »
there are 36 step in 360o and equal with 6.28 cm
i want to count that data output and then send it wireless to PC. the transceiver can send 8-bit data in every packet.
How to make a right counter?and then How to make it into XY Map ?
thanks for your clue..

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: mapping with visual c++
« Reply #7 on: May 25, 2007, 10:40:11 AM »
Show us your code that you use to count encoder clicks. You do have it counting each click on your encoder, right? After that you just

for example:

//assuming robot is driving straight in X axis
if encoder click detected
then click++;

//calculate location in map
click*6.28cm = location on map in X axis

//transmit data to your PC
print(location on map in X axis)

 


Get Your Ad Here