Saturday, November 23, 2013

Coding Patterns (Ideas)


I believe boat moving patterns can be achieved through mere functions and a coded control of delay and servo-motor (for rudder) values. For example, we would customly create different methods ("void Xpattern(), void Ypattern(), etc.") that can be called through the iPhone GUI interface. Within each method, all that needs to be altered with are the direction which we set the Servo as well as how long we want it in that position (delay). 

For a first example, let's take a mere circular pattern:


For this pattern our function would only set the Servo postion to one constant value (say 30 degrees). Our delay value, in this case, would determine only how long the boat would stay in a circular pattern. Experimentation can perfect these values so we can have it leave the circular pattern in any direction desired.

Another neat pattern would be an infinity loop:
 
Each color denotes a different stage that would be required to code into the method. Still, this quite simple. The red and blue phases only require a set amount of time for the delay whilst the green and brown portions require both a servo and delay value. Experiementation with a circular pattern will help us learn to be able to make more complex motions such as this.

Finally, we can take things to be even more complex and try to implement something such as this:
For this I imagine the easiest way to achieve this is to find out if the RC can be done in reverse while we change the Servo motor value. I think we discussed this was either impossible or incredibly hard, but I do have another idea. If we were to create an additional method to call within this specific pattern method thats purpose is to rotate the boat in place. But again, this would probably require two motors which I don't think is possible.


I will post some experimental code snippets on here when I figure out how to use Github....
-Mike
Implements Boat Lights:
In lecture, it was brought up that implementing lights using a delay has the potential to mess up other parts of the code when causing their execution to delay aswell. He mentioned how something else could be purchased to fix this but I think maybe another arduino board can fix it. All that needs to be done is an extremely simple code that can be uploaded on the board and stay in it. It would be an entire seperate entity that just needs batteries to power - however our hull would need room for the board.
Just a thought,
- Mike



1 comment:

  1. Will: since one of our functions we want our lights to have is to measure power, we might want to investigate how to connect the two arduinos together.
    on another note. programming the boat to swim forward in patterns is certainly possible, and perhaps even easy. however even if our engine could move backwards. our boat isn't designed to move backwards and we would probably swerve off course. this is because the arrow shape of a boat serves not only to keep the pressure on each side of the boat equal. however if the boat is pushing with a flat side against the water the pressure will be destabilized and it will veer.

    ReplyDelete