CatScan Robot [altered SHR]
I got the SHR because I wanted to turn it into a cat toy. It works; just ask the cats...
The CatScan Robot sits patiently waiting for one of our cats (Zena or Keslo) to investigate. When the CatScan Robot "sees" a cat it looks left, right, and center to determine if the our cat has moved. Then the CatScan Robot chases toward the cat. It continues to chase the cat until a cat is not found. If it doesn't find a cat; it starts waiting patiently again until one comes around to play again. Hours of robot fun for the home (and the cats).
In this video demonstration our FSLBOT plays the role of a cat being chased. The custom code is downloaded to a PICAXE28 microcontroller. The scanner is a Sharp Analog Infra-Red Rangefinder mounted to a servo. The CatScan robot runs on 4.5VDC. Basically the SHR tweaked with a personality to entertain our cats.




@ Sat, 2011-07-16 16:03
i promise
i promise not to laugh.....honest :)
@ Sat, 2011-07-16 18:46
OK, since you promised then
OK, since you promised then here it is. It's the first PICAXE program I have ever written, plus I'm not a programmer so I realize that most of you could have written this whole program in, like; ten lines of code.
==============================================================
' Voltar July2011
' CatScan code for SHR. Make the SHR wait for a cat, then chase it
'control RIGHT Wheel FORWARD A and BACKWARD A
'control LEFT Wheel FORWARD B and BACKWARD B
' servo 0 150 is CENTER
' servo 100 is RIGHT
' servo 200 is LEFT
'Sharp IR: Reading gets higher as wall gets closer
' 150 at 8 inches
' 75 at 16.inches
' 45 at 24 inches and farther
'Variable Define
Symbol Too_Close = 150 ' If > than this, we found a cat.
Symbol Turn_Amount = 700 ' how much bot is turned
Symbol Servo_Delay = 700 ' delay for the servo to turn
servo 0, 150 'intit the servo the straight ahead
main: 'Scanner area
low 4 : low 5 : low 6 : low 7 'stop the robot. Decide direction
servopos 0, 150
pause Servo_Delay
Do until b1 => Too_Close 'Cat seen? If yes, exit loop
readadc 0, b1
loop
servopos 0, 200 'This
pause Servo_Delay 'just
servopos 0,100 'wiggles
pause Servo_Delay 'the servo to allow the cat to move
pause Servo_Delay 'Cats love this part of the routine….
servopos 0, 150
pause Servo_Delay
servopos 0, 200
pause Servo_Delay
readadc 0, b0 ' read LEFT distance into b0
servopos 0, 150
pause Servo_Delay
readadc 0, b1 ' read CENTER distance into b1
servopos 0, 100
pause Servo_Delay
readadc 0, b2 ' read RIGHT distance into b2
'Largest b value points to cat. Move that way
if b0 => b1 then
b1 = 0
else
b0 = 0
end if
if b0 => b2 then
b2 = 0
else
b0 = 0
end if
if b1 => b2 then
b2 = 0
end if
servopos 0, 150
if b0 <> 0 then 'cat on left
forward a
pause Turn_Amount
for b3 = 1 to 3 'move forward
forward a 'RIGHT Wheel
forward b 'LEFT Wheel
pause Turn_Amount
next b3
end if
if b1 <> 0 then 'cat center
for b3 = 1 to 3 'move forward
forward a
forward b
pause Turn_Amount
next b3
end if
if b2 <> 0 then 'cat right
forward b
pause Turn_Amount
for b3 = 1 to 3 'move forward
forward a
forward b
pause Turn_Amount
next b3
end if
goto main
@ Sat, 2011-07-16 15:33
cool
cool little bot, what alterations did you make to the shr code or did you write your own?
@ Sat, 2011-07-16 15:58
I wrote the code from
I wrote the code from scratch. I'll post it if everyone promises not to laugh at it. Ha!