Author Topic: Algorithm Help  (Read 5673 times)

0 Members and 1 Guest are viewing this topic.

Offline JonMarkGoTopic starter

  • Jr. Member
  • **
  • Posts: 26
  • Helpful? 0
Algorithm Help
« on: March 17, 2008, 06:48:32 AM »
I am trying to develop an algorithm to align my robot with its sensor. Essentially, the sensor moves freely until it detects a flame (so that I don't have to waste time moving the whole robot). But then I need to move towards the flame. Ideally I need to align the robot itself in the direction of the flame just from the servo value of the motor moving the sensor. The robot is on two motorized wheels and one third free-rolling wheel. Any help would be appreciated.

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Algorithm Help
« Reply #1 on: March 17, 2008, 06:58:15 AM »
Hey Jon,

The algorithm in Pseudo Code:

Quote
Start:
Give Servo a pulse of x
Add values to x to make it scan back and forth
Check Value of Sensor
If Flame is detected Then
       Servo tracks flame by finding the limits of the flame [ see at what two servo positions ( on opposite sides)  there no longer is a flame]

       If the general position of the flame is on the right side, then turn right and with every cycle for turning right the servo for the sensor moves left until the sensor servo is at center , then the robot is aligned

         If the general position of the flame is on the left side, then turn left and with every cycle for turning left the servo for the sensor moves right  until the sensor servo is at center , then the robot is aligned


Or you could use encoders on your robot and then just do
If servo position is at 1.00ms then turn wheels for a certain amount which you found out by experimenting/ calculating





   
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline JonMarkGoTopic starter

  • Jr. Member
  • **
  • Posts: 26
  • Helpful? 0
Re: Algorithm Help
« Reply #2 on: March 17, 2008, 07:03:18 AM »
I was planning to just use encoders. How I have it written now (not yet tested) is that the flame sensor turns from 0 to 180 degrees (servo) and then when it finds the flame, it stops. I then move the sensor left one unit if its more than 90 and the robot right one unit (as determined through trial and error with quadrature encoders). It does this until the servo is at the middle position. I was hoping there would be a more precise way to do it though.

Offline JonMarkGoTopic starter

  • Jr. Member
  • **
  • Posts: 26
  • Helpful? 0
Re: Algorithm Help
« Reply #3 on: March 17, 2008, 07:04:57 AM »
Basically I was hoping there would be some sort of formula to determine what the target encoder values were to have the robot aligned with the sensor.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Algorithm Help
« Reply #4 on: March 17, 2008, 07:07:41 AM »
when u are turning try to keep the servo values in an array keep a mid value which is aligned for both the sensor and the body when u turn the body to the sensor's position try moving the sensor back to the position of the mid value this will work but try to do some experimentations
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline JonMarkGoTopic starter

  • Jr. Member
  • **
  • Posts: 26
  • Helpful? 0
Re: Algorithm Help
« Reply #5 on: March 17, 2008, 07:09:22 AM »
The encoder values constantly change as it moves about a room. I may not be thinking enough into this, but I can't imagine a definite mid value for the robot itself, though its easy to find for the sensor.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Algorithm Help
« Reply #6 on: March 17, 2008, 07:15:27 AM »
hmm try using the usart and get different values now when u do that try plotting a graph like the amin has told and just get the best case value
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline JonMarkGoTopic starter

  • Jr. Member
  • **
  • Posts: 26
  • Helpful? 0
Re: Algorithm Help
« Reply #7 on: March 17, 2008, 07:17:07 AM »
What's usart?

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Algorithm Help
« Reply #8 on: March 17, 2008, 07:24:52 AM »
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Algorithm Help
« Reply #9 on: March 17, 2008, 07:26:44 AM »
u must know abt usart
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline JonMarkGoTopic starter

  • Jr. Member
  • **
  • Posts: 26
  • Helpful? 0
Re: Algorithm Help
« Reply #10 on: March 17, 2008, 07:18:20 PM »
I'm using OOPic, thats all built in.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Algorithm Help
« Reply #11 on: March 17, 2008, 10:14:40 PM »
ok then use it other wise ull not be able to know exact readings
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Algorithm Help
« Reply #12 on: March 18, 2008, 05:45:19 AM »

Make a graph like superchiku said , and perhaps there is a formula that is usable by the microcontroller


then you would have the robot turn for a certain amount based on the position of the sensor's servo.


You would use the encoders for the robot to know how much it turned and if it turned the amount needed .
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Algorithm Help
« Reply #13 on: March 18, 2008, 09:04:37 AM »
can encoders be used to tell the angle the wheel has turned ,.. i thought it was only for speed and displacement
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Algorithm Help
« Reply #14 on: March 18, 2008, 09:06:00 AM »
can encoders be used to tell the angle the wheel has turned ,.. i thought it was only for speed and displacement

http://www.societyofrobots.com/sensors_encoder.shtml
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Algorithm Help
« Reply #15 on: March 18, 2008, 09:10:39 AM »
hey thats the wheel turn angle i was meaning the whole bot turning angle or u meant to say indirectly we are measuring the servo's turning angle... now i get it
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Algorithm Help
« Reply #16 on: March 18, 2008, 10:23:41 AM »
hey thats the wheel turn angle i was meaning the whole bot turning angle or u meant to say indirectly we are measuring the servo's turning angle... now i get it

by knowing the angle changes of the drive wheels , we know the delta angle ( change in angle) of the robot itself

The sensor servo does not need an encoder since a servo "listens" and goes to the position you want
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Algorithm Help
« Reply #17 on: March 18, 2008, 12:25:17 PM »
Isn't this the same as the Stampy Edge Detection algorithm except that you are sensing heat rather than an object. http://www.societyofrobots.com/robot_iRobot_Create_mod.shtml
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: Algorithm Help
« Reply #18 on: March 18, 2008, 11:51:50 PM »
yes fire detection will be not as difficult as object detection
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Algorithm Help
« Reply #19 on: March 23, 2008, 11:54:57 AM »
Quote
aligned for both the sensor and the body when u turn the body to the sensor's position try moving the sensor back to the position of the mid value
http://www.societyofrobots.com/robot_mobot_2007.shtml

 


Get Your Ad Here

data_list