Browser Streaming Example Issue[SOLVED]


#1

Hello,

I’ve been trying multiple ways I’ve found online to get the Browser Streaming Example to work but haven’t had any luck. I’m using VNC to connect to the Pi over a wireless network and after I try the “sudo ./robot_web_server.py” command I get the following error:

sockjs.tornado will use json module
/home/pi/Desktop/goPiGo/Software/Python/Examples/Browser_Streaming_Robot/www
Starting web server…
Traceback (most recent call last):
File “./robot_web__server.py”, line 241, in <module>
http_server.listen( 80 )
File “/usr/local/lib/python2.7/dist-packages/tornado/tcpserver.py”, line 125,
in listen
sockets = bind_sockets(port, address=address)
File “/usr/local/lib/python2.7/dist-packages/tornado/netutil.py”, line 137, in
bind_socks
sock.bind(sockaddr)
File “/usr/lib/python2.7/socket.py”, line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address Already in use
Closing

I’m not sure if this is an issue with the setup on the pi or my network here. I try going to the 192.168.1.18 address that the pi is on and it pulls up a default Raspian for Robots page with information about using VNC to connect to the pi. Any information you can provide about why this may be happening will be appreciated.

Version V 6.6
Updated on 2015.11.04


#2

I was able to get around the address in use issue by changing http_server.listen( 80 ) to http_server.listen( 88 ).
Now when I go to 192.168.1.18:88 it loads the joystick and a broken image for the camera.
When moving the joystick on the site the motors never move on the GoPiGo as well as the red camera light doesn’t turn on.
I had to copy the files to edit them and placed it on the desktop.
I changed the robot_web_server path to reflect the change as home/pi/Desktop/Browser_Streaming_Robot
Able to run the motor without issue using other examples
When running the new robot_web_server.py I get:

pi@raspberry ~/Desktop/Browser_Streaming_Robot $ sudo ./robot_web_server.py
sockjs.tornado will use json module
/home/pi/Desktop/Browser/Streaming/Robot/www
Starting web server…
304 GET / (192.168.1.10) 3.58ms - After pulling up the page on another computer
304 GET /css/style.css (192.168.1.10) 42.66ms
304 GET /css/modal.css (192.168.1.10) 4.49ms
304 GET /js/jquery.js (192.168.1.10) 23.41ms
304 GET /js/jquery.joystick.js (192.168.1.10) 5.32ms
304 GET /js/sockjs-0.3.min.js (192.168.1.10) 7.38ms
304 GET /images/ajax-loader.gif (192.168.1.10) 10.03ms

Any help would be appreciated


#3

Shameless bump


#4

Fixed the issue by reformating the SD card and using a standard Raspbian image instead of the one provided online.
Followed the steps at http://blog.initialstate.com/pi-browser-robot-camera-car/ and after changing the file path to the www folder it worked like a charm.


#5

Sorry, we’re running behind on forum replies at the moment. Glad you got this fixed.


#6

Hi,

I am running into the same issue and not sure what the correct approach is here (above solution was to use the standard raspbian image. Is that the recommended solution? So the browser streaming example isn’t supported on Dexter’s own image?)

The link I am following: http://www.dexterindustries.com/GoPiGo/projects/python-examples-for-the-raspberry-pi/raspberry-pi-browser-streaming-robot/

As others on the forum have seen: The port needs to be changed from the default 80, as there’s already something running on it (i.e. dex.local / vnc + terminal links)

After that I get the same broken camera image/joystick (can’t see the camera output, nor can I control the motors. Other python examples and the test applications work)

This is with the latest GoPiGo2 kit (with latest dexter image on it, updated/upgraded from the UI)


#7

Hi,

I have the same issue and I can’t figure out what’s the problem, as soon as I chned the port number in the python file…

Did someone manage to fix it with the Dexter raspbian image?

Thank you very much!

Jeremy


#8

Hi Jeremy and keeron,
Thanks a lot for letting us know about the problem with the browser streaming bot. We’ll update it ASAP in out repositories and the image.

-Karan


#9

Hi,

Thank you for your help, Karan.
Just for your information, here is my current configuration:

Then, I followed the instructions related to the Browser Streaming Robot (http://www.dexterindustries.com/GoPiGo/projects/python-examples-for-the-raspberry-pi/raspberry-pi-browser-streaming-robot/) and when I launch robot_wev_server.py, I receive the following:

sockjs.tornado will use json module
/home/pi/Desktop/goPiGo/Software/Python/Examples/Browser_Streaming_Robot/www
Starting web server…
Traceback (most recent call last):
File “./robot_web__server.py”, line 241, in &lt;module&gt;
http_server.listen( 80 )
File “/usr/local/lib/python2.7/dist-packages/tornado/tcpserver.py”, line 125,
in listen
sockets = bind_sockets(port, address=address)
File “/usr/local/lib/python2.7/dist-packages/tornado/netutil.py”, line 137, in
bind_socks
sock.bind(sockaddr)
File “/usr/lib/python2.7/socket.py”, line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address Already in use
Closing

Thank you very much!

Jeremy


#10

Hey,
We have updated the browser streaming example, so that it works on Port 98, check the updated example here: https://github.com/DexterInd/GoPiGo/tree/master/Software/Python/Examples/Browser_Streaming_Robot. Please update your local gopigo repository and try it out.

Do let us know how it goes.

-Karan


#11

Hi,

Thanks you very much Karan for your help! It works now :slight_smile:

I just have some few other questions because I still have some issues:

  • Is it possible to change the orientation of the camera in the python program? Indeed, my wire is too small the change the orientation physically…
  • Each time I move the GoPiGo through the web streaming page, the camera has some interference. Actually, each time the motors run, the camera has interference. Is it normal? Is it a problem related to my camera? My power? Something else?
  • I see just one “joystick” on the web page. As I mounted a servo motor for the camera, is it possible to have another joystick to control it?
    I’m asking that because I saw on your example videos that the web browser had 2 joysticks. Do I have to "activate " this support before?

Thank you again very much for your help and congrats for all the great job!

Jeremy


#12
– Is it possible to change the orientation of the camera in the python program? Indeed, my wire is too small the change the orientation physically…
You'll have to mount the camera either on the top acrylic plate or if even that is still short then go for a longer ribbion cable like the one here: https://www.adafruit.com/products/1648
– Each time I move the GoPiGo through the web streaming page, the camera has some interference. Actually, each time the motors run, the camera has interference. Is it normal? Is it a problem related to my camera? My power? Something else?
We haven't seen this problem before but it really looks like a power problem. Either your batteries are drained or they are not able to supply peak current. It might be better to try charging them or try using a fresh pair of batteries.
– I see just one “joystick” on the web page. As I mounted a servo motor for the camera, is it possible to have another joystick to control it? I’m asking that because I saw on your example videos that the web browser had 2 joysticks. Do I have to “activate ” this support before?
We had disabled the second joystick. You can enable it by changing the code here: https://github.com/DexterInd/GoPiGo/blob/master/Software/Python/Examples/Browser_Streaming_Robot/www/index.html#L207-L211 and updating the functionality here: https://github.com/DexterInd/GoPiGo/blob/master/Software/Python/Examples/Browser_Streaming_Robot/robot_controller.py#L138-L146.

-karan


#13

Thank you again Karan!

I changed the batteries with 8 new ones (well known brand) and I still have some interferences (less but still some). Do you see any reasons why?

Also, regarding the second joystick, I did the following:

Thank you!

Have a nice New Year’s Eve!

Jeremy


#14

Hey jeremy,
Can you try powering the Rasoberry Pi with the microUSB power supply and the GoPiGo with the batteries. When bit the supplies are powered on, do you still see the interference on the camera. Would it be possible for you to take a video of the interference and upload it so that we can look into it.

Can you leave the https://github.com/DexterInd/GoPiGo/blob/master/Software/Python/Examples/Browser_Streaming_Robot/robot_controller.py#L144-L146 commented and print the joystickX, joystickY values to see if you are able to read the changes in the joystick values.

-Karan


#15

Hi Karan,

1/ Regarding the issue with the camera (interferences), I finally tried another camera (NoIR). There were still some interefences but less. I decided to put the original camera back on and there are no more interferences now! I don’t know why… I suspect that the camera cable was touching the motors, electric wires or something else…

2/ Regarding the other joystick, I simply added the following on the function “setNeckJoystickPos”:

        if joystickX &gt; .5:
                        print &quot;Servo Left&quot;
                        gopigo.servo(0)
        elif joystickX &lt;-.5:
                        print &quot;Servo Right&quot;
                        gopigo.servo(180)
        else:
                        print &quot;Servo Home&quot;
                        gopigo.servo(90)

3/ While I am at it, I changed the following in order to “inverse” the camera.
It can be useful if you absolutely have to attach the camera in certain way (upside down for example).

On index.html file, find the block:

        #camera {
            display: block;
            margin-left: auto;
            margin-right: auto;
            width: 640px;
        }

And add the following, before the “}”:

            -webkit-transform:rotate(180deg);
            -moz-transform: rotate(180deg);
            -o-transform:rotate(180deg);

I noticed that the commands had to be changed also in the robot_controller.py file.
So, find the following:

    def setNeckJoystickPos( self, joystickX, joystickY ):
        #print &quot;g&quot;
        joystickX, joystickY = self.normaliseJoystickData( joystickX, joystickY )
        if debug:
                        print &quot;Right joy&quot;,joystickX, joystickY
                        #print self.speed_r*joystickY
        #gopigo.set_right_speed(int(self.speed_r*joystickY))
        #gopigo.fwd()
        #self.lastMotionCommandTime = time.time()

And add this at the end:

        if joystickX &gt; .5:
                        print &quot;Servo Left&quot;
                        gopigo.servo(0)
        elif joystickX &lt;-.5:
                        print &quot;Servo Right&quot;
                        gopigo.servo(180)
        else:
                        print &quot;Servo Home&quot;
                        gopigo.servo(90)

Thank you! Have fun!


#16

Great to here that it’s working for you. It would be great if you could share some pictures and/or a video of your project. We’ll be more than happy to share it with the community.

-Karan


#17

Hi There,

Ok, I’m not sure if anyone else has this issue.

I followed all the instructions and after all that everything works fine when I tried to control the GoPiGo from a desktop and an iPhone.

However, I encountered the error “This web page is not available” when I tried to access the GoPiGo from a Samsung Note 5.

Hope someone can help.

Cheers


#18

Hey diablo,
What was the IP address that you used when trying to connect to the robot from the Samsunf phone and from the iPhone.

-Karan


#19

Hi Karan,

I used http://dex.local:98 for all my attempts. Worked on desktop and iphone, but encountered the error on the Samsung.


#20

Hi @diablo,

dex.local doesn’t work on the Android mobile browsers. Instead you can connect to your Pi, by typing the IP address of the Pi on your mobile browser.

To know the IP address of your Pi, you should have the Pi connected to your wifi network.
Then login to your Pi using dex.local in your Desktop browser and run the command hostname -I on the terminal to find the IP address.

You can also use see our tutorial on using Fing, for finding network device IP’s here.

Please let us know if this helps,
-Shoban


Brick Pi Web Video Streaming