DRAFT: This module has unpublished changes.

 

      Our pet is a unicorn. His name is Rainbow, and he can avoid objects, go to sleep, sing until you feed him, snore, wake up, neigh, and rear back and forth with a mighty whiney. The skills that I had to develope, master, and utilize during this project include the ability to understand and synthesize LabView code. I had to use the skills that I had gained during lecture and previous Learning Centers, and use my deductive reasoning to formulate a way in which the language of LabView mirrored the logical path that I imagined Rainbow performing.

 

     Here is a screenshot of the master state, State 1, where Rainbow will be able to shift into State 2, 3, 4, or 5.

 

 

Oh, the Things Rainbow can Do!


     Below is a summary of all of the states that Rainbow is able to perform.

The way the comparison functions was used to assign priority was to wire the end of each comparison function into the input for the false side of the constant for the comparison function of the next sensor in the hierarchy.

 

     In State 2, Rainbow, is sleeping. She displays Z’s on the screen for 5 seconds and then checks the light sensor for a value greater than 20. If this is true, then Rainbow returns to state 0, but if it is not, Rainbow stays asleep, displays Z’s for 5 seconds and checks the value of the Light sensor again until it yields a true value.

 

     In State 3, Rainbow plays a song and checks the Light sensor for a value less than 18. If the Light sensor is less than 18, Rainbow will go to state 2. If the Light sensor is more than 18, then Rainbow will go into state 6, the end state.

 

     In State 4, Rainbow will spin until she sees an object within the range of 20 to 60 centimeters, and will chase after it until the sonar reads that there is an object within 20 centimeters or further than 60 centimeters a way. Rainbow does this for a set distance before entering state 6, the end state.

 

     In State 5, Rainbow will neigh while rearing back and forth three times and check the value on the Sound sensor until she reads a value greater than 25 dBA’s; then, she will enter State 6, the end state.

 

     In State 6, Rainbow will display a picture of her “heart” – an NXT Brick – for 3 seconds, and play a song before stopping the program. Below is the state diagram that shows the various paths and shifts between states and how they occur, with a path that Rainbow performed during our demonstration.

 

 

State Machine Diagram

     From the start state (state 0), Rainbow avoids objects until the Rotation Sensor reads 7200 degrees. Once that is achieved, she will go into feeding mode. As seen in the arrows of Figure 2, from state 1 the unicorn was programmed so that it can enter four other states;

  • If the horn (touch sensor) is pressed, then she will emit a sound.
  •  If the horn is not touched, and instead a loud sound value is read (greater than 25 decibels), the pet will enter a charge state and run forward as if it was angry.
  • If however, after feeding, no loud sound is detected, then Rainbow will enter state 3 and play a happy noise.  
  • If the room becomes dark and the light sensor reads a low value, then she will going into state two, the sleep state.

     Every time that she transitions into another state, she will read the appropriate sensors and react accordingly. In the shown state diagram, the path highlighted indicates that after being fed, a sound value less than 25 will take the program to state 3, happy mode. Then, a light value that is less than 18 will take it to state 2 or sleep mode. When the light value becomes greater is will return to state 0, progress once again to state 1. The next step will be a sound value greater than 25, entering state 4, charge. Then the robot will run until the rotation sensor reads 18000 and the program will end at state 6, the stop state.

DRAFT: This module has unpublished changes.