Submitted by johndavid.nelso... on Tue, 02/24/2015 - 17:30
Hi,
has anybody managed to control a Picoborg Reverse with, for example, arrow keys instead of the sliders in the GUI? I would like to do this. Can anybody advise? I'm a python noob so I don't know where to start.
piborg
Wed, 02/25/2015 - 13:23
Permalink
Keyboard controlling the PicoBorg Reverse
We did the following to change this script to drive a PicoBorg Reverse as described above:
socket
orsender
command
ordriveCommands
regularUpdate
since it is no longer neededif
,elif
,else
block set the motor speedsPBR.MotorsOff()
when the script is finishedThis was the resulting script, which we have called
pbrKeyboard.py
(attached to the bottom of the post):johndavid.nelso...
Wed, 02/25/2015 - 17:05
Permalink
Keyboard controlling the PicoBorg Reverse
Thanks so much. Really helpful. BTW, not a criticism, there's a little typo on line 47 'moveRighte' should be 'moveRight'. Thanks again for being awesome!
johndavid.nelso...
Mon, 03/23/2015 - 14:26
Permalink
network code
Hi, thank you for the above code. I have successfully configured all the hardware and software to produce the desired result using a bluetooth keyboard. I would like to control my motors over the network - from a remote computer. Would it be possible to re-instate the networking code into the above pbrKeyboard.py?
I am interested in what this guy did https://github.com/shaunuk/picar
He used socket.io and javascript to collect accelerometer data from a smartphone via a web browser and used this to drive his rc car. Would such a thing be possible with PicoborgReverse?
piborg
Mon, 03/23/2015 - 15:50
Permalink
Network code
It would be possible to put the network functionality back in, using the network to send commands from another computer.
Alternatively you could modify the picar code you linked to work with PicoBorg Reverse instead.
Cody Erekson has made a javascript library for controlling PicoBorg Reverse:
https://github.com/cerekson/picoborgrev
You should be able to modify the picar/app.js script to call this
pbr
object instead of thepiblaster
object it currently uses.johndavid.nelso...
Sun, 03/01/2015 - 18:43
Permalink
error message, any clues?
piborg
Sun, 03/01/2015 - 19:40
Permalink
I2C bus error
I think this is because the scripts are trying to use the wrong I2C bus for your Raspberry Pi.
We tend to see this problem with older model Raspberry Pis running recent copies of Raspbian.
By default the scripts try looking for the PicoBorg Reverse on
i2c-1
, then if they cannot find it they tryi2c-0
.Try changing line 194 in
PicoBorgRev.py
to be:This should make the script try
i2c-0
beforei2c-1
.Since all of the examples use
PicoBorgRev.py
it should fix all of them.johndavid.nelso...
Sun, 03/01/2015 - 20:43
Permalink
resolved
Thanks
I found the solution here:
https://www.piborg.org/picoborgrev/troubleshoot/forum
I had to go really far down the posts to the bit with " bash ... curl ...https://...txt"
and then enable i2c via raspi-config
I left line 194 as busNumber = 1
all sorted.
anneandken@gmail.com
Mon, 12/07/2015 - 17:05
Permalink
Running Keyboard control on reboot
I use a wireless keyboard and this is working fine when I run it from a terminal window. I would like to run it on reboot via crontab -e as for the Sequence program. It does not work. My keyboard is activated by the first keypress, ie it does not have an on/off switch. So that I can press a key to start the keyboard I have tried putting in a 20 second time delay both at the beginning of the code after the time library call. I have also tried putting the 20 second delay after the library calls and just before setup pygame and keyboard states. Neither work, any help much appreciated.
piborg
Mon, 12/07/2015 - 19:00
Permalink
Keyboard input from startup
I think the problem you are having is that the script is not in the foreground, so the keyboard inputs are going elsewhere.
You could try adding this line just after the
set_caption
line and it might work:pygame.event.set_grab(True)
This is not really recommended as it will prevent other things seeing the keyboard.
In this case though it may be the best way to ensure the input goes to this dialog instead of somwhere else.
Bascially this gets the script to 'steal' the keyboard input for itself, so it should not loose the keyboard when running.
I would keep the delay in before pygame is setup, it will give the desktop a chance to load before the script tries to create its dialog.
anneandken@gmail.com
Thu, 12/10/2015 - 08:40
Permalink
No Luck
Thanks for the suggestions. It is still not working. I will try to set up an ap to control out of wifi coverage but it is not easy on the pi. Until then I have moved the files to the top level and type them in blind which does of course work except for finger trouble.