Ask Your Question
0

Adding a camera to a model in Gazebo? (Beginner)

asked 2015-06-06 00:22:07 -0600

utagai gravatar image

Hello! I am very new to using things like Gazebo and ROS. I was wondering about how one might take a model from Gazebo (like turtlebot or quadrotor) and attach a camera to it, and see the feed?

My guess is that I have to go into the code of the model files and add camera code? But I am unfamiliar with the code or how it works. And how would I get the feed? Is there a simpler way to do this?

Can someone please guide me through this process? I have Gazebo5, and I am running Ubuntu.

Thank you!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-06-06 07:55:35 -0600

gvdhoorn gravatar image

This is more a Gazebo question than a ROS question (so I should refer you to the gazebosim.org site), but what you ask is described in one of the Gazebo tutorials, namely the Connect to ROS one.

If you've never done any of this (urdf, sdf, ROS, Gazebo, etc), I really recommend doing the ROS or (actually: and) Gazebo tutorials first (or find a book about it), and only then move on to more advanced things. Everything will seem really convoluted and incomprehensible otherwise (at least, that is what many students/people tell me is their experience).

edit flag offensive delete link more

Comments

Okay never mind, I figured it out. This wasn't nearly as complicated as I thought haha, the .sdf files have a very intuitive format, and I think as a programmer it wasn't too hard to work it out.

I will try giving myself a crash course using the tutorials you have provided. Thank you!

utagai gravatar imageutagai ( 2015-06-06 13:49:24 -0600 )edit
0

answered 2018-07-31 16:30:26 -0600

zubair gravatar image

I recommend to go through this : http://gazebosim.org/tutorials?tut=ro... My solution is to just add the following in your iris.sdf :

<link name='cam_link'>
  <pose frame=''>-0.118317 0.002195 0.004205 -0 -0 -3.12703</pose>
  <inertial>
    <mass>0.1</mass>
    <inertia>
      <ixx>1</ixx>
      <ixy>0</ixy>
      <ixz>0</ixz>
      <iyy>1</iyy>
      <iyz>0</iyz>
      <izz>1</izz>
    </inertia>
    <pose frame=''>0 0 0 0 -0 0</pose>
  </inertial>
  <self_collide>0</self_collide>
  <kinematic>0</kinematic>
  <sensor name='camera1' type='camera'>
    <camera name="head">
      <horizontal_fov>1.3962634</horizontal_fov>
      <image>
        <width>800</width>
        <height>800</height>
        <format>R8G8B8</format>
      </image>
      <clip>
        <near>0.02</near>
        <far>300</far>
      </clip>
    </camera>
    <always_on>1</always_on>
    <update_rate>30</update_rate>
    <visualize>1</visualize>
    <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
    <alwaysOn>true</alwaysOn>
    <updateRate>0.0</updateRate>
    <cameraName>iris/camera</cameraName>
    <imageTopicName>image_raw</imageTopicName>
    <cameraInfoTopicName>camera_info</cameraInfoTopicName>
    <frameName>camera_link</frameName>
    <hackBaseline>0.07</hackBaseline>
    <distortionK1>0.0</distortionK1>
    <distortionK2>0.0</distortionK2>
    <distortionK3>0.0</distortionK3>
    <distortionT1>0.0</distortionT1>
    <distortionT2>0.0</distortionT2>
  </plugin>
  </sensor>
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

1 follower

Stats

Asked: 2015-06-06 00:22:07 -0600

Seen: 6,951 times

Last updated: Jul 31 '18