question regarding the re-use of KinBody objects

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

question regarding the re-use of KinBody objects

Paul E. Rybski
Hi,
        I'm working on a plugin which takes points returned from a simulated
laser, generates voxels, and then generates KinBodies for each of the
voxels and displays them (with Enable(false) being called).  I thought
it would be faster not to destroy and re-create the KinBodies every
time.  Instead, on initialization of the plugin, I first create a vector
of kinbody pointers that use the appropriate XML/WRL files but I don't
call AddKinBody on them.  Rather,  whenever I call SimulationStep(...),
I first call RemoveKinBody(kinbodyptr, false) on each kinbodyptr in the
vector.  Then I do my processing where I collect laser points and
compute voxels.  Finally, I set the new pose on all of the KinBodies
that I'll actually be using that time around, and then call
AddKinBody(kinbodyptr) and edit the SimulationStep(...) method.

The problem with this is that whenever I grab objects with the pointer
tool in OpenRave, the display kind of goes blank and doesn't show me
anything until I either let go of the mouse or if I just hold the mouse
button down without moving.  After I've released the object, the display
still takes some time before it is visible again.

Is there something really problematic about me dynamically re-arranging
the KinBody positions every time my plugin is invoked?  Is there
something inside of OpenRave that doesn't like to see a lot of KinBodies
moved around somehow?  Should I instead just instead do
RemoveKinBody(kinbodyptr, true) and recreate them completely?  Or,
should I just move the KinBodies off screen without calling
Add/RemoveKinBody?

Any advice would be greatly appreciated.

Thanks,

-Paul


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: question regarding the re-use of KinBody objects

Paul E. Rybski
Update:  I've modified my program so that I no longer add/remove the
kinbodies rather, I just teleport the ones I don't need for a given
display to a point very (VERY) far away from the origin of my scene.
This GREATLY improves the display performance over adding/removing the
bodies.  It's not pretty though and I really wonder if there's a better way.

I just had a thought... the kinbodies' pose in my previous
implementation was always within the FOV of the laser even when the
bodies were removed.  Might that be a cause of some of the slowness?
Might the laser still be trying to iterate through the list of Kinbodies
because their resources still existed?

-Paul

Paul E. Rybski wrote:

> Hi,
> I'm working on a plugin which takes points returned from a simulated
> laser, generates voxels, and then generates KinBodies for each of the
> voxels and displays them (with Enable(false) being called).  I thought
> it would be faster not to destroy and re-create the KinBodies every
> time.  Instead, on initialization of the plugin, I first create a vector
> of kinbody pointers that use the appropriate XML/WRL files but I don't
> call AddKinBody on them.  Rather,  whenever I call SimulationStep(...),
> I first call RemoveKinBody(kinbodyptr, false) on each kinbodyptr in the
> vector.  Then I do my processing where I collect laser points and
> compute voxels.  Finally, I set the new pose on all of the KinBodies
> that I'll actually be using that time around, and then call
> AddKinBody(kinbodyptr) and edit the SimulationStep(...) method.
>
> The problem with this is that whenever I grab objects with the pointer
> tool in OpenRave, the display kind of goes blank and doesn't show me
> anything until I either let go of the mouse or if I just hold the mouse
> button down without moving.  After I've released the object, the display
> still takes some time before it is visible again.
>
> Is there something really problematic about me dynamically re-arranging
> the KinBody positions every time my plugin is invoked?  Is there
> something inside of OpenRave that doesn't like to see a lot of KinBodies
> moved around somehow?  Should I instead just instead do
> RemoveKinBody(kinbodyptr, true) and recreate them completely?  Or,
> should I just move the KinBodies off screen without calling
> Add/RemoveKinBody?
>
> Any advice would be greatly appreciated.
>
> Thanks,
>
> -Paul
>

--
Paul E. Rybski, Ph.D., Systems Scientist
Robotics Institute, Carnegie Mellon University
Phone: 412-268-7417, Fax: 412-268-7350
Web: http://www.cs.cmu.edu/~prybski


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: question regarding the re-use of KinBody objects

Rosen Diankov-2
It is the fact that the 3D resources get destroyed and recreated. When
I gave the suggestion to use KinBody::Enable, I completely forgot that
fact. Each KinBody is also readded to the collision detector, which
could also contribute to slowness.

If you plot everything via one drawtrimesh call, at least it is only
one 3D resource that will get recreated, and it doesn't register at
all with the underlying environment objects. Was there a problem with
this method?

rosen,

2008/8/16 Paul E. Rybski <[hidden email]>:

> Update:  I've modified my program so that I no longer add/remove the
> kinbodies rather, I just teleport the ones I don't need for a given
> display to a point very (VERY) far away from the origin of my scene.
> This GREATLY improves the display performance over adding/removing the
> bodies.  It's not pretty though and I really wonder if there's a better way.
>
> I just had a thought... the kinbodies' pose in my previous
> implementation was always within the FOV of the laser even when the
> bodies were removed.  Might that be a cause of some of the slowness?
> Might the laser still be trying to iterate through the list of Kinbodies
> because their resources still existed?
>
> -Paul
>
> Paul E. Rybski wrote:
>> Hi,
>>       I'm working on a plugin which takes points returned from a simulated
>> laser, generates voxels, and then generates KinBodies for each of the
>> voxels and displays them (with Enable(false) being called).  I thought
>> it would be faster not to destroy and re-create the KinBodies every
>> time.  Instead, on initialization of the plugin, I first create a vector
>> of kinbody pointers that use the appropriate XML/WRL files but I don't
>> call AddKinBody on them.  Rather,  whenever I call SimulationStep(...),
>> I first call RemoveKinBody(kinbodyptr, false) on each kinbodyptr in the
>> vector.  Then I do my processing where I collect laser points and
>> compute voxels.  Finally, I set the new pose on all of the KinBodies
>> that I'll actually be using that time around, and then call
>> AddKinBody(kinbodyptr) and edit the SimulationStep(...) method.
>>
>> The problem with this is that whenever I grab objects with the pointer
>> tool in OpenRave, the display kind of goes blank and doesn't show me
>> anything until I either let go of the mouse or if I just hold the mouse
>> button down without moving.  After I've released the object, the display
>> still takes some time before it is visible again.
>>
>> Is there something really problematic about me dynamically re-arranging
>> the KinBody positions every time my plugin is invoked?  Is there
>> something inside of OpenRave that doesn't like to see a lot of KinBodies
>> moved around somehow?  Should I instead just instead do
>> RemoveKinBody(kinbodyptr, true) and recreate them completely?  Or,
>> should I just move the KinBodies off screen without calling
>> Add/RemoveKinBody?
>>
>> Any advice would be greatly appreciated.
>>
>> Thanks,
>>
>> -Paul
>>
>
> --
> Paul E. Rybski, Ph.D., Systems Scientist
> Robotics Institute, Carnegie Mellon University
> Phone: 412-268-7417, Fax: 412-268-7350
> Web: http://www.cs.cmu.edu/~prybski
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: question regarding the re-use of KinBody objects

Paul E. Rybski
Hi Ros,
        I'm doing two different applications here.  :)

1) Displaying voxel data purely for the purposes of visualization.  I
used the trimesh functions for this and it worked perfectly.  Thanks
again for that great bit of advice!

2) Computing voxels from simulated lasers.  This is a new application
where I actually need the voxels as kinbodies because I'm computing
collisions of these bodies with other objects in the environment.  This
is the application that I'm referring to in this email thread.  So,
essentially, I'm constantly re-arranging the KinBodies to reflect the
positions of the voxels as the objects in front of the laser move
around.  This is what I'd like to try to find some solution that didn't
involve me teleporting my unused KinBodies to (1000,1000,1000) or
something arbitrary like that.

-Paul

Rosen Diankov wrote:

> It is the fact that the 3D resources get destroyed and recreated. When
> I gave the suggestion to use KinBody::Enable, I completely forgot that
> fact. Each KinBody is also readded to the collision detector, which
> could also contribute to slowness.
>
> If you plot everything via one drawtrimesh call, at least it is only
> one 3D resource that will get recreated, and it doesn't register at
> all with the underlying environment objects. Was there a problem with
> this method?
>
> rosen,
>
> 2008/8/16 Paul E. Rybski <[hidden email]>:
>> Update:  I've modified my program so that I no longer add/remove the
>> kinbodies rather, I just teleport the ones I don't need for a given
>> display to a point very (VERY) far away from the origin of my scene.
>> This GREATLY improves the display performance over adding/removing the
>> bodies.  It's not pretty though and I really wonder if there's a better way.
>>
>> I just had a thought... the kinbodies' pose in my previous
>> implementation was always within the FOV of the laser even when the
>> bodies were removed.  Might that be a cause of some of the slowness?
>> Might the laser still be trying to iterate through the list of Kinbodies
>> because their resources still existed?
>>
>> -Paul
>>
>> Paul E. Rybski wrote:
>>> Hi,
>>>       I'm working on a plugin which takes points returned from a simulated
>>> laser, generates voxels, and then generates KinBodies for each of the
>>> voxels and displays them (with Enable(false) being called).  I thought
>>> it would be faster not to destroy and re-create the KinBodies every
>>> time.  Instead, on initialization of the plugin, I first create a vector
>>> of kinbody pointers that use the appropriate XML/WRL files but I don't
>>> call AddKinBody on them.  Rather,  whenever I call SimulationStep(...),
>>> I first call RemoveKinBody(kinbodyptr, false) on each kinbodyptr in the
>>> vector.  Then I do my processing where I collect laser points and
>>> compute voxels.  Finally, I set the new pose on all of the KinBodies
>>> that I'll actually be using that time around, and then call
>>> AddKinBody(kinbodyptr) and edit the SimulationStep(...) method.
>>>
>>> The problem with this is that whenever I grab objects with the pointer
>>> tool in OpenRave, the display kind of goes blank and doesn't show me
>>> anything until I either let go of the mouse or if I just hold the mouse
>>> button down without moving.  After I've released the object, the display
>>> still takes some time before it is visible again.
>>>
>>> Is there something really problematic about me dynamically re-arranging
>>> the KinBody positions every time my plugin is invoked?  Is there
>>> something inside of OpenRave that doesn't like to see a lot of KinBodies
>>> moved around somehow?  Should I instead just instead do
>>> RemoveKinBody(kinbodyptr, true) and recreate them completely?  Or,
>>> should I just move the KinBodies off screen without calling
>>> Add/RemoveKinBody?
>>>
>>> Any advice would be greatly appreciated.
>>>
>>> Thanks,
>>>
>>> -Paul
>>>
>> --
>> Paul E. Rybski, Ph.D., Systems Scientist
>> Robotics Institute, Carnegie Mellon University
>> Phone: 412-268-7417, Fax: 412-268-7350
>> Web: http://www.cs.cmu.edu/~prybski
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Openrave-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openrave-users
>>
>

--
Paul E. Rybski, Ph.D., Systems Scientist
Robotics Institute, Carnegie Mellon University
Phone: 412-268-7417, Fax: 412-268-7350
Web: http://www.cs.cmu.edu/~prybski


Loading...