First Object Follow

Posted on 22/11/2008 by christhecarpenter
Modified on: 13/09/2018
Project
Press to mark as completed
Introduction
This is an automatic import from our previous community platform. Some things can look imperfect.

If you are the original author, please access your User Control Panel and update it.

Being quite inpired by Mintvelt's "FourEyes", I decided to give it a shot and try my own. The mechanics were solid and the inital tests went well, however I tried to expand on Mintvelt's code and adapt it for my purposes and it all went downhill from there. It just goes to show, if you write your own code instead of cutting and pasting, it is just that much easier to change and debug. In addition, I found that it was quite a task indeed to try to get both servos, both sharp sensors and ...


First Object Follow

Being quite inpired by Mintvelt's "FourEyes", I decided to give it a shot and try my own.

The mechanics were solid and the inital tests went well, however I tried to expand on Mintvelt's code and adapt it for my purposes and it all went downhill from there. It just goes to show, if you write your own code instead of cutting and pasting, it is just that much easier to change and debug. In addition, I found that it was quite a task indeed to try to get both servos, both sharp sensors and the motors all going at once! Staying with the KISS philosophy, I simplified...

 

This seemed to do the trick. Very simple, as each sensor catches an edge the head servo turns and the speed of one wheel is cut in half using the PWMOUT command.

To Do Soon:

I think I can have the best of both worlds here... I would like to reinstall the "four-eyes" assembly but eliminate the constant in and out movement. Here's what I mean: I think it would work well to have the robot start with "sizing-up" the target you intend to use at the begining of the run. The robot could do a quick in and out sweep as well as a little right/ left and get a very good idea of the size of the target and thus set the eyes to their best position at a given distance. From there, using just the R/L sweep the robot could follow it -speeding up and slowing down to keep the target at a given distance. I know, you are loosing some accuracy as the target moves closer and farther away but you are freeing up a lot of "thinking space"... Just a thought.

 

Psuedo Code:

(Bear in mind the target was just about the width of the 2 sensors so you don't see a bunch of side-to-side stuff)

Start sensors in the middle

If one sensor catches an object (is closer than a given value) turn head that way

--Continue, as each sensor catches an edge, turn head that way (adding one to the servo command)

If the head is centered (+ or - 5 points either way), go forward

if the head is off to one side, slow down that wheel by 50% (PWMOUT command)

 

 

--That's it!

 

Follows a solid object

  • Control method: autonomous
  • CPU: Picaxe 28x1
  • Power source: 3 AA's
  • Programming language: Basic
  • Sensors / input devices: 2 sharp IR distance
  • Target environment: Smooth floors
Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post