|
features:
|
my advanced programming structure provides an interface to continously map surroundings. a 2-d or 3-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 environmental surroundings.
this is usually done with only 1 ir distance sensor.
when any of my code asks to scan, the data is put into an array respective to the sensor's angle. the array in 2-d 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 it moves forward, the array index is increased and the data is moved back one row.
- if it moves backwards, the array index is decreased and the data is moved forward one row.
- if it turns either direction, some magic occures and the table transforms.
if it is beside a wall with something in front, 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, 0, 11
8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12
7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12
6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14
5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17
4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14
the next decision is randomly generated by the 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 physical room to complete the action. so now we move onto the movements.c file. which references the scans.c 2-d/3-d array. whenever a movement is requested by the personality, the movement examines the array and determines if it can be done. maybe it will only partially or entirely complete... that's up to the data in the array and how the action uses that information. the robot now knows how far it can turn in either direction. how to navigate through table legs and chair legs. it also now knows how far to backup to reposition itself. you can see that demonstrated in my latest Wall-E video. now on top of all that. becuase I have this array, I can also reference it to determine if something has changed. if that is the case, then guess what? it must be a human! simple logic here: if it moves, interact with it! so it will turn towards the change, and it's personality will decide to do some animations. and now it's life like.


|