microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.07k stars 4.48k forks source link

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

Open mish1102 opened 5 years ago

mish1102 commented 5 years ago

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.

msb336 commented 5 years ago

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

Hoshea7 commented 4 years ago

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?

jonyMarino commented 3 years ago

may be related to #1004?

alirezadizaji commented 3 years ago

I have same issue

rolanvc-upd commented 2 years ago

I have the same issue

riyadfebrian commented 2 years ago

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