|
| __init__ (self) |
| 构造函数,初始化ReqCopterSim类的实例。 开始监听20005端口以获取CopterID的 RflyTimeStmp
|
|
| getLocalIp (self) |
| 获取本地IP地址。
|
|
| isValidIp (self, address) |
| 检查给定的IP地址是否有效。
|
|
| get_all_ip (self) |
| 获取本机所有 IP 地址
|
|
| isIpLocal (self, IP) |
| 判断IP地址是否为本地IP
|
|
| updateSimMsg (self) |
| 更新模拟消息。
|
|
| getSimIpList (self) |
| 获取CopterSim IP列表。
|
|
| getSimIpID (self, CopterID=1) |
| 根据CopterID获取其IP地址。
|
|
| getHostIP (self) |
| 获取主机IP地址。
|
|
| sendReCopterSim (self, CopterID=1, isReqIP=1, UDP_mode=-1, isXyYaw=0, xyYaw=[0, 0, 0], isZRP=0, zRollPitch=[0, 0, 0], otherParams=[0, 0, 0, 0]) |
| 请求初始化指定的CopterSim。
|
|
| sendReDllMap (self, CopterID=0, dllOrMap=-1, index=-1, name='') |
| 请求更改CopterSim的DLL模型和地图。
|
|
| sendReSimDllName (self, CopterID=1, name='') |
| 请求通过名称更改CopterSim的DLL模型。
|
|
| sendReSimDllIdx (self, CopterID=1, index=-1) |
| 请求通过索引更改CopterSim的DLL模型。
|
|
| sendReSimMapName (self, CopterID=1, name='') |
| 请求通过名称更改CopterSim的地图。
|
|
| sendReSimMapIdx (self, CopterID=1, index=-1) |
| 请求通过索引更改CopterSim的地图。
|
|
| sendReSimIP (self, CopterID=1) |
| 请求指定的CopterSim向主机计算机发送数据。
|
|
| sendReSimUdpMode (self, CopterID=1, UDP_mode=-1) |
| 请求指定的CopterSim将UDP模式更改为指定的值。
|
|
| sendReSimXYyaw (self, CopterID=1, xyYaw=[0, 0, 0]) |
| 请求指定的CopterSim将xyYaw更改为指定的值。
|
|
| sendReGPSOrin (self, CopterID=1, LLA=[0, 0, 0]) |
| 请求指定的CopterSim将GPS原点更改为指定的值。
|
|
| sendReGPSPos (self, CopterID=1, lat=0, lon=0, yaw=0) |
| 请求指定的CopterSim将位置更改为指定的GPS值。
|
|
| sendEnGpsMode (self, CopterID=1) |
| 请求指定的CopterSim切换到GPS显示模式。
|
|
| sendEnXyMode (self, CopterID=1) |
| 请求指定的CopterSim切换到xy显示模式。
|
|
| sendReSimXyzRPYaw (self, CopterID=1, Xyz=[0, 0, 0], RPYaw=[0, 0, 0]) |
| 请求指定的CopterSim将Xyz和RollPitchYaw更改为指定的值。
|
|
sendReCopterSim |
( |
| self, |
|
|
| CopterID = 1, |
|
|
| isReqIP = 1, |
|
|
| UDP_mode = -1, |
|
|
| isXyYaw = 0, |
|
|
| xyYaw = [0,0,0], |
|
|
| isZRP = 0, |
|
|
| zRollPitch = [0,0,0], |
|
|
| otherParams = [0,0,0,0] ) |
请求初始化指定的CopterSim。
- 参数
-
CopterID | 要发送命令的Copter的ID。默认值为1。 |
isReqIP | 表示是否进行IP请求。小于等于0表示不发响应,大于0表示将进行请求。默认值为1。 |
UDP_mode | 设置UDP模式。小于0表示不发响应,大于等于0将UDP模式设置为指定值。默认值为-1。 |
isXyYaw | 表示是否使用XY和Yaw值。小于等于0表示不发响应,大于0表示将使用这些值。默认值为0。 |
xyYaw | 一个列表,包含XY坐标和Yaw角度。默认值为[0, 0, 0]。 |
isZRP | 表示是否使用Z、Roll和Pitch值。小于等于0表示不发响应,大于0表示将使用这些值。默认值为0。 |
zRollPitch | 一个列表,包含Z、Roll和Pitch值。默认值为[0, 0, 0]。 |
otherParams | 一个列表,用于保留未来使用的其他参数。默认值为[0, 0, 0, 0]。 |
此方法根据指定的参数构建一条消息,并将其发送到指定的Copter。
如果isReqIP
大于0且Copter的IP地址为127.0.0.1
,则将isReqIP
的值设置为0。 消息然后发送到组播地址224.0.0.10
上的端口20002
。如果isFalseMulti
为真且Copter的IP地址不为空, 则消息还将直接发送到Copter的IP地址上的端口20002
。
struct reCopterSimMsg{
int checksum; //数据校验位1234567,用于校验数据是否正确
int CopterID;// 请求的CopterID,用于校验请求是否正确。
int8_t isReqIP; //如果<=0则不响应,如果>0则勾选联机勾选,且将飞控数据发给本电脑IP(发送本请求消息的电脑)
int8_t isXyYaw; //如果<=0则不响应,如果>0,则使用后面xyYaw的值,重新部署飞机位置
int8_t isZRP; // 如果<=0则不响应(默认z会贴合地形,rollPitch会变为0),如果>0,则使用zRollPitch的值部署飞机位姿。本接口可以让飞机初始化在空中
int8_t UDP_mode; //如果<0,则不响应。如果>=0,则修改UDP模式为指定值。
uint8_t otherParams[4]; //保留位其他参数,留给将来使用。
float zRollPitch[3]; //zRollPitch的初始值,单位米和度,z向下为正
float yaw;// 初始偏航角,单位度
double xy[2]; // 初始xy的值,支持双精度大地图,单位米,北东地
}; //2i4b4B4f2d
if isXyYaw==2: configure GPS Origin through lat: xy[0] lon: xy[1] alt: yaw
if isXyYaw==3: configure GPS pos through lat: xy[0] lon: xy[1] yaw