How much have you done so far?
So far I have around 50 seconds of the dance done. I have a good plan of what I want to do next with my robot, and I’ve synced the completed 50 seconds quite well. The robot shuffles left and right to the sounds of the song, “Eye of the Tiger.” It performs quick swing turns for the beginning sequence corresponding to the quick parts, and does a long swing turn for the longer sections.
What are the different programming techniques that you used? Are you using any sensors?
I am not currently using any sensors, and due to the fact that we haven’t been taught how to use them, I don’t see myself using them in the future. The most useful technique I used was functions. It saved me a lot of time, as I didn’t have to repeat the same code over and over. I was able to make my robot do the same amount of actions in far fewer lines of code.
Using a function like one of these:
I can condense what would be the same three lines of code repeated constantly to this:
Although this also looks quite repetitive, it would have been at least three times as long had I not used functions. With these functions, I use an integer in the circle parentheses for the variable of time. I could have condensed my functions within another function, however I personally preferred to list them in this way because the song’s notes are not always in a linear pattern (this is why the numbers are of different values).
How do you tackle the sync issue?
Syncing the robot’s dance to the song is perhaps the most difficult parts of this project. To start, it is good to get a general idea of when you want your robot to perform the move. In my case, the first action I wanted my robot to perform was around eight seconds in to the song.
Although using the actual millisecond values for parts of the song is effective, it can sometimes be hard, especially if the song is very complicated. Once you get a general idea of the location in time that you want your move to be performed, it really comes down to trial and error. I listed 8000 milliseconds (8 seconds) at first, but after trying if a few times, I found that it synced better with 9000 milliseconds (9 seconds). It would be very unpractical to do trial and error on an actual robot, so I spent a lot of time in virtual worlds.
Any other challenges you encountered during the development process?
Despite my success in the virtual world, I am still unable to get my code to work with an actual robot. I spent an entire lesson trying different robots with my code, and I came to the conclusion that there was a problem with all of the batteries that I tried using. To fix this issue, I need a robot that is guaranteed to work, one that I know has absolutely no problems with its motors, cortex, or battery.