Skip to content

Update types.py to fix issues with 'bad cast' RPCError #101

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion PythonClient/airsim/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ def __repr__(self):
return "<" + type(self).__name__ + "> " + pformat(vars(self), indent=4, width=1)

def to_msgpack(self, *args, **kwargs):
return self.__dict__
res = []
for index, (attr_name, attr_type) in enumerate(self.attribute_order):
attr_val = getattr(self, attr_name)
if issubclass(attr_type, MsgpackMixin):
res.append(attr_type.to_msgpack(attr_val))
else:
res.append(attr_val)
return res

@classmethod
def from_msgpack(cls, encoded):
Expand Down Expand Up @@ -438,6 +445,7 @@ class ImageResponse(MsgpackMixin):
image_data_uint8 = np.uint8(0)
image_data_float = 0.0
camera_position = Vector3r()
camera_name = ''
camera_orientation = Quaternionr()
time_stamp = np.uint64(0)
message = ''
Expand All @@ -451,6 +459,7 @@ class ImageResponse(MsgpackMixin):
('image_data_uint8', np.ndarray),
('image_data_float', float),
('camera_position', Vector3r),
('camera_name', str),
('camera_orientation', Quaternionr),
('time_stamp', np.uint64),
('message', str),
Expand Down