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

Add Ensenso support #888

Merged
merged 4 commits into from
Oct 16, 2014
Merged

Add Ensenso support #888

merged 4 commits into from
Oct 16, 2014

Conversation

VictorLamoine
Copy link
Contributor

If you want to test please read the tutorial first. For the last steps you will, of course, need an Ensenso device!

  • The Ensenso grabber has been written like the OpenNI grabber class
  • The code contains 2 examples, with/without the Ensenso grabber class
  • The code is documented
  • Support for Windows has not been tested
  • A tutorial has been written to explain how to use the Ensenso in PCL

pcl-developers topic

@VictorLamoine
Copy link
Contributor Author

Does PCL even use the .pc files it generates? I deleted all .pc files on my system and PCL projects still builds.

How does PCL projects builds when using a simple CMakeFile?

@jspricke
Copy link
Member

jspricke commented Oct 2, 2014

PCL provides PCLConfig.cmake as well as pkg-config (.pc) files. Your CMakeLists.txt only depends on the PCLConfig.cmake. If you want to use pkg-config, use it, or use it from within cmake, like this:

find_package(PkgConfig)
pkg_check_modules(pcl_cmmon-1.8)

@VictorLamoine
Copy link
Contributor Author

Thank you Jochen you spared a lot of my time 😄
This pull request is ready to be reviewed/merged!

I edited my first message to explain the modifications done.

@@ -247,6 +247,37 @@ macro(find_openni2)
endif(OPENNI2_FOUND)
endmacro(find_openni2)

#remove this as soon as the Ensenso SDK is shipped with FindEnsenso.cmake
macro(find_ensenso)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we need both this and cmake/Modules/FindEnsenso.cmake?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake/Modules/FindEnsenso.cmake is checked by cmake to determine whether the system has Ensenso SDK or not: CMakeLists.txt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that part I understand. But why this macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't have the macro in PCLConfig.cmake.in then the generated PCLConfig.cmake will not be able to check whether the system has the Ensenso SDK or not.

The Ensenso SDK does not install a cmake file (eg: in /usr/share/cmake-2.8/Modules/) in the system. Thus PCL cmake file has to embed its own way to find if the Ensenso SDK is there or not.

This is what I understood. Hope it's right.. 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks for the explanation. I am not very familiar with this beast :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PCLConfig.cmake is used by projects using the PCL to find the headers and libs. Adding Ensenso in there allows these projects to transparently use the Ensenso SDK.

@taketwo
Copy link
Member

taketwo commented Oct 8, 2014

That's all from my side. @jspricke please merge if you think the PR is in good shape.

Thanks for contributing, Victor!

@jspricke
Copy link
Member

jspricke commented Oct 8, 2014

Apart from my comments above, I'm fine with merging this. Thanks for the work Victor!

@VictorLamoine
Copy link
Contributor Author

No more pkg-config file. I've came up with a solution that seems perfect:

In PCLConfig.cmake.in the guess path are taken from the cmake variables ENSENSO_INCLUDE_DIR and ENSENSO_LIBRARY. So whatever was the user configuration in cmake the path are copied.

ENSENSO_INCLUDE_DIR and ENSENSO_LIBRARY are set by cmake at default values here, it can be changed by the user if he has moved the Ensenso SDK files.

@VictorLamoine
Copy link
Contributor Author

I tested how this behaves by moving my include directory and it seems to be working fine.

@taketwo
Copy link
Member

taketwo commented Oct 9, 2014

@jspricke As a CMake expert, could you have another look at config files and merge if they are okay? :)

@jspricke
Copy link
Member

@VictorLamoine looks like the CMake stuff is back to it's beginning. Did you remove the version without pkg-config intentionally?

@VictorLamoine
Copy link
Contributor Author

@jspricke I pushed the wrong branch, it is now back sorry.

Did you remove the version without pkg-config intentionally?

Yes we can get rid of it as long as the Ensenso SDK doesn't provide a pkg-config file.

option(WITH_ENSENSO "Build IDS-Imaging Ensenso's camera support" TRUE)
if(WITH_ENSENSO)
set(ENSENSO_API_DIR "/opt/ensenso/development/c/" CACHE PATH "directory of Ensenso API")
set(ENSENSO_LIB_DIR "/usr/lib/" CACHE PATH "directory of Ensenso library")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIR find_package will search in /usr/lib by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_library that is.

@jspricke
Copy link
Member

I'm still not sure we should merge the ensenso_grabber_example.cpp in it's current form, as it doubles the code from the pcl::EnsensoGrabber. I would propose to rewrite it and to host the original version somewhere else. @taketwo what do you think?

Also, I think we should be more strict about the namespace in future. So pcl::EnsensoGrabber should be pcl::io::EnsensoGrabber.

@taketwo
Copy link
Member

taketwo commented Oct 16, 2014

I'm still not sure we should merge the ensenso_grabber_example.cpp

I understand that Victor followed the footsteps of openni grabber developers, who also provided such an example. Though I do not see what's the purpose. The point of this contribution is to provide a grabber class that abstracts away the API specific to the device driver, so why would anyone in "PCL world" be interested in using nxLib.h directly? So +1 for removing the example.

Also, I think we should be more strict about the namespace in future.

So far none of the existing grabbers sit in pcl::io namespace, so I don't think it is reasonable to add this one to that namespace. However, in principle I agree, proper namespacing is a good thing to do.

What about dropping "simple" from pcl_ensenso_simple_viewer? There is no other "complex" viewer anyways. Also the viewers for openni/openni2 are called pcl_XXX_viewer.

@jspricke
Copy link
Member

  • Sergey Alexandrov [email protected] [2014-10-16 02:04]:

    I understand that Victor followed the footsteps of openni grabber developers, who also provided such an example. Though I do not see what's the purpose. The point of this contribution is to provide a grabber class that abstracts away the API specific to the device driver, so why would anyone in "PCL world" be interested in using nxLib.h directly? So +1 for removing the example.

find -name "*grabber_example*"
./io/tools/openni_grabber_example.cpp
./io/tools/hdl_grabber_example.cpp
./apps/src/dinast_grabber_example.cpp

..all using their internal grabber, btw ;).

So far none of the existing grabbers sit in pcl::io namespace, so I don't think it is reasonable to add this one to that namespace. However, in principle I agree, proper namespacing is a good thing to do.

I think we should start this now ;).

What about dropping "simple" from pcl_ensenso_simple_viewer? There is no other "complex" viewer anyways. Also the viewers for openni/openni2 are called pcl_XXX_viewer.

+1

@taketwo
Copy link
Member

taketwo commented Oct 16, 2014

I think we should start this now ;).

Perhaps a separate PR later that puts all of them into pcl::io?

@jspricke
Copy link
Member

  • Sergey Alexandrov [email protected] [2014-10-16 02:11]:

    Perhaps a separate PR later that puts all of them into pcl::io?

Can we make forward declarations to be backward compatible?

@taketwo
Copy link
Member

taketwo commented Oct 16, 2014

As far as I see, there is just a single forward-declaration for a grabber in the whole PCL codebase:

apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h
59:  class OpenNIGrabber;

Shouldn't something like the following work?

namespace pcl
{

  namespace io
  {

    class OpenNIGrabber
    {
      // ...
    };

  }

  using io::OpenNIGrabber;

}

@jspricke
Copy link
Member

  • Sergey Alexandrov [email protected] [2014-10-16 02:35]:

    Shouldn't something like the following work?

I guess so. Maybe we should move this discussion to pcl-dev@?

@VictorLamoine
Copy link
Contributor Author

I've done the modifications to the CMake files using Windows guess paths.

I understand that Victor followed the footsteps of openni grabber developers, who also provided such an example. Though I do not see what's the purpose. The point of this contribution is to provide a grabber class that abstracts away the API specific to the device driver, so why would anyone in "PCL world" be interested in using nxLib.h directly? So +1 for removing the example.

If the user wants to do something that has not been coded in the pcl::EnsensoGrabber he will HAVE to use the device specific API by using the root_ member of the grabber. This explain why root_ is public.

@taketwo
Copy link
Member

taketwo commented Oct 16, 2014

@VictorLamoine please update the tutorial text.

@VictorLamoine
Copy link
Contributor Author

All good on my side.

@jspricke
Copy link
Member

+1 from me, thanks a lot @VictorLamoine!

taketwo added a commit that referenced this pull request Oct 16, 2014
@taketwo taketwo merged commit 75d97aa into PointCloudLibrary:master Oct 16, 2014
@VictorLamoine VictorLamoine deleted the ensenso branch October 16, 2014 17:23
@taketwo
Copy link
Member

taketwo commented Oct 19, 2014

@VictorLamoine any idea about the issue brought up in this comment?

@VictorLamoine
Copy link
Contributor Author

Configuring a simple PCL program (pcd write example):

-- Could NOT find OpenNI2 (missing:  OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS) 
** WARNING ** io features related to openni2 will be disabled
-- Could NOT find ensenso (missing:  ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
** WARNING ** io features related to ensenso will be disabled

Everything is normal at this point (I removed Ensenso libraries/include dirs from my OS)

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ENSENSO_LIBRARY
    linked by target "pcd_write" in directory /home/victor/Copy/Autres/pcd_write/src

ccmake shows:

 ENSENSO_INCLUDE_DIR              ENSENSO_INCLUDE_DIR-NOTFOUND
 ENSENSO_LIBRARY                  ENSENSO_LIBRARY-NOTFOUND
[...]
 OPENNI2_INCLUDE_DIRS             OPENNI2_INCLUDE_DIRS-NOTFOUND
 OPENNI2_LIBRARY                  OPENNI2_LIBRARY-NOTFOUND

I don't know why OPENNI2_LIBRARY-NOTFOUND is ok and ENSENSO_LIBRARY-NOTFOUND is not.

@taketwo
Copy link
Member

taketwo commented Oct 19, 2014

@VictorLamoine
Copy link
Contributor Author

@simonschmeisser you might be interested in the fact that PCL trunk version supports the Ensenso cameras (thus, ROS); tutorial.

@simonschmeisser
Copy link

Thanks for the hint, I came across your tutorial some while ago already and definitely plan to compare it to my current halcon based approach. Nice job!

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

Successfully merging this pull request may close these issues.

4 participants