ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Camera for Gazebo Model?

asked 2014-09-03 16:11:50 -0500

K. Zeng gravatar image

updated 2014-09-04 15:05:54 -0500

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-09-04 14:53:57 -0500

joq gravatar image

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.

edit flag offensive delete link more

Comments

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.

K. Zeng gravatar image K. Zeng  ( 2014-09-04 15:05:39 -0500 )edit

In that case, you probably want to run stereo_view, instead.

joq gravatar image joq  ( 2014-09-04 22:02:20 -0500 )edit

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.

K. Zeng gravatar image K. Zeng  ( 2014-09-05 13:42:46 -0500 )edit

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.

K. Zeng gravatar image K. Zeng  ( 2014-09-05 14:17:07 -0500 )edit

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.

K. Zeng gravatar image K. Zeng  ( 2014-09-05 14:18:05 -0500 )edit

rostopic list will show them all.

joq gravatar image joq  ( 2014-09-06 11:17:16 -0500 )edit

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

K. Zeng gravatar image K. Zeng  ( 2014-09-11 16:10:10 -0500 )edit

In that case, there is something wrong with the way you are launching gazebo or its camera plugin.

joq gravatar image joq  ( 2014-09-12 05:45:31 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-09-03 16:11:50 -0500

Seen: 1,640 times

Last updated: Sep 04 '14