Skip to content

Commit

Permalink
Fix getMultirotorState API mismatches
Browse files Browse the repository at this point in the history
  • Loading branch information
tommaier123 committed Oct 11, 2024
1 parent 17aae2d commit 67ef608
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace airlib_rpclib
std::vector<std::string> controller_messages;
bool can_arm;

MSGPACK_DEFINE_ARRAY(collision, kinematics_estimated, gps_location, timestamp, landed_state, rc_data);
MSGPACK_DEFINE_ARRAY(collision, kinematics_estimated, gps_location, timestamp, landed_state, rc_data, ready, ready_message, can_arm);

MultirotorState()
{
Expand Down
37 changes: 15 additions & 22 deletions PythonClient/airsim/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ class CollisionInfo(MsgpackMixin):

attribute_order = [
('has_collided', bool),
('penetration_depth', float),
('time_stamp', np.uint64),
('normal', Vector3r),
('impact_point', Vector3r),
('position', Vector3r),
('penetration_depth', float),
('time_stamp', np.uint64),
('object_name', str),
('object_id', int)
]
Expand Down Expand Up @@ -379,8 +379,9 @@ def __init__(self, is_rate=True, yaw_or_rate=0.0):
class RCData(MsgpackMixin):
timestamp = 0
pitch, roll, throttle, yaw = (0.0,) * 4 # init 4 variable to 0.0
switch1, switch2, switch3, switch4 = (0,) * 4
switch5, switch6, switch7, switch8 = (0,) * 4
left_z, right_z = (0.0,) * 2
switches = 0
vendor_id = ''
is_initialized = False
is_valid = False

Expand All @@ -390,34 +391,26 @@ class RCData(MsgpackMixin):
('roll', float),
('throttle', float),
('yaw', float),
('switch1', int),
('switch2', int),
('switch3', int),
('switch4', int),
('switch5', int),
('switch6', int),
('switch7', int),
('switch8', int),
('left_z', float),
('right_z', float),
('switches', int),
('vendor_id',str),
('is_initialized', bool),
('is_valid', bool)
]

def __init__(self, timestamp=0, pitch=0.0, roll=0.0, throttle=0.0, yaw=0.0, switch1=0,
switch2=0, switch3=0, switch4=0, switch5=0, switch6=0, switch7=0, switch8=0, is_initialized=False,
def __init__(self, timestamp=0, pitch=0.0, roll=0.0, throttle=0.0, yaw=0.0, left_z=0.0, right_z=0.0, switches=0,
vendor_id='', is_initialized=False,
is_valid=False):
self.timestamp = timestamp
self.pitch = pitch
self.roll = roll
self.throttle = throttle
self.yaw = yaw
self.switch1 = switch1
self.switch2 = switch2
self.switch3 = switch3
self.switch4 = switch4
self.switch5 = switch5
self.switch6 = switch6
self.switch7 = switch7
self.switch8 = switch8
self.left_z = left_z
self.right_z = right_z
self.switches = switches
self.vendor_id = vendor_id
self.is_initialized = is_initialized
self.is_valid = is_valid

Expand Down

0 comments on commit 67ef608

Please sign in to comment.