AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

Collision Avoidance : has_collided returns False even on colliding with a certain object

Open mish1102 opened this issue 7 years ago • 6 comments

I am using AirSim NH environment to train my drone using RL with CNTK. While the drone hits the certain object in the scene, still in background has_collided parameter is assigned False. Kindly look below the Collision_Info :

('Collision_data', { u'has_collided': False, u'impact_point': { u'x_val': 0.0, u'y_val': 0.0, u'z_val': -0.14649589359760284}, u'normal': { u'x_val': 1.6051125272670275e-13, u'y_val': -1.1454494019957906e-09, u'z_val': -1.0}, u'object_id': 171, u'object_name': u'Road_89', u'penetration_depth': 0.011044786311686039, u'position': { u'x_val': 0.0, u'y_val': 0.0, u'z_val': -0.14649589359760284}, u'time_stamp': 1558946282693258752})

Help is much appreciated.

mish1102 avatar May 27 '19 08:05 mish1102

@mish1102 Can you provide a screenshot of the occurrence? A definition of the object in question will allow a quicker debugging process.

msb336 avatar Jun 04 '19 16:06 msb336

Hi @msb336,

I meet the same problem when I am using multirotor. Here is the screenshot that the problem I meet. I set the Airsim Environment in 5X clock speed when I take action to move forward, and the simulator returns the information that meets the collision but the function "collision_info.has_collided" return False. collision_avoidance I wonder if the problem is because the response time to detect the collision information by python client to be delayed? By the way, or could I get the information about the collision count number? so that I also can know if the vehicle was been through collision before or not?

Hoshea7 avatar Aug 01 '19 09:08 Hoshea7

may be related to #1004?

jonyMarino avatar Sep 10 '20 17:09 jonyMarino

I have same issue

alirezadizaji avatar Oct 31 '20 12:10 alirezadizaji

I have the same issue

rolanvc-upd avatar Aug 18 '21 06:08 rolanvc-upd

yeet, have the same problem, i think it was the has_collided bug when the car or quadrotor hit some object, it's not changing the flag into True. so that was the problem.

what my trick to solve this issue is to add more parameter to make sure the car was in collision. take a look at collision data:

`('Collision_data', { u'has_collided': False,

u'impact_point': { u'x_val': 0.0,
u'y_val': 0.0, u'z_val': -0.14649589359760284}, u'normal': { u'x_val': 1.6051125272670275e-13, u'y_val': -1.1454494019957906e-09, u'z_val': -1.0}, u'object_id': 171, u'object_name': u'Road_89', u'penetration_depth': 0.011044786311686039, u'position': { u'x_val': 0.0, u'y_val': 0.0, u'z_val': -0.14649589359760284}, u'time_stamp': 1558946282693258752})`

i've been monitoring all the data changes before collision and after collision. then, i found normal data to be changed, beside the has_collided flag.

honestly idk about what normal position mean in this code, but it works perfectly.

so try to use normal.x_val as your second parameter. in example : collision = self.drone.simGetCollisionInfo() self.state["collision"] = collision.has_collided self.state["object_normal_position"] = collision.normal.x_val

checking if self.state['collision'] or self.state['object_normal_position'] != 0: reward = -10

riyadfebrian avatar Dec 21 '21 13:12 riyadfebrian