go away spammer

Author Topic: PS2 Controller on an Axon tutorial.  (Read 10259 times)

0 Members and 1 Guest are viewing this topic.

Offline dunkTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
PS2 Controller on an Axon tutorial.
« on: September 07, 2008, 07:25:41 PM »
hey guys,
i finally got round to playing with the shinny Axon Admin sent me.

i found the whole process of getting it working to be fairly painless.
anyone with some microcontroller experience should get a "hello world" working within an evening.
the board is well designed and practically laid out. i'm afraid i don't have anything to compare it to though as i've always made my own development boards.

as a test project i set about interfacing a Sony PS2 controller and displaying the output to my laptop.

could someone please take a read through the following and see if it makes sense?
http://www.societyofrobots.com/member_tutorials/node/200


thanks,

dunk.

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: PS2 Controller on an Axon tutorial.
« Reply #1 on: September 07, 2008, 07:27:33 PM »
any video demo?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: PS2 Controller on an Axon tutorial.
« Reply #2 on: September 08, 2008, 12:35:15 PM »
Wow that was quick!

Ok three requests:
1) video demo!
2) a good pic of the Axon with a PS2 controller to use as a thumbnail on the Axon examples page
3) in the code:
Code: [Select]
  // main program loop:change to:
Code: [Select]
  // main program loop
  // ADD YOUR CODE HERE
  // use data0, data1, data2, etc. after rprint as your control input variables


Also, out of curiousity, why does communication need to open and close in that loop and not just remain open?

Perhaps the PS2 controller initialization should be made as a separate function (like gameByte()) so that it can be called? I'm just thinking of ways it can be modded so that it can be easily hacked into someone else's project. I understood it on first glance, but others new to robotics might have to think hard :P

Offline dunkTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: PS2 Controller on an Axon tutorial.
« Reply #3 on: September 08, 2008, 04:20:22 PM »
there.
added picky, YouTube clip and the suggested readability improvements to the code.
[youtube]0KEOICK4tKA[/youtube]

Quote
Also, out of curiousity, why does communication need to open and close in that loop and not just remain open?
that's just the way the PS2 packet works. the packet will start when the Attention line goes low and finishes when it goes high (whether all requested data has been sent or not).

or do you mean "why are there multiple calls to the function gameByte ?"?
gameByte is called once per byte. one byte is sent to the controller and one bye is received from it.
after the 3 byte header gameByte is called once more per data byte.

Quote
Perhaps the PS2 controller initialization should be made as a separate function (like gameByte()) so that it can be called?
yea. i was thinking that myself but could not be bothered rewriting it just now. maybe in the future.
if anyone else feels the need to adopt this project then feel free to make it more user friendly.


dunk.

Offline arixrobotics

  • Full Member
  • ***
  • Posts: 119
  • Helpful? 3
    • TalasTronics WCIT KL2008 Fund Raising
Re: PS2 Controller on an Axon tutorial.
« Reply #4 on: September 19, 2008, 09:12:35 AM »
Hi Dunk,

I noticed you said in the video that the firmware only works with original Sony PS controllers.

I've done a similar project before, interfacing PS controller to a PIC. But what I got was opposite of yours. Mine worked great with cheap China made controllers, but not as good with the original Sony ones. All the digital buttons work ok, but not the analog joysticks. They didn't give out the expected values for the joysticks.

Any idea why this could have happened?


Arif

Offline dunkTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: PS2 Controller on an Axon tutorial.
« Reply #5 on: September 21, 2008, 11:43:12 AM »
Quote
I noticed you said in the video that the firmware only works with original Sony PS controllers.
yea. i'm fairly sure it could be made to work with both with a bit of timing adjustment.
the Axon code is very similar to my original code for the ATmega8 at 8MHz which works with both original Sony controllers and cheapo imports. http://mrdunk.googlepages.com/ps2controlleronanavr
the only real difference is the timing. the cheapo controller will probably need additional delays inserted somewhere at 16MHz.

if anyone gets a non Sony controller working at 16MHz let me know the exact delays involved and i'll adjust the tutorial.

Quote
All the digital buttons work ok, but not the analog joysticks. They didn't give out the expected values for the joysticks.
sounds like you are not sending the right control codes to put the controller in analogue mode.


dunk.

Offline awally88

  • Robot Overlord
  • ****
  • Posts: 212
  • Helpful? 0
Re: PS2 Controller on an Axon tutorial.
« Reply #6 on: August 09, 2009, 06:53:01 PM »
Good job Dunk,

I was looking at interfacing a PS Controller on the Axon after I finish working the Wii nunchuck but you've beaten me too it! After I finish on the Wii nunchuck I think I'm gonna go old-school and get some Super Nintendo controllers working for robots.

Keep up the good work
A

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: PS2 Controller on an Axon tutorial.
« Reply #7 on: August 10, 2009, 12:48:02 AM »
this was done a year ago ;D and was resurrected by a spammer :P
Howdy

 


Get Your Ad Here

data_list