Gazebo | Ignition | Community
Ask Your Question

Should I use RayShape or RayCast to detect collision between 2 agents ?

asked 2021-05-10 08:40:48 -0500

vinco gravatar image

Hi, I'm currently working on a drone simulator using ROS/Gazebo and I have an issue regarding the detection of obstacles.

My predecessor created a plugin for UWB communication which basically publish certain information to a topic created for each drone to simulated communication.

Here is how it should work: - initialize the com by calling a rosservice, it creates a semaphore system - when having the semaphore, each drone will scan for other plugin (antenna) - for each other antenna detected, it will sent a beam to detect if an obstacle is between the 2 drones (detect a collision) - if there is not, then a propagation model is calculated to check if the distance isn't too big, then info is published.

My problem is about the collision detection system. My predecessor used this piece of code:

test_ray_ = boost::dynamic_pointer_cast<physics::RayShape>(world_->Physics()->CreateShape("ray",physics::CollisionPtr()));

Then I can check for obstacle using those lines:

test_ray_->SetPoints(emitter_pos, receivr_pos);

test_ray_->GetIntersection(obstacle_distance, obstacle_entity);

My problem is when I actually put a simple cube between the 2 drones, the only object detected is the other drone.

So I wonder if I shouldn't use the RayCast class instead of the RayShape, that seems to only check if there is something at the position you provide (here called receivr_pos).

For precision: - I'm in Gazebo 9.0, ROS 1.0 (melodic) - all the obstacle I tried have collision properties (and even laser reflection)

Thank you in advance !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-05-18 04:01:44 -0500

vinco gravatar image

Anyone to help me understand ?


edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-05-10 08:40:48 -0500

Seen: 16 times

Last updated: May 18