Message thread on Webots Programming

BoundingBoxes of objectsby Nelson de Moura Martins Gomes (Webots PRO - 25) 2019-01-02 10:43:55
Hi, I'm implementing a physics plugin to detect and signal collision for a simulation. I'm using the pedestrian proto and vehicles proto, and both have multiple bounding boxes (by their graphic representation). Is there a way to find the order of boxes when the function dSpaceGetGeom is used (without recurring to simulation to find this information)? I'm using the example physics.wbt to base my implementation.

Thanks
Re: BoundingBoxes of objectsby Nelson de Moura Martins Gomes (Webots PRO - 25) 2019-01-02 11:14:55
Ps.: Also, the size of a dGeomID is the same as dSpaceID ? (necessary to use malloc correctly, since I use an array of IDs).
Re: BoundingBoxes of objectsby Olivier Michel (Webots MOD - 990) 2019-01-04 15:17:01
Nelson,

Yes, the size of a dGeomID is the same as a dSpaceID as defined in the ODE common.h include file (they are actually C pointers).
To determine the order of boxes, you can recursively use the ODE functions dGeomGetSpace() that returns the space associated with a geom and dGeomIsSpace() to determine is a space is a geom.

Best regards,
Re: BoundingBoxes of objectsby Nelson de Moura Martins Gomes (Webots PRO - 25) 2019-01-08 10:15:15
I successfully loaded all the vehicles bounding boxes, but I cannot retrieve the one related to the pedestrian object (the option enableBoundingObject is set to true since the beginning of the simulation). I test the output of the function dWebotsGetGeomFromDEF and it is NULL. The names used in the function and in the simulation match (I change the pedestrian name for one of the vehicles, the ped. did not load and the vehicle did). Should I change something to allow the retrieval of the bb for the pedestrian?

Also, when I retrieve a space, how can I discover which part of my object is related to each GeomID ? For example, using a road with two sidewalks, I presume that the first bounding box is related to to the road itself, then how can I determine which one is related to the left sidewalk?

Thanks
Re: BoundingBoxes of objectsby Olivier Michel (Webots MOD - 990) 2019-01-14 12:53:13
Nelson,

Sorry for my late answer.
Are you sure the DEF names you use for the pedestrians correspond to actual Solid nodes that include the bounding objects of the pedestrians? If it is the case and the problem persists, please open a support ticket and upload a simple simulation that demonstrates the problem (with a single pedestrian and a physics plugin).

It is not directly possible to determine from a list of geoms (derived from a space) which are the DEF names corresponding to each geom. Instead, you should rely on the dGeomGetPosition() and gGeomGetRotation() functions to determine the geoms offsets with respect to the space and deduce the corresponding Webots object.

Best regards,

Forum closed

This forum is closed, please ask technical questions about Webots on Stack Overflow or open a support ticket.

LIVE CHAT (beta)

How can I help you?

Support team
Chat with us ×