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.
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… )
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…
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.
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
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.
Got Xan’s ver 1.3 code loaded into the Ox18 (I think I’ll just call this bot “Odie”). 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. 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)
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
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
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
;--------------------------------------------------------------------
;[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
okay… first step goes
next step set hexon to true… not 1 ??
greez t4ndu
another question where are u from?
i have jet 5 oclock pm.