Browser Streaming Example Issue[SOLVED]

Shameless bump

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.

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

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)

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

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

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 <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

Thank you very much!

Jeremy

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

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

– 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

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

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

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 > .5:
                        print "Servo Left"
                        gopigo.servo(0)
        elif joystickX <-.5:
                        print "Servo Right"
                        gopigo.servo(180)
        else:
                        print "Servo Home"
                        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 "g"
        joystickX, joystickY = self.normaliseJoystickData( joystickX, joystickY )
        if debug:
                        print "Right joy",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 > .5:
                        print "Servo Left"
                        gopigo.servo(0)
        elif joystickX <-.5:
                        print "Servo Right"
                        gopigo.servo(180)
        else:
                        print "Servo Home"
                        gopigo.servo(90)

Thank you! Have fun!

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

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

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

Hi Karan,

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

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

1 Like

Hi Shoban,

Thanks for the reply. Yes, by using the IP address I could finally access the GoPiGo using the android device.

Cheers

This topic was automatically closed after 24 hours. New replies are no longer allowed.