Robotics

Building The Robot

On the 1he first day of the fourth week of my Computer Sciences intersession, my class and I put small robots together, and we gave them commands through pybot in order to control its movements.


this is what it looks like:



Building the robot itself was a very easy, simple task; we went to a website called NXTPrograms.com to view the instructions for doing so.
The robot had a small battery-powered 'computer' that would receive the commands that were sent to it via bluetooth. There were two wheels on either side of the computer that were attached with small bar-like pieces with holes that connectors went through. On the back of the small machine was a third wheel. This one did not have a black rubber cover; this was so that the bot could turn easily, without resistance. There were two sensors attached sensing.) The other was a sonar detector that senses its distance from objects in front of it. IDLE would display a number that depended on the NEX's distance from an object. Though, the units in which this distance is being measured is not known (by me, at least).


this is what the coding looked like:




Making A Square

What we did next with the robots referenced the work we did in NetLogo with the turtles: we were doing to be 'drawing' squares with our robots. I had to rewrite my programming to prove that I knew how to do this, and this is what it looked like.



The programming is always written as

"bot.[direction]([#])

sleep ([#])

bot.stop() ".


An example:

bot.forward(76)

sleep(1.5)

bot.stop()


Since the robot doesn't automatically know what "forward," "reverse," "left," "right," and "stop" are, you have to tell it to do these things in a way it will understand; by adding "bot." before the direction/movement you want it to do. Also, those numbers, you could say, represent how much the robot should exert itself. For the [direction], the number tells the engines how much force they should put forth. The [sleep] function tells the robot how long it should move for. I believe that it is measured in seconds, but do not quote me on that. I am not entirely sure myself... The "bot.stop" command tells the robot that it should stop with the previous command so that it can rest or go on to another one. So for the example I provided, the engines would put forth 76 effort (I'm not sure what this is measured in either... ^^; ) for 1.5 seconds, and then stop. Then the robot would continue on by turning left, and moving forward, repeating the process three more times until it has completed the square.

Here is a video (that my friend recorded :3) of the robot driving in a small square:



Scatterbot

Using the knowledge that we acquired concerning programming and controlling the movements of our robots, we planned and then played a game called "Scatterbot". The idea was that we would program the robots to move in a certain way so that they could seem 'alive' (Artificial Intelligence) while fighting against one another. WEll, they weren't really fighting... it was more like they were battling. :3 The robots would compete by being in the same area when their programmers (myself and my classmates alike) activated their codes. The codes were meant to have the robots move around freely. If the bot detected that something was within the range that the programmer specified, it would back up and change direction. The robots also had a touch sensor that, if activated, would stop the robot, and making it lose.


This is the programming I used. Though, I would advise against using it, as it is faulty and has a few bugs...


What I did was define all of the different directions and actions that the bot could take, and those parts came out fine, as far as I know. However, the function for making the bot reverse, change directions, and then continue going forward is flawed. I am not entirely sure what I did wrong, but I will do everything in my powere to adjust and change it as necessary in order to make it work. *^* Though I will have to admit that programming this was a lot of fun, I cannot say that my constantly repeating, never ending failure was.

These are some videos of the robots in action. Courtesy of my Computer Science Class teacher, Mr.Peter Farrell. Enjoy. :3


Part one:



Part two:



Part three:




The Mars Challenge

Our task on the fourth day of computer sciences was to program our robot to go across an area that we defined as "Mars". Had medium-sized planks of one material or another that had an uneven (though still relatively flat) surfaces. A few of them had "craters" (large holes going through them) that we would have to avoid during the run. Ah, I did not mention: our task was to get our small robot to trek across the uneven landscape of 'Mars' so that it may obtain 'water'(blue paper).





Back to my home page
To My Server Project
To my Programming Page
To My Gaming Page
To My Circuits Page
To my AI page