AttributeError: 'MultirotorClient' object has no attribute 'getLidarData'
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 -- 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?
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
- Make sure you have pulled the latest code from the repo.
- Build AirSim plugin (build.cmd on windows)
- 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?
- 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
can you please give the link to the most updated repository as there are some other forks and they don't work
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
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
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?
AirSim 1.2.3 is installed as i checked and got the following list
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
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
Are you able to uninstall airsim package?
pip uninstall airsim
I have just finished up with building AirSim again and also uninstalled it from pip directory what to do next?
Two options:
- go ahead and install the new airsim bits from \PythonClient directory
pip install airsimOR - 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.
After doing All the fixes now i am getting This
File "C:\ProgramData\Anaconda3\lib\site-packages\airsim\types.py", line 17, in
AttributeError: 'LidarData' object has no attribute 'pose'
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()**
yes it has the property doespose = Pose() this staric have some meaning as these are missing
I am running code from Spyder is there any other way to run the code?
** 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?
I am using block environment
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()
{}
}; `