Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'DistanceSensorData' is not defined #2117

Closed
rajatthosar opened this issue Aug 5, 2019 · 3 comments · Fixed by #2403
Closed

NameError: name 'DistanceSensorData' is not defined #2117

rajatthosar opened this issue Aug 5, 2019 · 3 comments · Fixed by #2403

Comments

@rajatthosar
Copy link

rajatthosar commented Aug 5, 2019

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
Copy link
Author

Is there any update on this issue?

@ACLeighner
Copy link

ACLeighner commented Oct 7, 2019

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()

@saihv
Copy link
Contributor

saihv commented Oct 30, 2019

@ACLeighner please feel free to submit a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants