<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
</head><body style="">
<div>
 
</div>
<div>
<br/>On December 17, 2012 at 8:25 PM Stefan Haase <stefan.haase@dfki.de> wrote:
</div>
<div style="position: relative;">
<blockquote style="margin-left: 0px; padding-left: 10px; border-left: solid 1px blue;" type="cite">
<div>
Hi Jakob.
</div>
<div>
 
</div>
<div>
I did like you told or at least as I think you told (see below) and it seems to work (no Pointcloud in my visualization-module anymore), but on the second look I realize that it didn't do anything (see a little bit more below).
</div>
<div>
Btw.: event.a.get() is an EnvironmentItem and Pointcloud is an EnvironmentItem.. so dont we actually perform an downcast here? 
</div>
</blockquote>
</div>
<p>Yes... did I say upcast? my bad.</p>
<div style="position: relative;">
<blockquote style="margin-left: 0px; padding-left: 10px; border-left: solid 1px blue;" type="cite">
<div>
 
</div>
<div>
The filter:
</div>
<div>
    /**
</div>
<div>
     * Event filter to exclude the pointcloud from serialization.
</div>
<div>
     */
</div>
<div>
    class EventFilterExcludePointcloud : public envire::EventFilter {
</div>
<div>
     public:
</div>
<div>
        bool filter(envire::Event const& event) {
</div>
<div>
            try {
</div>
<div>
                envire::Pointcloud* pointcloud = dynamic_cast<envire::Pointcloud*>(event.a.get());
</div>
<div>
                if(pointcloud != NULL) {
</div>
<div>
                    LOG_INFO("Removes event %s", event.id_a.c_str());
</div>
<div>
                    return false;
</div>
<div>
                }
</div>
<div>
            } catch (std::exception& e) {
</div>
<div>
                LOG_ERROR("Exception using EventFilterExcludePointcloud: %s", e.what());
</div>
<div>
                return false;
</div>
<div>
            }
</div>
<div>
            return true;
</div>
<div>
        }
</div>
<div>
    };
</div>
</blockquote>
</div>
<p>Don't think you need to catch here. dynamic_cast of pointers doesn't throw afak. Looks good otherwise.</p>
<div style="position: relative;">
<blockquote style="margin-left: 0px; padding-left: 10px; border-left: solid 1px blue;" type="cite">
<div>
 
</div>
<div>
Add it to the emitter:
</div>
<div>
<div>
    mEmitter = new envire::OrocosEmitter(_envire_environment_out);
</div>
<div>
    mEmitter->setFilter(&mFilterPointcloud);
</div>
<div>
    mEmitter->useContextUpdates(&mEnv);
</div>
<div>
    mEmitter->useEventQueue( true );
</div>
<div>
    mEmitter->attach(&mEnv);
</div>
</div>
<div>
 
</div>
</blockquote>
</div>
<p>seems reasonable.</p>
<div style="position: relative;">
<blockquote style="margin-left: 0px; padding-left: 10px; border-left: solid 1px blue;" type="cite">
<div>
 
</div>
<div>
Actually this removes the pointcloud (or at least I do not see it anymore):
</div>
<div>
 
</div>
<div>
<strong>With pointcloud:</strong>
</div>
<div>
 
</div>
<div>
update hook:
</div>
<div>
<div>
        envire::OrocosEmitter emitter(&mEnv, _envire_environment_out);
</div>
<div>
        emitter.setTime(base::Time::now());
</div>
<div>
        emitter.flush();  
</div>
</div>
<div>
 
</div>
</blockquote>
</div>
<p>This will flush the entire environment everytime the update hook is called. Not likely what you want.</p>
<div style="position: relative;">
<blockquote style="margin-left: 0px; padding-left: 10px; border-left: solid 1px blue;" type="cite">
<div>
 
</div>
<div>
<strong>Without pointcloud:</strong>
</div>
<div>
 
</div>
<div>
configureHook:
</div>
<div>
<div>
    mEmitter = new envire::OrocosEmitter(_envire_environment_out);
</div>
<div>
    mEmitter->useContextUpdates(&mEnv);
</div>
<div>
    mEmitter->attach(&mEnv);
</div>
</div>
<div>
 
</div>
<div>
updateHook:
</div>
<div>
<div>
    mEmitter->setTime(base::Time::now());
</div>
<div>
    mEmitter->flush(); 
</div>
</div>
<div>
 
</div>
<div>
Irritated greetings,
</div>
</blockquote>
</div>
<p>Irritation received... Is there a question here? If you leave out whatever you have in the "with pointcloud" paragraph, all seems to be good :)</p>
<p>Jakob</p>
<div>
 
</div>
</body></html>