Society of Robots
     | Robot Forum | Robot Tutorials | Robot FAQ |
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2009, 09:34:38 PM

Login with username, password and session length
Search:     Advanced search
SoR Robot Chat every friday night. Join us!
http://www.societyofrobots.com/robotforum/chat/

Robot Forum
72,667 Posts in 9,267 Topics by 5,291 Members
Latest Member: VerAye
* Home Help Help Login Register
0 Members and 1 Guest are viewing this topic.
Pages: [1] Print
Author Topic: PS2 Controller on an Axon tutorial.  (Read 2473 times)
dunkTopic starter
Expert Roboticist
Supreme Robot
*****

Helpful? 7
Offline Offline

Posts: 842



View Profile WWW
« on: September 07, 2008, 06: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? 17
Offline Offline

Posts: 3,607


narobo.com


View Profile WWW
« Reply #1 on: September 07, 2008, 06: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? 62
Offline Offline

Posts: 8,610



View Profile WWW
« Reply #2 on: September 08, 2008, 11:35:15 AM »

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? 7
Offline Offline

Posts: 842



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

there.
added picky, YouTube clip and the suggested readability improvements to the code.


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: 95


View Profile WWW
« Reply #4 on: September 19, 2008, 08: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? 7
Offline Offline

Posts: 842



View Profile WWW
« Reply #5 on: September 21, 2008, 10: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.
Logged

awally88
Robot Overlord
****

Helpful? 0
Offline Offline

Posts: 191



View Profile
« Reply #6 on: August 09, 2009, 05: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? 62
Offline Offline

Posts: 3,285


SoR's Locale Electronics Nut.


View Profile WWW
« Reply #7 on: August 09, 2009, 11:48:02 PM »

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

you can call me James.
check out my site
Pages: [1] Print 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Two Questions regarding PS2 Controller to Axon
Electronics
MaltiK 6 1158 Last post December 14, 2008, 06:03:35 AM
by mbateman
Axon to stepper motor controller
Electronics
amscrplaya 1 720 Last post December 25, 2008, 08:49:55 AM
by Admin
Axon Servo Controller ???
Software
Wizzard 13 917 Last post February 15, 2009, 11:39:52 AM
by Wizzard
Servo Controller with Axon -> Can't initialize...
Software
Canabots 5 434 Last post May 01, 2009, 02:01:38 PM
by dellagd
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!


Advertise on this Forum