Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fish eye camera plugin for ROS #758

Closed
sychaichangkun opened this issue Jul 1, 2018 · 7 comments
Closed

Fish eye camera plugin for ROS #758

sychaichangkun opened this issue Jul 1, 2018 · 7 comments

Comments

@sychaichangkun
Copy link

Hi, I want to simulate fish eye camera in Gazebo and publish image via ROS.
I find a tutorial to create fish eye cam in Gazebo , but there seems no ROS plugin.

How can I write a plugin which converts Gazebo messages to ROS?
I need your help. Thanks.

@kev-the-dev
Copy link
Collaborator

Have you tried adding the gazebo_ros_camera plugin to your sdf like in this tutorial?

@sychaichangkun
Copy link
Author

Yes, I tried but gazebo_ros_camera doesn't support fish eye, when I changed the FOV to more than 180 degrees, it failed.

@kev-the-dev
Copy link
Collaborator

kev-the-dev commented Jul 5, 2018

What do you mean by "it failed"? Just ran gazebo with this sensor config like in the tutorial and it worked as expected:

<sensor name="camera" type="wideanglecamera">
  <camera>
    <horizontal_fov>6.283</horizontal_fov>
    <image>
      <width>320</width>
      <height>240</height>
    </image>
    <clip>
      <near>0.1</near>
      <far>100</far>
    </clip>
    <!-- A new section named `lens`. -->
    <lens>
      <!-- type element is mandatory -->
      <type>custom</type>
      <!-- manually defined mapping function r = c1*f*fun(theta/c2 + c3) -->
      <!-- More information here: https://en.wikipedia.org/wiki/Fisheye_lens#Mapping_function -->
      <custom_function>
        <c1>1.05</c1>
        <!-- linear scaling -->
        <c2>4</c2>
        <!-- angle scaling -->
        <f>1.0</f>
        <!-- one more scaling parameter -->
        <fun>tan</fun>
        <!-- one of sin,tan,id -->
      </custom_function>
      <!-- if it is set to `true` your horizontal FOV will ramain as defined -->
      <!-- othervise it depends on lens type and custom function, if there is one -->
      <scale_to_hfov>true</scale_to_hfov>
      <!-- clip everything that is outside of this angle -->
      <cutoff_angle>3.1415</cutoff_angle>
      <!-- resolution of the cubemap texture, the highter it is - the sharper is your image -->
      <env_texture_size>512</env_texture_size>
    </lens>
    <always_on>1</always_on>
    <update_rate>30</update_rate>
  </camera>
  <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
    <cameraName>camera1</cameraName>
    <imageTopicName>image_raw</imageTopicName>
    <cameraInfoTopicName>camera_info</cameraInfoTopicName>
    <frameName>camera_link</frameName>
    <hackBaseline>0.07</hackBaseline>
  </plugin>
</sensor>

widefov

@sychaichangkun
Copy link
Author

Oh, I made a mistake combing libgazebo_ros_camera.so and sensor model.
Thank you very much ! @ironmig

@kev-the-dev
Copy link
Collaborator

Glad you got it working!

@carolina68
Copy link

Hi! I am now also working on the simulation of fish-eye cameras in Gazebo. After follwing the tutorial mentioned by you(no modification by myself), there alwys exists an error in simulation when I increse the FOV to lager than 180 degrees:
gzserver: /build/ogre-1.9-mqY1wq/ogre-1.9-1.9.0+dfsg1/OgreMain/include/OgreAxisAlignedBox.h:252: void Ogre::AxisAlignedBox::setExtents(const Ogre::Vector3&, const Ogre::Vector3&): Assertion `(min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"' failed.

Do you have any idea what the problem may be?
Thanks in advance.

@chapulina
Copy link
Contributor

@carolina68 , that could be related to this open issue: https://bitbucket.org/osrf/gazebo/issues/2558/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants