Xan's Phoenix Code

Hi T4ndu,

I’m glad you’ve got it to work! I’m using P12-14 for the PS2 remote and rewired the buttons to P4-P6. I forgot to replace it to the original pins. But I’m glad you got it to work anyway! 8)

If you check the constants you will see that true = 1 so it doesn’t matter if you put hexon to 1 or to True. :slight_smile:

 TRUE       con 1

I’m from the Netherlands. GMT +1

Good luck and don’t forget a video :slight_smile:

Greetings

Xan

ah yes?

okay cool GMT +1 im too :wink:

im from switzerland :smiley:

i think u are a asian :wink: Xan. the name sounds like asian.

do you know IC bot? i want build another one like that. traking faces and messuring distance… when someone there he goes backward. like the movie: youtube.com/watch?v=4oXuSXCKJeY

its so cool!
:smiley: i have a wireless cam, roborealM., a serial wireless conection.
a hexapod… distance messuring :slight_smile:

i hope it will works :wink:

is the “X” pronounced phonetically as an english “ch” or “z” or ??? :question:

i have modifed the code.
its for startup the bot. i have this pir sensor

i include this on the code.

Variables:

;[PIR Inputs]
pir var bit
prev_pir var bit
Timercount var long
fTimerActive var bit
piron var bit
;---------------------------------------------

in main code this

;[MAIN]
main:
'Start time
GOSUB GetCurrentTime], lTimerStart

GOSUB PIRhigh ;Sensor for wakeupe

'Reset IKsolution indicators
IKSolution = False
IKSolutionWarning = False
IKSolutionError = False

;Gait
GOSUB GaitSeq
rest main code…

subcode

;----------------------------------------------------------------------
;PIRhigh then Hex on
PIRhigh
if pir <> prev_pir then
; The input changed
if pir = 1 then
; The input went high
piron = 1
TimerCount = 0
fTimerActive = 0

       else	   
			 fTimerActive = 1
     	  ; The input went low again 
       
      	 endelse
        	
     endif 
        
   elseif fTimerActive = 1 
     TimerCount = TimerCount + 1 
      pause 10
       ; See if we exceeded our time out
        
        if TimerCount > 1000L then 
        piron = 0
        fTimerActive = 0
            
        endelseif
                    
        endif
        
        endif 

gosub Readinputpir
gosub WriteLedpir
return
;--------------------------------------------------------------------
;[ReadButtons] Reading input buttons from the ABB
ReadInputpir:
input P7

prev_pir = pir

pir = in7
return

;--------------------------------------------------------------------
;[WriteLEDs] Updates the state of the leds
WriteLEDpir:

if piron = 1 then
HexOn=1
BalanceMode=1
BodyPosY = 35
low p12

 else
 	 HexOn =0
 	 BalanceMode=0
 	 BodyPosY = 0
 	 high p12

endif

return

;--------------------------------------------------------------------
;[PS2Input] reads the input data from the Wiiremote and processes the
;data to the parameters.
Ps2Input:

rest code…

can it work?

i must test it today… but i dont know its good or bad.

other question

can i include roboraelM code in the xan code. does it works?
i want to make a HEAD hwo can tracking people with a webcan… send it via serial back to botboard for 2 servos which controll the head for following. its is possible or i must write a complet new code?

thanks t4ndu

Hi,

I’ve been thinking of giving one of my walkers some vision for some while now. But let’s say time isn’t on my side lately :wink:

To add a head you need to change some things in the IK and move the parent from the body to the head. This way the body also slightly moves if it looks around. You also need to write a pc program that recognize and tracks somebody’s head and returns it in a X, Y, Z that can be send to the hex. I’ve already started a C# program to which should be able to do that. It uses a open source C++ library.

It will involve a lot of programming if you want to get it as smooth as the IC hexapod from Matt but it can be done :slight_smile:

Adding vision is on my To-Do list but terrain adaption is on nr 1 at the moment :wink:

I’m Dutch my the way not Asian :stuck_out_tongue: And Jeroen is my real name, which is a typical Dutch name btw. Xan comes from Xanore (see my youtube channel) which I’m using for a long time already. The way I pronounce Xan is more with a “châ€

sounds good :slight_smile:

i matt froum is somebody which make that in 10 minutes he write a programm for tracking people. but he has a p.brain controller.

for the terrain adapting i think over that… u need feet sensors…?
then u must ask if the feets standing on the ground?

my PIR sensor works fine :wink:

when somebode comes in room he standup 10mm… when he is 5 seconds active he moves up to 40mm.

next is time out for sensor when hexon is false… because the senor reactivating himself when the body moves down…

If he’s able to build that 10 min, he should be rich by now… :astonished:

All fine by me Jim :wink:

the “J” is pronounced as an english phonetic “y”? Had a guy from over your way work for us a few years back… spelled it Jan but pronounced in english phonetics as Yon. :wink:

I’ve checked all the battery voltages, the wiring, and all is in order. When I apply VL, its like the program gets stuck in a loop. About once a second, it will play 3 tones in ascending frequency. I’ve looked at VL on a DMM and an oscilloscope to see if the BBII is resetting due to a brownout scenario and its not.

I get the same results whether I’m tethered or wireless.

What might it mean when it loops like this?

Thanks,
Duane

Hi Duane,

The repeating sound means that the ATOM can’t initialize the PS2 controller. This can be caused by a couple of thing.

Start by checking if you have the latest IDE 8.0.1.8 installed.
Be sure that the PS2 remote is connected as described in the phoenix tutorial (figure 41-3). Check if the jumpers for the buttons A,B,C are removed!
I don’t know which version you are using. It’s best you get the latest (V1.3) from my project page.

Let me know if it works!

Xan

Xan wrote:

I was curious, are the jumpers for the A, B, C buttons a problem? I installed them to see how the lights responded and the program seems to work fine. I know they are just there for programming reference, and I see no limits being indicated when the bot is operating. :slight_smile: All is green. :slight_smile:

My button jumpers ARE installed. I’ll remove when I get home and see what happens.

I do have 8.0.1.8 EXP installed.

Thanks,
Duane

I was running “Odie” in balance mode and I noticed when L1 or L2 were pushed that the body would drop a little bit. Rotational translations seemed relatively normal. Linear translation laterally is also normal, however linear translation forward and backward cause the hex to walk in the opposite direction the analog stick is applied. It appears as a ripple gait with quick short steps. Could this be considered a bug? :smiling_imp:
Core2 & myself are planning to turn some pressure sensor mounts on my lathe for the feet in the coming weeks. We are both looking forward to uneven terrain adaptation. :smiley: :smiley: :smiley: .

Removed the button jumpers and all works well. Now to take some measurements and enter them into the program.

Thanks Xan.

:laughing: Yup thats a little bug. I’ll dig into it when I find time for it, probably not this side of the year. I recommend turning of the balance mode when doing body translation. What actually happens here is that Phoenix is trying to outbalance the translation. Sorry for this but its hopefully just a minor bug.

hi all great programmers t4ndu stupid questions are back :wink:

i have build a head for phoenix :slight_smile:
servo ports 28 , 29

how tu implement in xan code that i can move the head with the ps 2 controller? i tink press triangel an L1 or so. then i can move head with the right stick on the ps2 controller.
is that difficult?

i set any var in the program and implement any codes for controll servoout. like legs from xan code.

what i must do for take input from ps2 controller? an controll servos?

greez t4ndu

No questions are stupid (eh… ok some are, but not yours :wink: ).
You’ve made a head for Phoenix?! Cool! Please post some pictures in your own thread.

This should be easy to do.
Start by studying Xan’s code.
You probably need two constants for the servopin.
Ex.

HeadServoPanPin con P28 ;You can call it whatever you want HeadServoTiltPin con P29
And two sword (sbyte might be enough too) variable for the servo angle, or just a word variable for the pwm value.
Ex.

HeadPanAngle var sword HeadTiltAngle var sword

The const and vars must be defined at the start of the code.

Navigate to the PS2Input sub. **Study this code **and try to understand what happens with the different variables when the PS2 are activated. I like to test out the code before I post an example. But a little hint would be:

HeadPanAngle  = (Dualshock(5) - 128)/2 

The Dualshock returns a value between 0-255, so the center value are about 128. And this code would set your HeadPanAngle variable between +/- 64 deg.

You need to add more code than this to make it work in the PS2Input sub.

Navigate to the Servodriver sub.

Just before the send command, add these two lines:

serout SSC_OUT,SSC_BAUTE,"#",dec HeadServoPanPin,"P",dec TOINT(TOFLOAT(HeadPanAngle+90)/0.10588238)+650] serout SSC_OUT,SSC_BAUTE,"#",dec HeadServoTiltPin,"P",dec TOINT(TOFLOAT(HeadTiltAngle+90)/0.10588238)+650]

There are probably many different ways to solve this, but I hope this was a little help for you.

thank you!

this was a very great help!
yes i understand. i think at the weekend i can test the code with phoenix and i will make a new thread with fotos.

thank u for this detailed response.

Sausses all with the controller I already recognized:) I always learn better.

but u response was the key