The Elvinator Source Code and Video along with other helpfull code and Video

104 posts / 0 new
Last post
RobosapienV2-4mem8
RobosapienV2-4mem8's picture

Ok, cool. Just wanted to check with you which one you sent me.

GWJax
GWJax's picture

Thought I would give you a peek into the Wall-E test moving routine even though its not quite finnished yet but here are the guide lines i'm going by then the Source code following it. I know I have not posted to this thread latley so this is why I giving you some of whats behinds the seens.
Guide lines for the test running routine with ping sensing are as followed:

WALL-E DRIVE ROUTINE W/ PING SENSING AS THE MAIN SENSOR

• Using the BS2p40 set up variables and pin locations, keep pins for motors at location 0-5 and ping location at pin 6, tilt at pin 7, pan at pin 8
• Initialize head to center and take distance reading, center, center right, center left and the back to center again.
• Decide which direction is the furthest and head in that direction while storing new distance and comparing with center, right and left
• If right or left distance is greater than the center start to move in that direction in slow movements checking center distance until distance is greater than 11”
• Stop and recheck surroundings then go back to the start of main routine.

On distance make sure that center is at least 11” before going forward or use the greatest distance for movement and check again, do not let it get less that 6” away on either side else turn to the right until center is greater.

• When moving forward start slow and increase speed to full speed
• When turning move in slow speed
• When backing up move in slow seep to prevent tipping

return to the beginning start routine and do it all over again

now here is the unfinnished code for the following statements, if there are any questions please feel free to ask them.

' Wall-E Drive Routine W/ Ping Sensing as the main Sensor
' Test routine for Wall-E at www.Robocommuniy.com
' This test routine is for 4mem8 but any one may change this routine to suit their needs
' This program is for personal use only and not for use in commercial products!
' Written by : GWJax at www.robocommunity.com
' Date: started on June 10, 2008

' {$STAMP BS2p}
' {$PBASIC 2.5}

' set variables
'------------------------------------------------------------------------------
Distance VAR Byte 'holds data for inch for distance 0-255
Time VAR Word 'holds data for time it takes to get a ping reply
i VAR Byte 'used as a counter
CFront VAR Byte 'Holds center head front distance
CRight VAR Byte 'Holds right center distance
CLeft VAR Byte 'holds left center distance
CDown VAR Byte 'holds down head center distance
CUp VAR Byte 'holds up center head distance

'------------------------------------------------------------------------------
' Set constants

Constant CON 890 'set for inch in room temp 70 deg F

'------------------------------------------------------------------------------
' Set pin locations
'------------------------------------------------------------------------------
FowardRight PIN 0
FowardLeft PIN 1
BackRight PIN 2
BackLeft PIN 3
REnable PIN 4
LEnable PIN 5
Eyes PIN 6
Tilt PIN 7
Pan PIN 8
'------------------------------------------------------------------------------
' set up for init. poss. and check distances
'------------------------------------------------------------------------------
'LOW LEnable ' turn off Left Enable Pin
'LOW REnable ' Turn off Right Enable Pin
'LOW FowardRight ' Turn off Right Foward Motor Pin
'LOW FowardLeft ' Turn off Left Foward Motor Pin
'LOW BackRight ' Turn off Back Right Motor Pin
'LOW BackLeft ' Turn Off Back Left Motor Pin
'LOW Tilt ' Turn off Tilt Servo Motor Pin
'LOW Pan ' Turn off Pan Servo Motor Pin
'LOW Eyes ' turn off Ping sensor
DIRS = %111111111 'sets pins 0-8 LOW one command replaces 9 commands
'------------------------------------------------------------------------------
'set Wall-E's head looking front and center
GOSUB PanItCenter
'------------------------------------------------------------------------------
Main:
GOSUB CKEyes ' get distance reading in center Possition
CFront = Distance
IF CFront => 11 THEN GOTO MoveFoward ELSE GOSUB LookAround ' Look around for best route to take
IF CLeft > CRight AND CLeft > 6 THEN GOTO MoveLeft
IF CRight > CLeft AND CRight > 6 THEN GOTO MoveRight ELSE GOTO Turn

'------------------------------------------------------------------------------

LookAround:

GOSUB PanItRightCenter
GOSUB CkEyes
CRight = Distance
GOSUB PanItLeftCenter
GOSUB CkEyes
CLeft = Distance
GOSUB PanItCenter
GOSUB CkEyes
CFront = Distance
RETURN

'------------------------------------------------------------------------------
'Pan Wall-E's head Center

PanItCenter:
FOR i = 0 TO 150 ' change 150 to a lower number for a faster the turning
PULSOUT Tilt, 750 'sends out pulse to tilt servo and center Change 750 to your setting
PAUSE 20 'wait for 20us to complete turning
NEXT
FOR i = 0 TO 150 'Start pan movement to center change 150 lower for faster the turning
PULSOUT Pan,750 'sends out pulse to pan servo and center Change 750 to your setting
PAUSE 20 'wait for 20us to complete turning
NEXT
RETURN

PanItRightCenter: 'pans head max to right with center tilt
FOR i = 0 TO 150
PULSOUT Tilt, 750
PAUSE 20
NEXT
FOR i = 0 TO 150
PULSOUT Pan, 500
PAUSE 20
NEXT
RETURN

PanItLeftCenter: 'pans head max to left with center tilt
FOR i = 0 TO 150
PULSOUT Tilt, 750
PAUSE 20
NEXT
FOR i = 0 TO 150
PULSOUT Pan, 1000
PAUSE 20
NEXT
RETURN
'-------------------------------------------------------------------------------
'eyes ping
'-------------------------------------------------------------------------------
CkEyes:

PULSOUT Eyes, 5 ' ping 5 times
PULSIN Eyes, 1, time ' get one ping back
Distance = Constant ** time ' convert in inch ** is used for fraction
RETURN
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
'Wall-E stop moving
MotorStop:
DIRS = %11111 ' set pins 0-5 to low
GOTO Main

'-------------------------------------------------------------------------------
MoveFoward:
'-------------------------------------------------------------------------------
MoveRight:
'-------------------------------------------------------------------------------
MoveLeft:
'-------------------------------------------------------------------------------
Turn: 'turn to the right sharp and continue till foward distance is greater than 11"
'-------------------------------------------------------------------------------
DIRS = %111100 ' enable motor lines
DO WHILE Cfront DIRS = %101000 'turn on forard left motor and back right motor and enable motors
PAUSE 40 ' set pause time higher speed up turn
GOSUB CkEyes 'check the center eye distance
IF distance > 11 THEN GOTO main 'goto the main subrotine
DIRS = %111111 'stop motors from turning and disable motor enable line for no hard break
LOOP
GOTO MotorStop

RobosapienV2-4mem8
RobosapienV2-4mem8's picture

M'mmmm This is interesting, I notice you are using the enable, I take it these are connected to those two 10K resistors from the H-bridge l298?? Thanks

dontknowdiddly
dontknowdiddly's picture

Hey GWJax. How is the remote coming? I am ready for Elvis to preform. Looks like you have all the codes down. Let me know when to expect the arrival of the new and improved remote.

dontknowdiddly
dontknowdiddly's picture

Hey GWJAX How are you coming with the auto remote. I did get your remote but back to the same old problem Elvis won't stay active.

GWJax
GWJax's picture

I had to take some time off from the bots latley but will be back in full swing shortly. glad you got my remote saftly. just keep ituntil I send you yours back with all the mods, thanks for waiting soo long but I get it to you soon.
Jax

GWJax
GWJax's picture

Just to let you know I forgot to inlude the schematics for the Elvinator Eye Fade program so here it is . Sorry if this stoped anyone from trying this code out for their projects.

Jax

EyeFader Schematics

ElvisPartGuy
ElvisPartGuy's picture

I'm trying to wire the elvis servos to my microcontroller. Does anyone know the voltages and such. I don't think that they use standard servo technology.

GWJax
GWJax's picture

ElvisPartGuy said:
I'm trying to wire the elvis servos to my microcontroller. Does anyone know the voltages and such. I don't think that they use standard servo technology.

The Elvis Alive does not use servos instead it uses dc motors controlled by Hbridge boards. The motors run at 9V provided by the power supply. Please review my articles on the Elvinator also look how I attached the eyes using a BasicStamp 2 MCU. When attaching a MCU to the Hbridge make sure you connect all grounds together.

 

Jax

ElvisPartsGuy
ElvisPartsGuy's picture

OK. Thanks. I'll have to try that.

Is there an off the shelf h-bridge that you might suggest? Or maybe it would be a lot cheaper to build one. Or should I just re-use the boards he comes with? What do you think?

PS. If you or any others need Elvis boards, other parts, or whole Elvises I have a LARGE collection. I have ALL the Elvis parts on my ebay store: Robots and Androids and More!

http://stores.shop.ebay.com/Robots-and-Androids-and-More

GWJax
GWJax's picture

I would just use the boards that come in the Elvis just because they are designed for the voltage and current used for the motors plus I would also use the Power supply as well..

Jax

ApplicationBistro
ApplicationBistro's picture

Do you have a PDF file of the Elvinator hack?

GWJax
GWJax's picture

You can find it on instructables.com at this link

 

Jax

Pages