DJ Sures Homepage Contact Me Follow us on Twitter Follow me on Facebook
Share/Bookmark

Robots: Cookie Monster
Project name: Cookie Monster autonomous robot
Birthdate: November 9, 2008
Description: I choose the Cookie Monster shell because I had it lieing around... And it seemed to fit the plastic skeleton I had modified with servos, sensors and my microcontroller board. I wanted this robot to be fuzzy and fun. Maybe even cute?
The goal: The goal was quite simple, build a fuzzy fun robot. The primary goal was something for kids. This guy can wonder around and play with children (ie me).

Other then having a nice robust shell, an additional goal was personality. Cookie Monster is an independent autonomous robot. He does his own thing.. Exploring and cruising around in search of hugs.

Cpu: Microchip pic 18f4685
Cpu speed: 20 mhz external resonator
Peripherals: 2 x modified gws servos for drivetrain
1 x gws servos for head
2 x gws servos for arms
1 x speaker
1 x power switch
1 x sharp gp2d05 distance sensor

Power source: 7.2v 2000mha lithium ion battery pack
Development enviroment: +1,000 lines of c code.
My 2d mapping code [modified]
Shell: - mike disc shooting robot as skeleton (very modifed, only used parts of the plastic)
- tyco's tickle me Cookie Monster toy (for the outside skin)



Image links
  1. Original dissambly pics


Software
Last updated: 11-09-2008
Description: For many years, my previous robots were simple and performed single tasks. However, my software infrastructure began evolving And becoming far more effecient and reusable. The best feature of this code structure allows for flexability and expandability. The software is split up into modules. Each module is named to encapsulate the function of the commands within it.

Cookie Monster was built off my Wall-E's code with modifications and additions for having one less sensor and walking motion. I wanted Cookie Monster to be smart like my other robots, but also fuzzy and warm. It was not an easy task and has required plenty of expiremental time to determine his algorythms And conditional reactions. This is all done in the software, that's the key.
Features: Cookie Monsters's advanced programming structure provides an interface to a map of his surroundings. A 2-d array of information is constantly Updated during scans.C functions. This feature provides the movements.C functions ability to determine escape paths and understand It's enviromental surroundings.

This is all done with only 1 ir distance sensor.
When any of my code asks to scan, the data is put into an array . The array is 2-d and looks like this...

The first column is the array index. The other 14 points from left to right are his vision values, the center values being his head position center. Each column of the array history. I only keep 10 rows of history, and 14 points across becuase his head has 14 positions.

10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
9,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
8,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
7,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
6,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
5,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
4,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
3,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
2,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 

- everytime he moves forward, the array index is increased and the data is moved back one row.
- if he moves backwards, the array index is decreased and the data is moved forward one row.
- if he turns either direction, some magic occures and the table transforms.

If he is beside a wall with something in front of him, it'd look like ths...
10, 38, 36, 33, 0,  0,  0,  0, 0, 0, 0, 0, 0,  0, 0 
9,   0,  0,  0, 0, 23, 22, 22, 0, 0, 0, 0, 0, 11, 0 
8,   0,  0,  0, 0,  0,  0,  0, 0, 0, 0, 0, 0, 12, 0 
7,   0,  0,  0, 0,  0,  0,  0, 0, 0, 0, 0, 0, 12, 0 
6,   0,  0,  0, 0,  0,  0,  0, 0, 0, 0, 0, 0, 14, 0 
5,   0,  0,  0, 0,  0,  0,  0, 0, 0, 0, 0, 0, 17, 0 
4,   0,  0,  0, 0,  0,  0,  0, 0, 0, 0, 0, 0, 14, 0 
3,   0,  0,  0, 0,  0,  0,  0, 0, 0, 0, 0, 0, 15, 0 
2,   0,  0,  0, 0,  0,  0,  0, 0, 0, 0, 0, 0, 16, 0 
1,   0,  0,  0, 0,  0,  0,  0, 0, 0, 0, 0, 0, 14, 0 

Now whenever his next decision is randomly generated by his personality module. That's a whole new topic. But when the decision is made, it may or may not actually do anything. Becuase that decision might not have enough room to complete the action. So now we move onto the movements.C file. Which references the scans.C 2-d array. Whenever a movement is requested by his personality, the movement examines the array and determines if it can be done. Maybe only partially be done. Or maybe entirely done. That's up to the data in the array. He now knows how far he can turn in either direction. How to navigate through table legs and chair legs. He also now knows how to far to backup if he wants to go against a wall. You can see that demonstrated in the last video. Now on top of all that. Becuase I have this array. I can also reference it to determine if something magically appeared or disappeared. If that is the case, then guess what? It must be human! If it moves, interact with it! So he will turn towards the change, and do some animations (random of course). And now he's somewhat life like.





Neko.C This is the program file that contains the main() entry point. Initialization occures here (init head, init arms, init movement servo timers)
Neko.H Contains microcontroller fuse parameters, program #defines, and communication stream definition. The #defines are declared in this File so they may be easily modified in one location.
Moveservos.C Timer1 is used in conjunction with ccp1 and ccp2 to control the pulses to the movement servos. Servos are controlled individually with speed and direction as parameters
DJservos.C This module contains the functions to move the head and arm servos. They use my own pwm control function. The reason for this is that it lets the user specify how many degrees from center to move the servo. Then the number of pulses to move the servo from it's current location to the new location are sent. The current location is always stored for future reference.
Audiocontrol.C Provides an interface to trigger samples from the toy's original sample board.
Actions.C This file holds all the functions to control the emotion actions (eyes, tilting head, arms, etc)
Scans.C A list of functions that provide scanning capabilities. They include getmaxright, getmaxleft, isleftclear, isrightclear, getdirectionofdifference, etc..
Movements.C Movements are small re-usable macros that are used by modes. The movements assist in getting out of jams, or avoiding objects by using scans.C functions.
Modes.C This file contains the list of modes. A mode is a macro of movements, scans, actions and sounds. Examples of a movement are nodatnearestobject, gotoclosestobject or goautonomous. Modes are infinitely choosen by the personality generator function in the main() entry point.
Adc.C Contains my adc library which performs redunancy and false positive checking.
Util.C Common utilities that are used often. Mostly which are functions to calculate differences with medians and servo degree position differences.


Project videos
First video

This is the first video. It took me about 8 hours to build his chasis and about 3 hours to modify my 2d code to work with a walking motion.



Copyright © 1995-2012 DJ Sures

hacker emblem