0
$\begingroup$

Rosanswers logo

I have written a node, with the roscpp client, that subscribes to an image topic, and than publishes to another image topic. It takes a raw image from the webcam, and then thresholds it and publish it. I have made it through two different ways.

The first one i used global variables (kind of ugly), In the second way, i made a class, which is a cleaner way. Howerver, the publish rate in the second way is slow.

the first way i called limiter1, the second limiter2.

the limiter1 node, publishes the images at a really good average, using rostopic hz the average gives me the 30hz i would expect.

the limiter2 on the other hand, publishes at a maximum of 15hz. Is this right?, i am not an expert, so is it known that using classes will decrease the efficiency? and why so much?

I do not believe that the algorithms i am using are slow (using opencv), i used the same algorithms(algorithms for the processing of the image) in both cases. If i do not use the ros::Rate::sleep function on the limiter1 node, for example, the publish rate goes to 600hz and more.

thanks for any help, if someone wishes to see the codes, i will post the two ones.


Originally posted by Edno on ROS Answers with karma: 46 on 2014-02-05

Post score: 1


Original comments

Comment by Dirk Thomas on 2014-02-05:
For better feedback you might consider to share the code e.g. in a GitHub repo.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I've found out that the problem is not in the way i write the code. The problem is residing in the "grabber node". It is a node that grabs a frame from the web cam and then publishes it. It is publishing at a rate of 15hz. The same happens if i use gscam, it also publishes at 15hz. Could this be something wrong with the embedded webcam in my notebook? . Using guvcview i can se that its FPS is 30. the video flow does not seem to be low, could ros be calculating it wrong? i don't know what is happening here. Even it the flow seems right, and even if i can do what i would like with it, i don't want to lose these frames. Any idea?


Originally posted by Edno with karma: 46 on 2014-02-06

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.