ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to check whether a virtual object is colliding with another?

asked 2012-09-13 22:53:14 -0600

tor gravatar image

Hi All,

I have to simulate a planning environment where objects whose poses are randomly determined are added.

It is obvious to check if the just-added object is in collision with the robot, as in here.

How to check if it is in collision with the other existing objects?

Thanks a lot.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-11-01 16:40:17 -0600

you need this method:

bool isObjectInCollision(const std::string& object_name);

it's a public method of planning_environment::CollisionModels.

besides, if you want to know exactly which objects are in collision with the target object, use this method:

void getAllEnvironmentCollisionsForObject(const std::string& object_name, 
                        std::vector<arm_navigation_msgs::ContactInformation>& contacts,
                        unsigned int num_per_pair = 1);
edit flag offensive delete link more

Comments

Please note that the goal is to check whether an object is in collision with another object, _not_ with a robot. AFAIK, your answer works for the latter. Anyway, thanks.

tor gravatar image tor  ( 2012-11-04 23:01:30 -0600 )edit

i don't agree with you. getAllEnvironmentCollisionsForObject() will return all the collisions for the specified object, no matter it is a robot link, or another object. you can check the src of this method.

yangyangcv gravatar image yangyangcv  ( 2012-11-05 14:45:21 -0600 )edit

Well, to call isObjectInCollision(), we need an instance of CollisionModel whose constructor needs a robot description. Therefore, even if we have the object cm from rbt_desc, cm.isObjectInCollision("obj") will tell whether "obj" is in collision with the rbt_desc's robot. CMIIW.

tor gravatar image tor  ( 2012-11-08 21:48:44 -0600 )edit

well, i have not test the function isObjectInCollision(), but i do test the function getAllEnvironmentCollisionsForObject() and it does work. and of course, you need an instance of CollisionModel.

yangyangcv gravatar image yangyangcv  ( 2012-11-08 23:14:03 -0600 )edit

Question Tools

Stats

Asked: 2012-09-13 22:53:14 -0600

Seen: 276 times

Last updated: Nov 01 '12