Society of Robots
     | Robot Forum | Robot Tutorials | Robot FAQ |
July 31, 2010, 03:36:42 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: SoR Robot Chat every friday night. Join us! (forum integration fix coming when I have time)
http://www.societyofrobots.com/robotforum/chat/

Robot Forum
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: PS2 Controller on an Axon tutorial.  (Read 3495 times)
0 Members and 1 Guest are viewing this topic.
dunkTopic starter
Expert Roboticist
Supreme Robot
*****

Helpful? 14
Offline Offline

Posts: 1,025



View Profile WWW
« on: September 07, 2008, 08: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.
Logged

airman00
Contest Winner
Supreme Robot
****

Helpful? 19
Offline Offline

Posts: 3,642


narobo.com


View Profile WWW
« Reply #1 on: September 07, 2008, 08:27:33 PM »

any video demo?
Logged

Check out the Roboduino, Arduino-compatible board!


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

www.Narobo.com
Admin
Administrator
Supreme Robot
*****

Helpful? 107
Offline Offline

Posts: 9,732



View Profile WWW
« Reply #2 on: September 08, 2008, 01: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:
  // main program loop:
change to:
Code:
  // 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 Tongue
Logged

dunkTopic starter
Expert Roboticist
Supreme Robot
*****

Helpful? 14
Offline Offline

Posts: 1,025



View Profile WWW
« Reply #3 on: September 08, 2008, 05:20:22 PM »

there.
added picky, YouTube clip and the suggested readability improvements to the code.
<a href="http://www.youtube.com/watch?v=0KEOICK4tKA" target="_blank">http://www.youtube.com/watch?v=0KEOICK4tKA</a>

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.
Logged

arixrobotics
Full Member
***

Helpful? 3
Offline Offline

Posts: 112


View Profile WWW
« Reply #4 on: September 19, 2008, 10: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
Logged
dunkTopic starter
Expert Roboticist
Supreme Robot
*****

Helpful? 14
Offline Offline

Posts: 1,025



View Profile WWW
« Reply #5 on: September 21, 2008, 12:43:12 PM »

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.
Logged

awally88
Robot Overlord
****

Helpful? 0
Offline Offline

Posts: 191



View Profile
« Reply #6 on: August 09, 2009, 07: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
Logged
SmAsH
Supreme Robot
*****

Helpful? 75
Offline Offline

Posts: 3,909


SoR's Locale Electronics Nut.


View Profile
« Reply #7 on: August 10, 2009, 01:48:02 AM »

this was done a year ago Grin and was resurrected by a spammer Tongue
Logged

Pages: [1]
  Print  
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Axon Getting Started Tutorial problem
Software
Gertlex 13 2087 Last post July 04, 2008, 04:49:06 PM
by Admin
Two Questions regarding PS2 Controller to Axon
Electronics
MaltiK 6 1555 Last post December 14, 2008, 08:03:35 AM
by mbateman
Axon Servo Controller ???
Software
Wizzard 13 1572 Last post February 15, 2009, 01:39:52 PM
by Wizzard
Axon PS2 Controller Interface Library
Software
JadeKnight 1 728 Last post February 23, 2010, 05:42:59 AM
by dunk
Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!


Advertise on this Forum