#1866 Merged at c1451de
  1. Mykola
  • Add new WideAngleCameraSensor
  • WideAngleCamera contains Lens description that allows flexible control over the projection
  • New transport message type to control camera lens, and read it's state

Camera renders the world 6 times in different directions, to cube map texture. Then Ogre::Compositor is used to map the world to camera sensor according to the lens properties

It depends on Pull request to sdformat #215

Comments (53)

  1. Ian Chen

    We like to keep the coding style consistent in gazebo. There is a coding style checker script that you can run from gazebo root directory:

    sh tools/code_check.sh

    can you run this and fix the style errors

        1. Mykola author

          It also complains about:

          ./gazebo/rendering/CameraLensPrivate.hh:94:  Using deprecated casting style.  Use static_cast<float>(...) instead  [readability/casting] [4]
          ./gazebo/rendering/CameraLensPrivate.hh:96:  Using deprecated casting style.  Use static_cast<float>(...) instead  [readability/casting] [4]
          ./gazebo/rendering/CameraLensPrivate.hh:98:  Using deprecated casting style.  Use static_cast<float>(...) instead  [readability/casting] [4]
          ./gazebo/rendering/CameraLensPrivate.hh:100:  More than one command on the same line  [whitespace/newline] [4]
          [klokik@fluttershy tools]$ cppcheck --version
          Cppcheck 1.69
              1. Ian Chen

                yes they are false positives but we would like to either avoid or suppress them as much as possible

                The following patch should get rid of the warnings

                diff -r b73928df66b1 gazebo/rendering/CameraLensPrivate.hh
                --- a/gazebo/rendering/CameraLensPrivate.hh Wed Sep 09 21:02:27 2015 +0300
                +++ b/gazebo/rendering/CameraLensPrivate.hh Thu Sep 10 18:36:59 2015 -0700
                @@ -106,18 +106,18 @@
                                 /// List of all available functions and it's representations
                                 private: const std::vector<
                                     std::tuple<std::string, ignition::math::Vector3d,
                -                        std::function<float(float)> > > variants = {
                +                        std::function<float (float)> > > variants = {
                -                              std::function<float(float)>(
                -                                  static_cast<float(*)(float)>(&std::sin))),
                +                              std::function<float (float)>(
                +                                  static_cast<float (*)(float)>(&std::sin))),
                -                              std::function<float(float)>(
                -                                  static_cast<float(*)(float)>(&std::tan))),
                +                              std::function<float (float)>(
                +                                  static_cast<float (*)(float)>(&std::tan))),
                -                              std::function<float(float)>(
                +                              std::function<float (float)>(
                                                   [](float t) -> float
                                                     return t;
  2. Ian Chen

    screenshot of wide angle camera that I get after following the tutorial


    It worked quite well. Any recommendations on ways to remove the artifacts at the edges of the cubemap?

  3. Mykola author

    It is the reason I enable GL_ARB_seamless_cube_map extention, which enables cross-face filtering. It works with open-source drivers on Intel, nouveau, and amd, but i have not tested with nvidia blob. The extention is supported almost on every desktop GPU that had driver updates since 2009, not only with OpenGL 3.1 support.

    PS. Intel and nouveau heve this enabled by default.

    1. Ian Chen

      ok I see. I am using nvidia driver 346 and left this this extension enabled in the code. I guess it didn't work with nvidia or probably just my machine. I'll test with my laptop later.

      We can leave a comment in the code to mention what you just said above.

    1. Louise Poubel

      Hum, this seems to break the no-gpu build. Should we add some ifdefs?

      [ 51%] Building CXX object gazebo/rendering/CMakeFiles/gazebo_rendering.dir/WideAngleCamera.cc.o
      /var/lib/jenkins/workspace/gazebo-any-devel-trusty-amd64-no-gpu/gazebo/gazebo/rendering/WideAngleCamera.cc:18:21: fatal error: GL/glew.h: No such file or directory
       #include <GL/glew.h>
      compilation terminated.
        1. Louise Poubel

          Do we need to group both headers together? I'm not sure why, but my pc has GL/gl.h but not GL/glew.h. The same seems to be the case for the Jenkins machine. Is glew needed at all? I think earlier versions of this branch didn't have it.

          1. Mykola author

            It seems glew.h comes in a separate package... And do you have GL/glext.h ? It also have needed definition, and we can use it instead.

  4. Louise Poubel


    gazebo/rendering/WideAngleCamera.cc:29:  Found C++ system header after other header. Should be: c system, c++ system, other, WideAngleCamera.h .  [build/include_order] [4]
    gazebo/rendering/WideAngleCamera.cc:30:  Found C++ system header after other header. Should be: c system, c++ system, other, WideAngleCamera.h .  [build/include_order] [4]
    gazebo/rendering/WideAngleCamera.cc:558:  Missing spaces around <  [whitespace/operators] [3]
    Total errors found: 3
  5. Louise Poubel

    The wideangle camera doesn't show a preview on the 3D world like the normal camera does. If this is too complicated to add to this pull request, I can open an issue for it to be dealt with later.

  6. Nate Koenig

    Style error:

    ./gazebo/rendering/WideAngleCamera.cc:248:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
  7. Nate Koenig

    This doesn't compile for me:

    /home/nkoenig/tmp/gazebo/gazebo/rendering/WideAngleCamera.cc: In constructor gazebo::rendering::WideAngleCamera::WideAngleCamera(const string&, gazebo::rendering::ScenePtr, bool, int):
    /home/nkoenig/tmp/gazebo/gazebo/rendering/WideAngleCamera.cc:406:36: error: no matching function for call to std::unique_ptr<gazebo::rendering::WideAngleCameraPrivate>::unique_ptr(gazebo::rendering::CameraLensPrivate*)
           dataPtr(new CameraLensPrivate)
  8. Steven Peters

    The sdformat pull request has been merged and released in sdformat 3.5.0; we should require that version of sdformat as the minimum:

    diff -r 53cb626b1825 cmake/SearchForStuff.cmake
    --- a/cmake/SearchForStuff.cmake    Tue Oct 06 12:32:06 2015 -0700
    +++ b/cmake/SearchForStuff.cmake    Wed Oct 07 10:25:33 2015 -0700
    @@ -476,7 +476,7 @@
     # Find SDFormat
    -set (SDFormat_MIN_VERSION 3.3.0)
    +set (SDFormat_MIN_VERSION 3.5.0)
     find_package(SDFormat ${SDFormat_MIN_VERSION})
     if (NOT SDFormat_FOUND)
      1. Louise Poubel

        I'm still seeing conflicts on the changelog and migration though.

        The last thing I was planning to check was whether the tutorial plugin works. I haven't been able to test it since I'm not being able to use the GUI overlay.

        1. Ian Chen

          alright resolved conflicts, try now.

          To try the plugin example, copy mainwindow.ui into the build directory and run gazebo ../example.world

          1. Louise Poubel

            I was having some problems with mouse events on my laptop, it wasn't possible to edit the values in the GUI overlay because the events would pas through to the 3D scene behind. But I just tried it on my desktop and it worked, so it might have been the laptop's fault.

    1. Steven Peters
      /Users/jenkins/workspace/gazebo-default-devel-homebrew-amd64-2/gazebo7/gazebo/rendering/WideAngleCamera.cc:19:10: fatal error: 'GL/gl.h' file not found
      #include <GL/gl.h>