CodexLabsLLC/Colosseum

Python API error

Closed this issue · 2 comments

Bug report

  • AirSim Version/#commit: master
  • UE/Unity version: 5.3
  • autopilot version: NA
  • OS Version: win11

What's the issue you encountered?

Settings

Default

How can the issue be reproduced?

Default compiling settings, and start hello_car.py

Include full error message in text form

Length of encoded data does not match number of attributes
  File "F:\Dataset\UE_503\Colosseum\PythonClient\airsim\types.py", line 21, in from_msgpack
    raise ValueError("Length of encoded data does not match number of attributes")
  File "F:\Dataset\UE_503\Colosseum\PythonClient\airsim\client.py", line 1637, in getCarState
    return CarState.from_msgpack(state_raw)
  File "F:\Dataset\UE_503\Colosseum\PythonClient\car\hello_car.py", line 26, in <module>
    car_state = client.getCarState()
ValueError: Length of encoded data does not match number of attributes

Reason

The inconsistence between the CarState in cpp and python code.
More specifically, the collision is missing in cpp.

In cpp code, there are only 7 param are packed, but in python code 8 param are required.

What's better than filing an issue? Filing a pull request :).

Moreover, maybe you should rewrite the to_msgpack in type.py, as you changed the rpcpack from dict to list. e.g.:

def to_msgpack(self, *args, **kwargs):
    pack_vals = []
    for attr_name, _ in self.attribute_order:
        pack_vals.append(self.__dict__.get(attr_name)) 
    return pack_vals

or

def to_msgpack(self, *args, **kwargs):
    return list(self.__dict__.values())

I have encountered the same problem too. Moreover, I cant move the car manually.

Fixed in #102