AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

AttributeError: 'MultirotorClient' object has no attribute 'getLidarData'

Open Ahmad5112 opened this issue 7 years ago • 30 comments

I am trying to run the code "lidar.py" and getting this error.i have searched for "getLidarData" to include but I did not find it how I can resolve the problem Same error I am getting for car client

Ahmad5112 avatar Dec 12 '18 12:12 Ahmad5112

@Ahmad5112 -- you either didn't update the AirSim plugin in your unreal project with the latest bits OR you didn't update your python client module of AirSim.... most likely you didn't update your python client AirSim module.

Did you install AirSim python module explicitly in the past?

bmalhigh avatar Dec 12 '18 15:12 bmalhigh

no, I didn't install explicitly can you please explain how i can fix it kindly if u tell me in a detail steps it would be really helpful

Ahmad5112 avatar Dec 12 '18 15:12 Ahmad5112

  1. Make sure you have pulled the latest code from the repo.
  2. Build AirSim plugin (build.cmd on windows)
  3. Update AirSim plugin in your unreal project Essentially copy Unreal\Plugins\AirSim under the plugins folder of your unreal project. Are you using Blocks project or your own project?
  4. Python module a) If you ever installed the AirSim module, update it now by doing pip install airsim b) If you don't have airsim module installed, just go to PythonClient folder and execute python code

bmalhigh avatar Dec 12 '18 16:12 bmalhigh

can you please give the link to the most updated repository as there are some other forks and they don't work

Ahmad5112 avatar Dec 12 '18 16:12 Ahmad5112

I am not sure I understand your comment about multiple forks. The repo we are having this discussion on is the main repo.

git clone https://github.com/Microsoft/AirSim.git

Have you looked at this doc about Python APIs? https://github.com/Microsoft/AirSim/blob/master/docs/apis.md#python-quickstart

bmalhigh avatar Dec 12 '18 16:12 bmalhigh

Yup I have gone through the said doc before starting and I just have copied the python code for lidar from here and didn't make any change to it well I am cloning again and try again and would let you know if it make any difference

Ahmad5112 avatar Dec 12 '18 16:12 Ahmad5112

From the error description (getLidarData not found on client objects), it seems to be stale bits issue. My hunch is stale bits on the python client side.

Can you check using "pip list" to make sure an older AirSim python module is not installed on your machine?

bmalhigh avatar Dec 12 '18 17:12 bmalhigh

AirSim 1.2.3 is installed as i checked and got the following list

capture

Ahmad5112 avatar Dec 12 '18 17:12 Ahmad5112

Right... I am assuming you installed airsim python module in the past.

Check to understand what bits are used by that module. From a python shell, execute import airsim airsim.__file__ That should show you where the install module is coming from

bmalhigh avatar Dec 12 '18 18:12 bmalhigh

on running this in Anaconda i got the following runfile('C:/Users/Muhammad Ahmed/Desktop/Simulation/untitled1.py', wdir='C:/Users/Muhammad Ahmed/Desktop/Simulation') Reloaded modules: airsim, airsim.client, airsim.utils, airsim.types, msgpackrpc, msgpackrpc._version, msgpackrpc.loop, msgpackrpc.client, msgpackrpc.session, msgpackrpc.message, msgpackrpc.future, msgpackrpc.error, msgpackrpc.transport, msgpackrpc.transport.tcp, tornado.iostream, tornado.netutil, msgpackrpc.compat, msgpackrpc.server, msgpackrpc.address

Ahmad5112 avatar Dec 12 '18 18:12 Ahmad5112

Are you able to uninstall airsim package? pip uninstall airsim

bmalhigh avatar Dec 12 '18 18:12 bmalhigh

I have just finished up with building AirSim again and also uninstalled it from pip directory what to do next?

Ahmad5112 avatar Dec 12 '18 18:12 Ahmad5112

Two options:

  1. go ahead and install the new airsim bits from \PythonClient directory pip install airsim OR
  2. Do what the files under \PythonClient\Car and \PythonClient\Multirotor are doing. They import a file called setup_path.py (present locally in those folders). That file can use the airsim directly from your clone without requiring install of airsim package.

If confusing, just use option#1 and try.

bmalhigh avatar Dec 12 '18 18:12 bmalhigh

After doing All the fixes now i am getting This

File "C:\ProgramData\Anaconda3\lib\site-packages\airsim\types.py", line 17, in obj.dict = { k : (v if not isinstance(v, dict) else getattr(getattr(obj, k).class, "from_msgpack")(v)) for k, v in encoded.items()}

AttributeError: 'LidarData' object has no attribute 'pose'

Ahmad5112 avatar Dec 12 '18 20:12 Ahmad5112

In the types.py file, check the LidarData class defined at the very bottom. Do you see the pose property in that file?

class LidarData(MsgpackMixin): point_cloud = 0.0 time_stamp = np.uint64(0) **pose = Pose()**

bmalhigh avatar Dec 12 '18 21:12 bmalhigh

yes it has the property doespose = Pose() this staric have some meaning as these are missing

Ahmad5112 avatar Dec 12 '18 21:12 Ahmad5112

I am running code from Spyder is there any other way to run the code?

Ahmad5112 avatar Dec 12 '18 21:12 Ahmad5112

** was just my attempt to highlight the property.

Which Unreal project/env are you using? Are you able to test with this with Blocks environment that is part of the repo?

bmalhigh avatar Dec 12 '18 21:12 bmalhigh

I am using block environment

Ahmad5112 avatar Dec 12 '18 21:12 Ahmad5112

I am assuming your using the Blocks env from \Unreal\Environments\Blocks\

In this file \Unreal\Environments\Blocks\Plugins\AirSim\Source\AirLib\include\common\CommonStructs.hpp

Do you see the Pose property on the LidarData struct? ` struct LidarData {

TTimePoint time_stamp = 0;
vector<real_T> point_cloud;
Pose pose;

LidarData()
{}

}; `

bmalhigh avatar Dec 12 '18 22:12 bmalhigh