Ask Your Question

Running 2 different cameras using usb_cam & Roslaunch

asked 2020-02-27 06:00:53 -0500

AndreaCec gravatar image


I'm using the usb_cam package and launched 2 cameras at the same time.

That is working.

In the meantime I had cloned

Built the package with:

cd ~/catkin_ws catkin build visual_crop_row_navigation source ~/catkin_ws/devel/setup.bash

And then roslaunch:

roslaunch visual_crop_row_navigation visualservoing.launch

But always with the following error below.

auto-starting new master process[master]: started with pid [23153] ROS_MASTER_URI=http://localhost:11311

setting /run_id to 96f0a6e4-594d-11ea-b3e7-c0847d44103c process[rosout-1]: started with pid [23164] started core service [/rosout] process[agribot_vs-2]: started with pid [23171] Run parameters loading ... 320 240 **initialize_neigbourhood** 320 240 **initialize_neigbourhood**

Do I need to change/set up something in the usb_cam parameters or on the program parameters


edit retag flag offensive close merge delete


Hi @AndreaCec,

Can you be more specific about the problem you are facing? Because it is not very clear what is your problem.

The output you mentioned comes from this function and for me it is just fine.

On the other hand, of course you need to change your parameters since I assume the config file provided in that project was implemented taking into account a certain type of camera. And your sensor and set up can be different.

Weasfas gravatar image Weasfas  ( 2020-02-27 07:14:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-02-27 07:30:33 -0500

AndreaCec gravatar image

Hello Weasfas,

after running roslaunch I should see 2 windows to set HSV values and tune the mask.

But I had never got such windows. Stuck at the ERROR point that you saw in the previous message.

But most probably as you said I should change parameters right? Camera parameters aligned with program ones?

edit flag offensive delete link more


The configuration of camera parameters is useful but not compulsory, furthermore it seems that is not the critical problem here. The real problem is that you have no proper output when, independently of the parameters used, you should be able to receive and see the cameras frames. Take a look at the rqt_graph to be sure you have properly set up the communication between all your nodes, cause it seems the image given by the camera are not being processed in the image callbacks implemented in the code.

Weasfas gravatar image Weasfas  ( 2020-02-27 08:54:25 -0500 )edit


I got rqt graph here below

What do you think? Something wrong or needs to be improved?


AndreaCec gravatar image AndreaCec  ( 2020-02-27 09:47:46 -0500 )edit

Well, there you have the tow raw images but the agribot node is supposed to read the images and looking at that graph I can see that the node has no input.

Weasfas gravatar image Weasfas  ( 2020-02-27 11:39:05 -0500 )edit

Hello but is something related to the developer or related to myself (user)?

How can be solved?


AndreaCec gravatar image AndreaCec  ( 2020-02-27 11:52:33 -0500 )edit

Well, from this point it is a problem of communication. With this line of code the developers are subscribing to the images, you need to redirect your output images to the specific topics they are using.

Weasfas gravatar image Weasfas  ( 2020-02-28 06:36:35 -0500 )edit

Fine so that means to modify launch file of usb_cam from:

<remap from="image" to="/camera1/usb_cam1/image_raw"/>


<remap from="image" to="/camera1/usb_cam1/front/rgb/image_raw"/>

Or do I need to write a new command in the launch file of usb_cam like:

<remap from="image" to="/camera1/usb_cam1/image_raw"/> <remap from="/camera1/usb_cam1/image_raw" to="/front/rgb/image_raw"/> <remap from="/front/rgb/image_raw" to="/agribot/front_camera/rgb/image_raw"/> -->

And copy paste for the back camera...


AndreaCec gravatar image AndreaCec  ( 2020-02-28 07:23:08 -0500 )edit

Yes, you need to do a remap to process the incoming image msgs. With:

<remap from="image" to="/camera1/usb_cam1/image_raw"/>
<remap from="image" to="/camera2/usb_cam1/image_raw"/>

You should be able to fix that comunication.

Weasfas gravatar image Weasfas  ( 2020-02-28 08:40:51 -0500 )edit

Below commands are already present in the usb_cam launch file:

<remap from="image" to="/camera1/usb_cam1/image_raw"/> <remap from="image" to="/camera2/usb_cam1/image_raw"/>

Did you mean to be inserted in the agribot_vs launch file?


Sorry to bother but I am pretty new in ROS. Thanks for your understanding.

AndreaCec gravatar image AndreaCec  ( 2020-02-28 11:42:55 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2020-02-27 06:00:53 -0500

Seen: 107 times

Last updated: Feb 27 '20