0
$\begingroup$

Rosanswers logo

So I'm using ROS Indigo along with Gazebo 2.2.3 on Ubuntu Trusty. I was wondering if there are any example codes of controlling said camera and visualize its data (i.e. project what it's seeing in a new window or something like that). For the sake of completeness, the model in question has a SDF model but no URDF model. I'm also using a stereo camera.

UPDATE (Sep 4): Ok, so I discovered that Gazebo has an existing camera model in its model database. I was able to visualize camera data (i.e. show what it's seeing) using existing menu commands in Gazebo. Last, but not least, I was also able to attach the camera to my Gazebo model. The big question that I need help with is how to write code so I can call the camera to visualize using terminal commands instead of going into the Gazebo menu?


Originally posted by K. Zeng on ROS Answers with karma: 23 on 2014-09-03

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You should be able to view the camera images in ROS the same way you would a real camera. The usual ROS utility for that is image_view.

You can run a command like this:

rosrun image_view image_view image:=/camera/image_raw

Provide your correct topic name for the image parameter.


Originally posted by joq with karma: 25443 on 2014-09-04

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by K. Zeng on 2014-09-04:
In the Gazebo topic selector, the topic for the camera feed shows up as /gazebo/default/mesh_robot/stereocamera/head/camera/images. I tried to replace /camera/image_raw with that, and I only got a blank window. Also, I forgot to mention this in the original question, but I'm using a stereo camera.

Comment by joq on 2014-09-04:
In that case, you probably want to run stereo_view, instead.

Comment by K. Zeng on 2014-09-05:
That makes sense. The issue is that from what I can see, only one image topic (/gazebo/default/mesh_robot/stereocamera/head/camera/images) shows up in Gazebo's topic selector.

Comment by K. Zeng on 2014-09-05:
I just tried to run "rosrun image_view stereo_view stereo:=/gazebo/default/mesh_robot/stereocamera/head/camera image:=images", but I'm still getting a grey screen even though I increased queue size and set approximate sync to true.

Comment by K. Zeng on 2014-09-05:
I pulled an rqt_graph, and it shows that Gazebo and the stereo view node aren't publishing or subscribing topics at all. The thing is, I know the stereo camera works because I was able to visualize the camera's data using Gazebo controls. I think at this point, I'm going to ask a separate question.

Comment by joq on 2014-09-06:
rostopic list will show them all.

Comment by K. Zeng on 2014-09-11:
This is strange, I ran rostopic list for an environment with the camera-equipped robot. The topics are the following:

/clock
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state
/rosout
/rosout_agg

No images

Comment by joq on 2014-09-12:
In that case, there is something wrong with the way you are launching gazebo or its camera plugin.

Comment by K. Zeng on 2014-09-12:
The command I used was roslaunch gazebo_ros {world_name.launch}, where the .world file has a robot model with the default camera from Gazebo's model database. I didn't use any separate command to launch a camera plugin.

Comment by joq on 2014-09-12:
OK. Check the world file, then.

Comment by K. Zeng on 2014-09-12:
The code for the camera is actually part of a Gazebo .sdf model that is part of the .world file via the tag. Should I maybe ask a question like this on Gazebo answers instead?

Comment by K. Zeng on 2014-09-15:
Right now, I'm just trying to get the camera I have to publish the picture. Should I download camera_drivers to make it actually publish?

Comment by joq on 2014-09-17:
Gazebo questions are better asked on http://answers.gazebosim.org Trying it with your actual camera driver should also help sort out any ROS problems.

Comment by K. Zeng on 2014-09-22:
You were right. The reason the camera wasn't able to publish anything to ROS was because I didn't have any kind of plugin. I downloaded gazebo_ros_pkgs and used one of their plugins, and it can publish image topics just fine.

$\endgroup$

Your Answer

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