Web UI + web cam
Forums:
Hi, By following the various post on the forum I've managed to use the web ui without the camera. I'm now wondering if it is possible to use a usb web camera in place of the standard raspberry camera.
Also how can I modify the code so that when a button is pressed the motors run and only stop or change direction when another button is pressed.
Thanks
piborg
Tue, 11/01/2016 - 11:02
Permalink
Web camera with Web UI
As long as the web camera supports Video4Linux the script can be altered to work with it.
This requires a fair number of changes though as the current script makes use of the picamera library which only supports the standard camera.
As for the buttons this feature is already present, how the buttons behave depends which URL you go to.
If we assume the Pi has an IP address of
10.0.0.1
then:http://10.0.0.1/hold
- Buttons need to be held down to keep movinghttp://10.0.0.1/
- Buttons keep moving until a different button is pressedcsgoskinhunt
Sun, 03/19/2017 - 12:40
Permalink
Hi!
Hi!
I've just tested this feature. It does work as explained, however, no matter for how long you press forward, for example, somehow it still goes forward only a set amount of time, eventhough I'm still holding the button with my mouse.
Is there a way for the robot to really go forward for as along as I hold the button down?
Thanks!
piborg
Mon, 03/20/2017 - 11:59
Permalink
Disconnected timeout
The most likely cause is the disconnected check is shutting the motors down. It basically works by checking how long it has been since a button has been pressed or the camera image has been updated. If the image is updating too slowly it may be causing it to trigger.
This is the code responsible for the disconnection check:
What you can do is increase the allowed time to be greater than one second. To do this you need to change the number in the lines:
to something larger, 5 for example:
Hopefully this will solve the problem :)
csgoskinhunt
Fri, 03/24/2017 - 10:51
Permalink
It did!
Thanks, this did solve the problem. Just for a safe measure, I've changed from 1s to 10s just so if I wanted to drive in a straight line without stoping for longer periods of time:)
clankerr02
Sun, 09/10/2017 - 22:10
Permalink
Adding third motor control to Web UI
Ive had great fun controlling a robot using the web UI. Your advice has been amazing. Thanks.
I would now like to use my piborg reverse to power a ROV. It would need three motors and therefore will need a second reverse. Two motors will control forward/reverse and left/right, the third motor would control ascend/ descend. I would like to continue using the Web UI as it has the option for using a camera. When adding the second reverse board would extra controls show up on the Web UI ? If not would it be possible (and how) to add controls for the third motor I.e ascend/ descend.
Edit. After much head scratching and searching I've got a possible solution but also a problem! Would it be possible to add a second piborg reverse and control three motors with the joyborg script ? Again would this be possible and how?
Thanks in advance.
piborg
Mon, 09/11/2017 - 11:47
Permalink
Adding a second PicoBorg Reverse to the diddyJoy.py
The first thing to do is setup the two boards with different addresses. Follow this detailed guide: Setting up multiple PicoBorg Reverses
In the below code I will be using the addresses
0x11
and0x12
. If you used different ones change the numbers as needed. The board with address0x11
is for the left / right motors as normal.The next step is to get the first board working again at the new address. Open the
diddyJoy.py
script and find this line:Change the line to remove the comment symbol and use the new number like so:
At this stage you should be able to save the script and it should work the same as before.
Next we will add a new section to setup the second PicoBorg Reverse as
PBR2
. Add this after the setup of the first board:Now we need to add a third joystick axis to read. I will used axis
3
which is up and down on the right stick for a PS3 controller. Start by adding a new setting for the control:After that add a new value,
thirdMotor
:The next part is to read the third joystick position:
Now add the third motor output to the slow check and setting of the motor speeds by adding these lines:
Finally find all copies of:
and add the same for the second board:
There should be three in the standard example.
clankerr02
Sun, 09/17/2017 - 18:03
Permalink
Remote diddyjoy
Thanks for the above, I'm waiting for payday so I can buy my second reverse. I modified the code/ axis so have forward/ reverse/ left right on one joystick. I've tested this wit the diddyjoy script and works great. However........
To control the "ROV" remotely I will need a tether. I considered using usb-to- cat5 adaptors. With these I could simply plug the game pad in and use the diddyjoy script.
I would prefer however to plug the cat5 network cable directly to the Raspbery Pi and connect it to a second Raspberry pi. this would enable me to make any adjustments to the ROV using VNC and I could make use of the Remote joy script.
I've spent all weekend trying to get the remote joy to work. Nothing I try works.
Ive followed the instructions and all works on the controlling Pi but not on the Pi conected to the picoborg.
Is there an updated method of using the diddy joy as a remotejoy.
Also how would I run this on start up.
Thanks again for all your help.
piborg
Mon, 09/18/2017 - 11:40
Permalink
RemoteJoy
RemoteJoy is a bit of an old example, it was intended for our PiCy kit which did not really have any speed control. As such the scripts would need a fair bit of editing to make them work correctly with a PicoBorg Reverse instead.
What you will need to do is take the RemoteKeyBorgS.py script and change it to control the PicoBorg Reverse instead. The messages sent over the network will probably need to be changed as well, this will affect the scripts at both ends.
clankerr02
Mon, 10/02/2017 - 20:16
Permalink
RemoteJoy
Once again your advice has been second to none. Just a quick update. I purchased usb-Cat5 adaptors and am now able to control my motors with a joystck from a distance of over 50 feet. Result !
I need a bit more advice. I would like to be able to use a button on the joystick to turn on a set of LED's or latch a relay. Using the remoteJoy code is it possible to do this directly or would I need to use one of the GPIO pins ?
If so how would change the code?
thanks in advance.
piborg
Tue, 10/03/2017 - 15:33
Permalink
RemoteJoyBorg and GPIOs
You should be able to use the RemoteJoyBorg code to do this, it controls GPIO pins by default anyway.
If you look at the standard joystick example for DiddyBorg there is some code which looks for button presses on the joystick which you can copy into the existing
for event in events:
loop.What you then need to do is add a new value into the
driveCommands
list for the extra function at both ends, the standard ON / OFF values should be fine for what you will need :)