Ask Your Question

how to use rosbridge, gscam to load video

asked 2012-04-07 20:33:52 -0500

tairen gravatar image

updated 2012-04-08 10:27:33 -0500

Hi, all,

I want to use rosbridge, gscam to load the video from the Webcam through socket

on the browser, but no matter how I use the example from the brown-ros-pkg, I can't make it run. To make my question more clear, I put similar code from brown-ros-pkg first, and I will show what I have tried after the code:

The code is

          String ip = "ws://Control:9090";

          //Variable to save rgb image
          PImage img;

           int     scrWidth;
           int     scrHeight;
           int     i;
           boolean lock2;
           boolean isRunning;

           void setup()
            img = createImage(640, 480, RGB);
            scrWidth = img.width;
            scrHeight = img.height;

            size(scrWidth, scrHeight);

            println("Hello after connect!\n");
            isRunning = false;

            lock2 = false;

            void draw()

             {image(img, 0, 0, scrWidth, scrHeight);
               println(" draw inside ");}

             void run()
               //Subscribe GStreamer pipeline
                 println("Hello run!");

                 isRunning = true;


               void stop()
                   println("Hello stop!");
                   isRunning = false;

               void getCamStream(msg)


                lock2 = true;
                //msg.uri is a rgb data of streaming message
                img = loadImage(msg.uri);  
                 println("Hello getcamstream!\n");
                 lock2 = false;

To test this code, I use the brown-ros-pkg recommends website: ROSProcessingjs Test suite.

Before I test, I already got the newest rosbridge package, the driver for the GSCam (I can see the image from the camera by running the node:

             $ rosrun image_view image_view image:=/gscam/image_raw)

My lab does not have irobot, I want do test whether the image could transit to browser or not, so I run roscore, rosbridge and gscam.

However, I could not load image to the default area, even the program could be initialized and subscribe the topic, and page ROSProcessingjs Test suite is always killed by itself, I also tried many ways:

(1) I doubt about the "frameRate() and loop()", because in processing.js official site, it tells me that loop() enables the draw() to work, but without any other functions, so even I delete the frameRate() or loop(), I only get lots of print "Hello getcamstream".

(2) I copy the subscribe() to draw(), it doesn't work

(3) by using rxgraph, I can see the "/gscam/image_raw" links "/rosbridge" well, but links "/image_view" with big red circle.

Can anyone give me little hint about where I was wrong? 
Thanks a lot!
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-04-14 07:56:59 -0500

jihoonl gravatar image


You were not doing anything wrong but it was because the code is just out dated.

Instead of using rosbridge to stream a image topic through video, I would recommend to use mjpeg_server to stream a image topic to the web. It provides more promising way to transport image to web.

Check out

If you like to use Procesingjs capability on top of video stream, You can use MJPEG camera example, which requires both mjpeg_server and rosbridge.

Regards, Jihoon

edit flag offensive delete link more


Thanks a lot, Jihoon. I already figure out just like you said.

tairen gravatar image tairen  ( 2012-04-14 08:24:19 -0500 )edit

answered 2012-04-14 08:32:21 -0500

tairen gravatar image

The whole method used by me is the combination: Mjpeg + rosbridge + javascript + html5. And I also recommend the article written by Scott Bell: ARTICLE and the brown-ros-package.Hope these will help who have same problem with me before

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-04-07 20:33:52 -0500

Seen: 1,647 times

Last updated: Apr 14 '12