Xan's Phoenix Code

Hi t4ndu,

Congratulations with your phoenix! Feel free to start your own thread and show us some pics and vids!

Zenta made a sequence for the attacking mode with his PEP. He also included a detailed manual for his PEP. Check this topic for more information. Once you’ve got your sequence ready it can be loaded directly in the memory of the SSC. You’ll need the sequencer to load the sequence. Once the sequence is in the SSC you can use the GP player of the SSC to play the sequence.

You’ll need to add some code to start the GP sequence from your remote. It isn’t included in the current version (1.3). But me or Zenta can provide a code snippet if you need it. :wink:

Good luck,

Xan

Hi t4ndu,

Xan said it all… :wink:
You could also start with the latest issue of Robot magazine and read Harry Muellers article about Phoenix and PEP.

DUDE! Your PEP is in Robot magazine? COOL! Your becoming to get famous! :wink:

Thanks Xan!
Yeah its pretty cool, 5 pages article and even a picture of me holding my red Lynxmotion Phoenix. 8)

And the big bonus is that my wife are beginning to be impressed too :laughing:

WOW Cool! where can I get my copy?

Glad to hear that you’ve managed to impress your wife with your hobby!

The easiest way is to subscribe. Also visit their website.

WOW! Zenta! You and Phoenix are famous!

Gratulation!

PS: Somebody could scan the article about Zenta’s Phoenix?

Thanks!

I’m not sure if its legal to scan an article… :confused:

Hi All,

I’m still working on the fixed point calculations. I’ve got the first functions ready and I’m slowly getting the hang of it. 8)

But I do have some questions concerning the sin, cos and tan functions. I’ve build a sin for 90 deg with a precision of 0.5 deg (180 values). This table returns a sin with a precision of 4 decimals. I’ve build a wrapper for the table that allows me to lookup the sin and cos for the full range. As I sad before, it works great and is much faster!

The program also uses the inv sin and inv cos. Do I need to build another table for that or is there another workaround to get the table position of the value that’s the closest the one I lookup. (hope this makes any sense… :blush:)

I also need to build my own inv tan function. I only had to make a table of 90 deg for the sin and cos part. I’ve looked at the tan but I think I need to build a table for 180 deg. Did anyone did this before? I’m a bit struggling with this because the inv tan function needs to be in radials. This means that the input isn’t in whole numbers…

Any help would be great!

Thanks, Xan

I dont know how much memory do you have. If you have enough memory I think you need to create an another table.
If you hasnt got a lot of memory I think you need to write a logarithmic search. Because the sin and cos table are an ordered table, the logarithmic search was the fastest. It is slower than a direct access, but uses less memory than an another table.

hello

a noob question.

which var say in program on phoenix to stand up. (start button on the ps2 controller?)

i have a PIR sensor from paralax a i/o
the idea is when is somebody in the room the bot stand up. i want intergrate the sensor in the program.

i want use the start up button or the sensor for starting the bot.

can u help me?

Hi t4ndu,

The start button only turns on and off the servos. Turning on and off can be done by changing the bit HexOn. Notice that I also init the body pos and rotation to 0. This way the phoenix starts on 0 the next time the start button is pressed.

[code] IF (DualShock(1).bit3 = 0) and LastButton(0).bit3 THEN ;Start Button test
IF(HexOn) THEN
'Turn off
Sound P9,[100\5000,80\4500,60\4000]
BodyPosX = 0
BodyPosY = 0
BodyPosZ = 0
BodyRotX = 0
BodyRotY = 0
BodyRotZ = 0
TravelLengthX = 0
TravelLengthZ = 0
TravelRotationY = 0

  SSCTime = 600
  GOSUB ServoDriver
  HexOn = False
ELSE
  'Turn on
  Sound P9,[60\4000,80\4500,100\5000]
  SSCTime = 200
  HexOn = True	
ENDIF

ENDIF [/code]

You can let the phoenix stand by increasing the BodyPos Y. I’ve got this programmed at button triangle button.

IF (DualShock(2).bit4 = 0) and LastButton(1).bit4 THEN ;Triangle Button test BodyPosY = 35 ENDIF

So…
Set HexOn to true and BodyPosY to 35 if you want to let the phoenix stand.
Set HexOn to false and BodyPosY to 0 if you want to let the phoenix sit and free the servos.

Hope this get you in the right direction. :wink:

Xan

Got Xan’s ver 1.3 code loaded into the Ox18 (I think I’ll just call this bot “Odie”). :smiley: All the additions work really well. Noticed the added gaits, I call that last pair of gaits the “circular ripple.” I have wondered what that would look like. The balance gait is really cool!! 8) It adds more realism to the movement of the bot. Here is a clip of some movements.
youtube.com/watch?v=bZlYEOOEHSM
I’ll post some more updated pics showing the re-cableling job on my thread. Looking foreward to playing with the code. BTW, There are some buttons left over. I’m looking for some hints on how to add some code to use them to turn on/off some pins on the Bot Board. I have a couple of light displays and stuff I’d like to control with the PS2. :slight_smile: I’ll study the code a bit more first.
Gotta go get this month’s Robot Mag; I heard there is a writeup I should see . . . . . 8)

thank u,

i was on the right way.

but i have another problem. my sensor i cant read…

i want include

pirin con P7 ;i/oport on BB2 for input

pirin var bit ; say port info are 1 or 0

main

if pirin = 1 then
hexon = true
BodyPosY = 35
endif

included in your code.
the sensor is

parallax.com/Store/Microcont … roductName

parallax.com/Portals/0/Downl … r-V1.2.pdf

hmm
i write a small programm for only read the PIR

pir con p7
pir var bit

if pir = 1 then leda = 1

endif

but it doesnt goes…

where is the problem?

bb2 and atom 28 pro.

I’m glad you like the new version :slight_smile:

Totally true! This month’s Robot Mag has got a good 5 pag article about Zenta’s work. It’s really worth it :smiley:

Xan

It’s a good step to make a small program to test the functionality before including it in the main program. I’ve looked at your test program and decided to give you a quick copy/paste demo program. This demo program allows you to use the buttons on the BB2 to switch on/off led C. I suggest you try to figure out how it works and adapt it to get it to work with the PIR.

[code];--------------------------------------------------------------------
;[CONSTANDS]
TRUE con 1
FALSE con 0

BUTTON_DOWN con 0
BUTTON_UP con 1

;--------------------------------------------------------------------
;[INPUTS]
butA var bit
butB var bit
butC var bit

prev_butA var bit
prev_butB var bit
prev_butC var bit
;--------------------------------------------------------------------
;[OUTPUTS]
LedA var bit ;Red
LedB var bit ;Green
LedC var bit ;Orange

;--------------------------------------------------------------------
;[MAIN]
main:
;Button A
if (butA = BUTTON_DOWN) AND (prev_butA = BUTTON_UP) then
LedC = 1
endif

;Button B
if (butB = BUTTON_DOWN) AND (prev_butB = BUTTON_UP) then
	LedC = 0
endif

;Button C
if (butC = BUTTON_DOWN) AND (prev_butC = BUTTON_UP) then
	sound P9,[100\4000]
	;Used for test code
Endif

gosub ReadButtons
gosub WriteLeds

goto main

;--------------------------------------------------------------------
;[ReadButtons] Reading input buttons from the ABB
ReadButtons:
input P4
input P5
input P6

prev_butA = butA
prev_butB = butB
prev_butC = butC

butA = IN4
butB = IN5
butC = IN6

return
;--------------------------------------------------------------------
;[WriteLEDs] Updates the state of the leds
WriteLEDs:
if ledA = 1 then
low p4
endif
if ledB = 1 then
low p5
endif
if ledC = 1 then
low p6
endif
return
[/code]
Let me know if you’re stuck :wink:

Good luck!

Xan

hmm thank you very much!

but when i press
button A or B the led on C doesnt light up.

it sound any time… but i dont know

i must set the jumpers?

i have set it.

its for activate the leds and the buttons?

Yes, you need to place jumpers to enable the buttons. It is shown in the BB2 manual on page 2. Don’t forget to disconnect anything on P12 to P15.

I’ve copy paste it together without testing it so there could be a bug in there. I’ll check it out this evening to be sure :wink:

Xan

okay

i set the 3 jumpers to enable. its okay. when i press the led light up. but onli Button A light A… not C

its nothing on the board. only that.

it goes about 2-3 minutes the its sound one beep the its silence until any minutes… then its sounds 5 times ago… then ist silence…
without any timers…

i think perhaps is my atom spooky :wink:

i hope not…

;--------------------------------------------------------------------
;[CONSTANDS]
TRUE con 1
FALSE con 0

piru con 1
pird con 0
;--------------------------------------------------------------------
;[INPUTS]

pir var bit

prev_pir var bit
;--------------------------------------------------------------------
;[OUTPUTS]

LedC var bit ;Orange

;--------------------------------------------------------------------
;[MAIN]
main:
;Button A
if (pir = pird) AND (prev_pir = piru) then
LedC = 1
endif

gosub Readinput
gosub WriteLeds
goto main

;--------------------------------------------------------------------
;[ReadButtons] Reading input buttons from the ABB
ReadInput:
input P7

prev_pir = pir

pir = in7
return
;--------------------------------------------------------------------
;[WriteLEDs] Updates the state of the leds
WriteLEDs:

if ledC = 1 then
low p14
endif
return

it works with the sensor!!
it was wrong led are p12-p14
not p4-6 :slight_smile:

okay… first step goes :smiley:

next step set hexon :wink: to true… not 1 ??

greez t4ndu

another question where are u from?
i have jet 5 oclock pm. :slight_smile:

cu