tag:blogger.com,1999:blog-9007601562606157016.post7832499368467996375..comments2023-05-11T16:21:37.725+01:00Comments on <Stuff about="code" />: Raspberry Pi, Xbox 360 Controller, PythonMartin O'Hanlonhttp://www.blogger.com/profile/03047799173301971515noreply@blogger.comBlogger75125tag:blogger.com,1999:blog-9007601562606157016.post-42006280160557424032018-02-10T04:44:57.079+00:002018-02-10T04:44:57.079+00:00Hey,
I am stuck at the first step. When I try to i...Hey,<br />I am stuck at the first step. When I try to install xboxdrv, I get an error saying: "Unable to locate package xboxdrv".<br />Please help me fix this.Anonymoushttps://www.blogger.com/profile/09423510828160067989noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-1156456739327801202018-01-12T08:59:56.968+00:002018-01-12T08:59:56.968+00:00Thanks for the reply Martin, Is there any example ...Thanks for the reply Martin, Is there any example code which involves controlling servo motor using Xbox 360 joystick ?Anonymoushttps://www.blogger.com/profile/03641175496783621932noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-67044489089102497322018-01-10T21:42:24.111+00:002018-01-10T21:42:24.111+00:00Sanky - you are using Python 3 - its seems I wrote...Sanky - you are using Python 3 - its seems I wrote this using Python 2 - change to:<br /><br />print("Control Id = {}, Value = {}".format(xboxControlId, value))<br /><br />will resolve this error, but there could be others. Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-43711913435668347392018-01-09T13:03:35.378+00:002018-01-09T13:03:35.378+00:00Hi,
I ran this program on my raspberry pi3,
It i...Hi,<br /><br />I ran this program on my raspberry pi3,<br /><br />It is constantly showing me this error <br /><br /> print "Control Id = {}, Value = {}".format(xboxControlId, value)<br /> ^<br />SyntaxError: invalid syntax<br /><br />What could be wrong ?<br /><br />TY Sankyhttps://www.blogger.com/profile/03782835299076725805noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-8135506225163209112017-11-12T04:26:42.079+00:002017-11-12T04:26:42.079+00:00Gave up on the project for other things. I have it...Gave up on the project for other things. I have it working with keyboard input but not this way. Still want tooAnonymoushttps://www.blogger.com/profile/02599468909052005426noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-41368275597861868562017-09-27T17:18:10.723+01:002017-09-27T17:18:10.723+01:00I realize this is a year later but any luck contro...I realize this is a year later but any luck controlling your robot with the Adafruit MotorHat this way? I have 4 motors running through it and am having trouble.Anonymoushttps://www.blogger.com/profile/10476600060985447573noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-81484468653134524092017-07-04T15:03:00.334+01:002017-07-04T15:03:00.334+01:00I am new to this, but when I try to run my code to...I am new to this, but when I try to run my code to make an LED turn on with the Xbox 360 controller, it keeps displaying this error:<br /><br />Traceback (most recent call last):<br /> File "light.py", line 20, in <br /> joy = xbox.Joystick() <br /> File "/home/pi/Xbox/xbox.py", line 72, in __init__<br /> raise IOError('Unable to detect Xbox controller/receiver - Run python as sudo')<br />IOError: Unable to detect Xbox controller/receiver - Run python as sudo<br /><br />My controller should be connected because I'm running <br /><br />sudo xboxdrv --silent &<br /><br />I have also noticed that sudo xboxdrv --silent & shuts down when I try to run my program. Help would be greatly appreciated. Thanks!<br /><br /><br />Anonymoushttps://www.blogger.com/profile/05071463445494467807noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-43249047376290809112017-05-21T01:52:44.249+01:002017-05-21T01:52:44.249+01:00I am able to run the XboxController.py file and i ...I am able to run the XboxController.py file and i see 'xbox controller running' but when I press buttons nothing prints to the screen. Any thoughts?pay it fowardhttps://www.blogger.com/profile/00384143312533944911noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-29804275283876983052017-03-21T01:05:53.464+00:002017-03-21T01:05:53.464+00:00@TheN that's what I want to do too and have ha...@TheN that's what I want to do too and have had issues, use a pwm with the controller. See if you gave email me and maybe you can help me out. Anonymoushttps://www.blogger.com/profile/02599468909052005426noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-89886834970827206002017-03-20T15:26:18.833+00:002017-03-20T15:26:18.833+00:00But, i also meant what materials am i going to hav...But, i also meant what materials am i going to have to buy to construct this. I'm very new to the idea of using coding and all that and I was wondering what i needed.For example, the initio robot and the xbox USB wireless receiver. Also, I'm not sure if this requires the Rasberry pi thing or not and what is a python package? I'm sorry if I'm asking a lot of question but I'm trying to make this for a school project.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-17915239871688396642017-03-18T16:50:47.855+00:002017-03-18T16:50:47.855+00:00Make what? The robot controlled by an xbox control...Make what? The robot controlled by an xbox controller? My code is here if you want it https://github.com/martinohanlon/initio/blob/master/initioXboxControl.py<br />Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-34156610152653764572017-03-17T15:31:25.880+00:002017-03-17T15:31:25.880+00:00what do I need to make this?what do I need to make this?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-41348799243222959492017-03-14T16:20:28.908+00:002017-03-14T16:20:28.908+00:00Its not an error i have seen before, but it does s...Its not an error i have seen before, but it does sounds like a hardware issue. Although i didnt use an official one so dont assume it has to be a genuine one.Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-88141277957473472482017-03-12T16:13:00.281+00:002017-03-12T16:13:00.281+00:00It's working great now with a tank drive, than...It's working great now with a tank drive, thanks!@TheNhttps://www.blogger.com/profile/10440682166233763406noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-57084741925552866352017-03-11T20:36:23.679+00:002017-03-11T20:36:23.679+00:00I keep having trouble getting XboxController.py to...I keep having trouble getting XboxController.py to successfully receive input from my wireless controller. The controller LED says it's paired (although it cycles between player 1-4 slots) and XboxController.py says the controller is running, but nothing happens when I press buttons. Maybe it's because it's not an official Microsoft Wireless dongle (it works on PC and sometimes on the Pi though)?<br /><br />I keep getting this error when the controller pairs: [ERROR] USBController::on_read_data() : USB read failure: 32: LINUSB_TRANSFER_ERRORAnonymoushttps://www.blogger.com/profile/11113596725743062472noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-72562020354761169202017-03-10T12:19:17.813+00:002017-03-10T12:19:17.813+00:00Capital B for Back... i.e. controllerCallBack not ...Capital B for Back... i.e. controllerCallBack not controllerCallbackMartin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-74333906211384968682017-03-09T12:24:45.613+00:002017-03-09T12:24:45.613+00:00im using the raspian os from dexter industriesim using the raspian os from dexter industriesAnonymoushttps://www.blogger.com/profile/11173644910724935037noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-2074508498384029412017-03-09T12:24:03.745+00:002017-03-09T12:24:03.745+00:00hello im getting the __init__() got an unexpected ...hello im getting the __init__() got an unexpected keyword argument 'controllerCallback' error on my xboxCont = xboxController.XboxController(controllerCallback = MyCallback)Anonymoushttps://www.blogger.com/profile/11173644910724935037noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-81540107694733129552017-03-04T06:35:14.885+00:002017-03-04T06:35:14.885+00:00I would have used Raspbian, but it should work on ...I would have used Raspbian, but it should work on Ubuntu.Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-31399420123468967362017-03-03T23:17:37.567+00:002017-03-03T23:17:37.567+00:00...what is the base OS you are running on the rasp......what is the base OS you are running on the raspberry pi? Raspian? Ubuntu? The Common Sensei, John Huerdhttps://www.blogger.com/profile/10435601234744793568noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-30657107677006268542017-02-18T08:28:18.272+00:002017-02-18T08:28:18.272+00:00Unfortunately the scale doesn't work that way....Unfortunately the scale doesn't work that way. 0 is always the centre and the scale is the value when pushed all the way forward.<br /><br />It should be pretty easy to turn that into the values you need though.Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-86770337109194192472017-02-18T01:09:24.094+00:002017-02-18T01:09:24.094+00:00Hi there Martin, awesome tutorial! I wanted to use...Hi there Martin, awesome tutorial! I wanted to use your library to send pwm values to a talon sr motor controller (http://files.andymark.com/Talon_User_Manual_1_3.pdf) which operates on a signal between 1 to 2 milliseconds. What do you think I should put as the value of the scale in order to return values between 1 and 2? This means that if the analog stick is in the center the value returned should be 1.5, if the stick is pushed all the way forward it should be 2, and if it is pulled all the way back it should be 1. Any help would be greatly appreciated. Thanks!@TheNhttps://www.blogger.com/profile/10440682166233763406noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-33722555362358773252017-01-09T15:26:39.352+00:002017-01-09T15:26:39.352+00:00You can use the properties of the XboxController c...You can use the properties of the XboxController class to poll values e.g. print(xboxcontroller.RTHUMBY)Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-66495854221300050382017-01-06T15:49:40.751+00:002017-01-06T15:49:40.751+00:00I dont know the series and I couldnt find any link...I dont know the series and I couldnt find any links to the code in the series of videos, but to make the robot move Im guessing you will have to turn on the pins the motors are connected too when button presses are detected:<br /><br />def startButtonCallBack(value):<br /> print "Start button pressed / released"<br /> GPIO.output(motoropinnumber, True)<br /><br />It might help, this is the code I created to move the robot I created, but it is specific for my robot, so use it as a reference not as a solution. https://github.com/martinohanlon/initio/blob/master/initioXboxControl.py<br />Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-77582250773705765962017-01-06T00:22:18.335+00:002017-01-06T00:22:18.335+00:00I am pretty confused on this. I have the XboxContr...I am pretty confused on this. I have the XboxController.py able to detect my controller and the input, but i can't figure out how to use that for my code. I originally made my car based off this video series "http://www.youtube.com/watch?v=LlFkybEQFFA&list=PLQVvvaa0QuDeJlgD1RX9_49tMLUxvIxF4&feature=share"<br />and he uses gpio pin for the motors. Anonymoushttps://www.blogger.com/profile/00570481392578584017noreply@blogger.com