registerKeyboardCallback problem

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

registerKeyboardCallback problem

lazeroth
I'm sure this is a simple thing to do but I can't get it right. How do I register a keyboard input from a pcl::visualisation::CloudViewer?

For instance, for a CloudViewer v I do 

v.registerKeyboardCallback(params);

and I can't get the params right... Anyone has an example piece of code with this? I can understand the code on my own, just need an example please

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: registerKeyboardCallback problem

aichim
Administrator
There is a tutorial on this in PCLVisualizer. Check the website.

Cheers,
Alex

On Nov 18, 2011, at 6:44 PM, André Pereira wrote:

> I'm sure this is a simple thing to do but I can't get it right. How do I register a keyboard input from a pcl::visualisation::CloudViewer?
>
> For instance, for a CloudViewer v I do
>
> v.registerKeyboardCallback(params);
>
> and I can't get the params right... Anyone has an example piece of code with this? I can understand the code on my own, just need an example please
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: registerKeyboardCallback problem

lazeroth
Can't get it working... What I have is this code:

pcl::visualization::CloudViewer *viewer;
...
viewer(new pcl::visualization::CloudViewer("coisas"));
...
viewer->registerKeyboardCallback(SViewer::keyEventOcurred, (void*) &viewer);

vs2010 highlights the -> saying "no instance of overloaded function "pcl..registerKeyboardCallback" matches argument list". In the api that's the argument list for the CloudViewer type...

key event oc. prototype:

void keyEventOcurred(const pcl::visualization::KeyboardEvent &evento, void* coiso);

Help please
Reply | Threaded
Open this post in threaded view
|

Re: registerKeyboardCallback problem

aichim
Administrator
Please check out what I am doing in:
pcl/trunk/apps/src/openni_mls_smoothing.cpp


On Nov 18, 2011, at 7:25 PM, lazeroth wrote:

> Can't get it working... What I have is this code:
>
> pcl::visualization::CloudViewer *viewer;
> ...
> viewer(new pcl::visualization::CloudViewer("coisas"));
> ...
> viewer->registerKeyboardCallback(SViewer::keyEventOcurred, (void*) &viewer);
>
> vs2010 highlights the -> saying "no instance of overloaded function
> "pcl..registerKeyboardCallback" matches argument list". In the api that's
> the argument list for the CloudViewer type...
>
> key event oc. prototype:
>
> void keyEventOcurred(const pcl::visualization::KeyboardEvent &evento, void*
> coiso);
>
> Help please
>
> --
> View this message in context: http://www.pcl-users.org/registerKeyboardCallback-problem-tp3519231p3519337.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: registerKeyboardCallback problem

lazeroth
Sorry, I'm new in this community, where can I check that source code?
Reply | Threaded
Open this post in threaded view
|

Re: registerKeyboardCallback problem

aichim
Administrator
Could you please take a few more minutes to check the website before asking questions on the mailing list? That is why the team spent so much time designing a _very self-explanatory_ website!

Anyway, your answer is here: http://svn.pointclouds.org/pcl/

Thanks!
Cheers,
Alex

On Nov 18, 2011, at 8:08 PM, lazeroth wrote:

Sorry, I'm new in this community, where can I check that source code?

--
View this message in context: http://www.pcl-users.org/registerKeyboardCallback-problem-tp3519231p3519429.html
Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: registerKeyboardCallback problem

Sneaky Polar Bear
In reply to this post by lazeroth
I know this is a dead thread, but for the sake of others who may encounter
this problem:
I believe that the problem was that your function "keyEventOcurred" was a
non-static, member function.  As explained here:
https://stackoverflow.com/questions/1000663/using-a-c-class-member-function-as-a-c-callback-function

Ironically, just a little more of your error message would have helped a lot
in solving your problem, as it would have stated that the argument type you
were trying to pass was of "SViewer::", which implies that it is grabbing
the "this" instead of the function pointer you wanted to pass.

I made that callback function static and all was well.  Cheers!



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: registerKeyboardCallback problem

Sneaky Polar Bear
This post was updated on .
Alternately, as was done in the source code posted above (and in pcl visualizer example), you can make the
keyboard callback function global (ie take it out of your class scope).



--
Sent from: http://www.pcl-users.org/
_______________________________________________
PCL-users@pointclouds.org / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users