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
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.