1首先搭建好环境
参考
2 python控制
https://blog.csdn.net/Zhaoxi_Li/article/details/108002544
官方代码位置
自己pythonj教程
https://www.cnblogs.com/gooutlook/p/15851233.html
3开启环境
无人机模式运行
4运行python代码
原厂目录下运行没问题
自己的脚本要添加airssim路径 否警报错
手动添加airsim遍历路径
import sys #sys.path.append("/home/dongdong/3Code/Airsim/AirSim/PythonClient") #ubnutu sys.path.append("E:/v0_Project/V2_labray/v4_Airsim/v0_AirsimAPI/Airsim171/PythonClient")#win10 #import setup_path #导入库路径 被代替
启动
更多其他控制
https://www.cnblogs.com/gooutlook/p/15851233.html
其他
4.4 天气API
默认天气效果是关闭的,如果想启用天气效果,首先调用函数simEnableWeather(True)
各种天气效果可以使用simSetWeatherParameter
方法来实现,输入是一个参数结构体WeatherParameter
,例如:
client.simSetWeatherParameter(airsim.WeatherParameter.Rain, 0.25);
第二个参数取值范围是0-1,第一个参数有如下属性。
class WeatherParameter: Rain = 0 Roadwetness = 1 Snow = 2 RoadSnow = 3 MapleLeaf = 4 RoadLeaf = 5 Dust = 6 Fog = 7
注意 Roadwetness
, RoadSnow
和 RoadLeaf
效果需要自己添加 材质 。
具体细节可以参考对应示例文件。
4.6 坐标系统
All AirSim API uses NED coordinate system, i.e., +X is North, +Y is East and +Z is Down. All units are in SI system. Please note that this is different from coordinate system used internally by Unreal Engine. In Unreal Engine, +Z is up instead of down and length unit is in centimeters instead of meters. AirSim APIs takes care of the appropriate conversions. The starting point of the vehicle is always coordinates (0, 0, 0) in NED system. Thus when converting from Unreal coordinates to NED, we first subtract the starting offset and then scale by 100 for cm to m conversion. The vehicle is spawned in Unreal environment where the Player Start component is placed. There is a setting called OriginGeopoint in settings.json which assigns geographic longitude, longitude and altitude to the Player Start component.
(1) getMultirotorState
调用一次则返回一次无人机状态。该状态包括碰撞(collision)、估计运动学(estimated kinematics)(即通过融合传感器计算的运动学)和时间戳(timestamp)(从纪元开始的纳秒)。运动学包含6个量:位置(position)、方向(orientation)、线速度和角速度、线加速度和角加速度。请注意,simple_slight目前不支持状态估计器,这意味着对于simple_flight飞行,估计和地面真实运动学值是相同的。然而,除了角加速度,估计的运动学可用于PX4。所有的量都在NED坐标系中,除了角速度和加速度在body框架中之外,在世界坐标系中使用国际单位制。
————————————————