Mindsensor PS2 Controller Issues

Hi Guys,

I’m trying to get the simplebot_psp.py to run, but I am getting the following error:

Traceback (most recent call last):
File “simplebot_psp.py”, line 55, in <module>
b.upd(I2C_PORT) #Update the button values
File “build/bdist.linux-armv6l/egg/BrickPi.py”, line 219, in upd
TypeError: unsupported operand type(s) for >>: ‘NoneType’ and ‘int’

Any help would be greatly appreciated?

Also the simplebot_psp.c won’t compile either due to many errors:

/tmp/ccVBx2Dk.o: In function ClearTick': simplebot_psp.c:(.text+0x10): undefined reference toclock_gettime’
/tmp/ccVBx2Dk.o: In function CurrentTickMs': simplebot_psp.c:(.text+0x60): undefined reference toclock_gettime’
/tmp/ccVBx2Dk.o: In function CurrentTickUs': simplebot_psp.c:(.text+0x114): undefined reference toclock_gettime’
/tmp/ccVBx2Dk.o: In function BrickPiSetup': simplebot_psp.c:(.text+0x1cc4): undefined reference toserialOpen’
/tmp/ccVBx2Dk.o: In function BrickPiTx': simplebot_psp.c:(.text+0x1df0): undefined reference toserialPutchar’
/tmp/ccVBx2Dk.o: In function BrickPiRx': simplebot_psp.c:(.text+0x1e9c): undefined reference toserialDataAvail’
simplebot_psp.c:(.text+0x1ec4): undefined reference to serialDataAvail' simplebot_psp.c:(.text+0x1ee8): undefined reference toserialDataAvail’
simplebot_psp.c:(.text+0x1f10): undefined reference to `serialGetchar’
collect2: ld returned 1 exit status

cheers

Ray

Hey Ray,
Not immediately sure, but it looks like you’re looking for a dependency. Are you using one of our operating systems, or are you running your own?

It could be that we broke something on our last github push. But it could also be looking for a dependency.

Let me know about the operating system and we’ll try to dig a little further.

Best,

John

Hi Guys,
I am getting a very similar issue when I attempt to run simplebot_psp.py.

Traceback (most recent call last):
File “simplebot_psp.py”, line 55, in <module>
b.upd(I2C_PORT) #Update the button values
File “build/bdist.linux-armv6l/egg/BrickPi.py”, line 166, in upd
TypeError: unsupported operand type(s) for >>: ‘NoneType’ and ‘int’

I downloaded one of your images and flashed to an SD card via ImageWriter. I am running off a battery pack with the sensor connected to port 5. Any help would be greatly appreciated.

JR215,

Thanks for posting the error code. This makes it a lot easier to pinpoint the issue.

I think the problem might be with the installation of BrickPi.py. The easy way to test this is to copy a local copy of BrickPi.py into the folder you’re working out of.

I think the commands for this would be:

cp ~/Desktop/BrickPi_Python/BrickPi.py ~Desktop/BrickPi_Python/Project_Examples/simplebot

That should copy the latest BrickPi.py file into the simplebot directory.

Please let me know if that works. I probably need to go back and reinstall the python drivers in the image if this is the case.

John,
Thanks for the quick response. I copied the BrickPi.py file into the simplebot directory and tried to run simplebot_psp.py again, but no luck. It gave me the following error:

Traceback (most recent call last):
File “simplebot_psp.py”, line 55, in <module>
b.upd(I2C_PORT) #Update the button values
File “/home/pi/Desktop/BrickPi_Python/Project_Examples/simplebot/BrickPi.py”, line 166, in upd
self.ljb=~(BrickPi.SensorI2CIn[I2C_PORT][0][0]>>1)&1
TypeError: unsupported operand type(s) for >>: ‘NoneType’ and ‘int’

Anything else I should try ?
Thanks.

Update - Got it working

I finally figured out my issue was I had the Mindsensors PS2 sensor connected to Sensor Port 5, but I should have connected it to Port 1. I had the misconception that Sensor Port 5 was the dedicated I2C port, and the only I2C port. After reading the I2C development notes I learned otherwise. Once the PS2 sensor was connected to Sensor Port 1 it worked great.

Thanks John for your assistance.