AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

NameError: name 'DistanceSensorData' is not defined

Open rajatthosar opened this issue 7 years ago • 3 comments

I tried to implement the getDistanceSensorData(lidar_name, vehicle_name) method but I received the following error.

NameError: name 'DistanceSensorData' is not defined

Trace: Traceback (most recent call last): File "Path/to/my/project.py", line 399, in handlerObj.main() File "Path/to/my/project.py", line 351, in main print(airSimObj.getDistanceSensorData(client=drone_client, vehicle_name=vehicles[0])) File "Path/to/my/project.py", line 291, in getDistanceSensorData client.getDistanceSensorData() File "C:\Program Files\Python36\lib\site-packages\airsim\client.py", line 157, in getDistanceSensorData return DistanceSensorData.from_msgpack(self.client.call('getDistanceSensorData', distance_sensor_name, vehicle_name)) NameError: name 'DistanceSensorData' is not defined

I tried to find the DistanceSensorData class but couldn't find it. Has anyone faced a similar issue? And if so, how did you resolve it? Any help is much appreciated

rajatthosar avatar Aug 05 '19 19:08 rajatthosar

Is there any update on this issue?

rajatthosar avatar Aug 09 '19 17:08 rajatthosar

I was able to fix this by adding the following code the the types file.

AirSim\PythonClient\airsim\types.py

Add:

class DistanceSensorData(MsgpackMixin): time_stamp = np.uint64(0) distance = Quaternionr() min_distance = Quaternionr() max_distance = Quaternionr() relative_pose = Pose()

ACLeighner avatar Oct 07 '19 02:10 ACLeighner

@ACLeighner please feel free to submit a PR!

saihv avatar Oct 30 '19 20:10 saihv