Let's Make Robots!

arduino programming ideas.robot shark

hi,

can somebody tell me if my idea works.

a work on a servo powered shark/fish that will cruise with its fin above the water

it will have 3 servos powering the tail. 

my programing ideas are

forward:3 servos moving back and forth with a bit of time between themselves.so the motion becomes more graceful.

2 sensors as eyes.so when it comes to the pool wall on its right it will detect it and put all the servos to left,so it will turn away from the wall and then continue forward until it detects a wall and turns away and swims away and maybe freak somebody out... 

its sort of simple but still kind of advanced.do you think i could make it go around.

so i have to teach it 

_________________

3 servos with a little time space between them to move forward

sensor signal ---> the servos set in to full left/right.

until the sensor doesnt "see" the wall any more  ---> back to forward swimming

________________

or should i just go with a 4 channel airplane controller

thanks for your help guys!^^,

sorry for bad english i´m from sweden...^^,

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

After playing around with my own attempts to do something similar on dry land I have learned a little.

if distanceRight() > threshhold & distanceLeft() > threshhold

   turn around

elseif distanceRight() > threshhold

   turn left

elseif distanceLeft() > threshhold

   turn right

else

   moveForward()

 

This will result in a fish that favors it's right as it will check there first and move accordingly.  Also, keep in mind the time between sensor readings should be about x2 the length of time for the sensor to read. 

If a sensor takes 0.01 seconds to respond, then you have to give it 0.02 seconds, or 20 milliseconds.

You can use a delay, but if you do, you will change the way the other parts of the robot behave as it waits for a sensor reading.  If you only have 1 delay in the whole code, and it's only 20 milliseconds, then it's probably not an issue.  If you add other sensors (depth, pressure, battery remaining, etc..) these delays can add up.

Seems like it could work. Not very advanced code neede either if you're just going to do things like


if distance() > threshhold

 turnLeft();

else

 moveForward();

 

But if you want to do things like mapping or proper object avoidance it might be tricky.

Making it "learn" is not a small task... if we could learn computers/microcontrollers, there wouldn't be any research done on AI these days :)