Accessing/modifying individual Mesh vertices of a kinematic body

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

Accessing/modifying individual Mesh vertices of a kinematic body

Ken Toh
Hi,

Let's suppose I introduce an arbitrary kinematic body object (let's say a simple cube) into the environment via XML. Which specific functions in OpenRAVE, if any, would allow me to directly access or modify the values of each object mesh vertex at a particular time-step? Which definition files should I be looking into?  I ask because I am handling volumetric soft objects and I would like to know how a custom physics engine should grab existing vertex values of an object, update the new values to reflect the new shape of the object, and pass it back to OpenRAVE for rendering in the next time step. Is this possible? I think generally grabbing/changing the position and orientation of an object would be rather clear-cut, but I am not too sure about the case of individual vertices...

Thanks a lot in advance,
Ken
Reply | Threaded
Open this post in threaded view
|

Re: Accessing/modifying individual Mesh vertices of a kinematic body

Rosen Diankov
Administrator
hi ken,

Yes, this is very easy to do, and there's actually 2 ways of doing it.
Each link is composed of a set of geometry objects. You should first
initialize your KinBody using the InitFromTriMesh function

http://openrave.programmingvision.com/ordocs/en/html/classOpenRAVE_1_1KinBody.html#afc51e0e62aafffacb4fc4fcda1e398a7

This will create a body with one link and one trimesh geometry object.
Then you can modify that triangle mesh using the SetCollisionMesh
function of the geometry object.

http://openrave.programmingvision.com/ordocs/en/html/classOpenRAVE_1_1KinBody_1_1Link_1_1GEOMPROPERTIES.html#a52f7356bf7ea51c784a12a61f5fbb5f6

All the collision/physics updates will happen automatically, so you
don't need to worry about them.

rosen,

2010/9/29 Ken Toh <[hidden email]>:

>
> Hi,
>
> Let's suppose I introduce an arbitrary kinematic body object (let's say a
> simple cube) into the environment via XML. Which specific functions in
> OpenRAVE, if any, would allow me to directly access or modify the values of
> each object mesh vertex at a particular time-step? Which definition files
> should I be looking into?  I ask because I am handling volumetric soft
> objects and I would like to know how a custom physics engine should grab
> existing vertex values of an object, update the new values to reflect the
> new shape of the object, and pass it back to OpenRAVE for rendering in the
> next time step. Is this possible? I think generally grabbing/changing the
> position and orientation of an object would be rather clear-cut, but I am
> not too sure about the case of individual vertices...
>
> Thanks a lot in advance,
> Ken
> --
> View this message in context: http://openrave-users-list.185357.n3.nabble.com/Accessing-modifying-individual-Mesh-vertices-of-a-kinematic-body-tp1600156p1600156.html
> Sent from the OpenRAVE Users List mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Accessing/modifying individual Mesh vertices of a kinematic body

Nick Hillier
Rosen,

Thanks for the reply, we are interested in this functionality also.

Ken, can you let the list know how well this approach works for you?

Nick

On Wed, 2010-09-29 at 15:22 +1000, Rosen Diankov wrote:

> hi ken,
>
> Yes, this is very easy to do, and there's actually 2 ways of doing it.
> Each link is composed of a set of geometry objects. You should first
> initialize your KinBody using the InitFromTriMesh function
>
> http://openrave.programmingvision.com/ordocs/en/html/classOpenRAVE_1_1KinBody.html#afc51e0e62aafffacb4fc4fcda1e398a7
>
> This will create a body with one link and one trimesh geometry object.
> Then you can modify that triangle mesh using the SetCollisionMesh
> function of the geometry object.
>
> http://openrave.programmingvision.com/ordocs/en/html/classOpenRAVE_1_1KinBody_1_1Link_1_1GEOMPROPERTIES.html#a52f7356bf7ea51c784a12a61f5fbb5f6
>
> All the collision/physics updates will happen automatically, so you
> don't need to worry about them.
>
> rosen,
>
> 2010/9/29 Ken Toh <[hidden email]>:
> >
> > Hi,
> >
> > Let's suppose I introduce an arbitrary kinematic body object (let's say a
> > simple cube) into the environment via XML. Which specific functions in
> > OpenRAVE, if any, would allow me to directly access or modify the values of
> > each object mesh vertex at a particular time-step? Which definition files
> > should I be looking into?  I ask because I am handling volumetric soft
> > objects and I would like to know how a custom physics engine should grab
> > existing vertex values of an object, update the new values to reflect the
> > new shape of the object, and pass it back to OpenRAVE for rendering in the
> > next time step. Is this possible? I think generally grabbing/changing the
> > position and orientation of an object would be rather clear-cut, but I am
> > not too sure about the case of individual vertices...
> >
> > Thanks a lot in advance,
> > Ken
> > --
> > View this message in context: http://openrave-users-list.185357.n3.nabble.com/Accessing-modifying-individual-Mesh-vertices-of-a-kinematic-body-tp1600156p1600156.html
> > Sent from the OpenRAVE Users List mailing list archive at Nabble.com.
> >
> > ------------------------------------------------------------------------------
> > Start uncovering the many advantages of virtual appliances
> > and start using them to simplify application deployment and
> > accelerate your shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Openrave-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/openrave-users
> >
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users



------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Accessing/modifying individual Mesh vertices of a kinematic body

Ken Toh
In reply to this post by Rosen Diankov
Thank you Rosen for the really prompt reply..

So if my "single-link kinbody" is already a tri-mesh geom type (introduced via xml instead of initFromMesh), I believe the link will already be initialized with a trimesh geometry object that I can work with straight away right? How about other supported geoms like spheres, cylinders and blocks that are introduced via the xml interface? Does OpenRAVE triangulate a mesh automatically for each of them such that I can setCollisionMesh() for example right away?

Secondly, since I am trying to introduce soft objects in addition to a world that is possibly already populated with other rigid objects, what would be the best/right way for me to differentiate between soft and rigid bodies? Is there a way where I can tag/specify a kinbody as "soft" with perhaps some specific additional material properties: ie softness etc, to set it about from the usual kinbody, so that my "custom physics engine/collision checker" can handle these objects differently?

Specifically, during syncing of the physics world with the openrave world, I want my physics engine to update the individual vertices of the object mesh in the simulation update step for soft bodies via setCollisionMesh(), instead of the usual treatment for rigid objects (finding the change in pos/orientation and applying the transform to the body for each time step).

I hope all these don't sound too confusing. Ideally, if this differentiation of kinbodies can be done without changing the internals of openrave it would of course be great. Let me know, thanks!

Nick, I'll let you know if this works out..

Thanks in advance,
Ken
Reply | Threaded
Open this post in threaded view
|

Re: Accessing/modifying individual Mesh vertices of a kinematic body

Rosen Diankov
Administrator
Hi Ken,

The best way is for you to derive your soft object from KinBody and
offer it as a new SoftKinBody interface through a plugin. Here is a
tutorial on writing plugins:

http://openrave.programmingvision.com/ordocs/en/html/writing_plugins.html

Then you would create it by:

GetEnv()->CreateKinBody("softkinbody");

You'll notice that a KinBody has a SimulationStep function that is
called at the same time the physics step function is called. This will
allow you to do updates in sync with the physics.

SetCollisionMesh can be only called for trimeshes.
Spheres/boxes/cylinders will always remain primitives that are
specially handled.

rosen,

2010/9/30 Ken Toh <[hidden email]>:

>
> Thank you Rosen for the really prompt reply..
>
> So if my "single-link kinbody" is already a tri-mesh geom type (introduced
> via xml instead of initFromMesh), I believe the link will already be
> initialized with a trimesh geometry object that I can work with straight
> away right? How about other supported geoms like spheres, cylinders and
> blocks that are introduced via the xml interface? Does OpenRAVE triangulate
> a mesh automatically for each of them such that I can setCollisionMesh() for
> example right away?
>
> Secondly, since I am trying to introduce soft objects in addition to a world
> that is possibly already populated with other rigid objects, what would be
> the best/right way for me to differentiate between soft and rigid bodies? Is
> there a way where I can tag/specify a kinbody as "soft" with perhaps some
> specific additional material properties: ie softness etc, to set it about
> from the usual kinbody, so that my "custom physics engine/collision checker"
> can handle these objects differently?
>
> Specifically, during syncing of the physics world with the openrave world, I
> want my physics engine to update the individual vertices of the object mesh
> in the simulation update step for soft bodies via setCollisionMesh(),
> instead of the usual treatment for rigid objects (finding the change in
> pos/orientation and applying the transform to the body for each time step).
>
> I hope all these don't sound too confusing. Ideally, if this differentiation
> of kinbodies can be done without changing the internals of openrave it would
> of course be great. Let me know, thanks!
>
> Nick, I'll let you know if this works out..
>
> Thanks in advance,
> Ken
> --
> View this message in context: http://openrave-users-list.185357.n3.nabble.com/Accessing-modifying-individual-Mesh-vertices-of-a-kinematic-body-tp1600156p1605531.html
> Sent from the OpenRAVE Users List mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users