This commit is contained in:
parent
d18b4cd7b8
commit
419230fa7e
|
|
@ -9,10 +9,7 @@ public enum CommandType {
|
||||||
*/
|
*/
|
||||||
TAKE_OFF,
|
TAKE_OFF,
|
||||||
|
|
||||||
/**
|
|
||||||
* 降落
|
|
||||||
*/
|
|
||||||
LAND,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返航
|
* 返航
|
||||||
|
|
|
||||||
|
|
@ -50,20 +50,12 @@ public class DjiVendorConfig implements VendorConfig {
|
||||||
StopState stopState = currentStates.getStopState();
|
StopState stopState = currentStates.getStopState();
|
||||||
|
|
||||||
switch (commandType) {
|
switch (commandType) {
|
||||||
case TAKE_OFF:
|
|
||||||
// 未知状态或离线状态且未急停时可以起飞
|
|
||||||
return (droneState == DroneState.UNKNOWN || droneState == DroneState.ONLINE) &&
|
|
||||||
stopState != StopState.ENTERED;
|
|
||||||
|
|
||||||
case LAND:
|
case TAKE_OFF:
|
||||||
// 飞行中、到达目的地状态可以降落(急停状态不能降落)
|
return droneState == DroneState.ONLINE ;
|
||||||
return (droneState == DroneState.FLYING || droneState == DroneState.ARRIVED) &&
|
|
||||||
stopState != StopState.ENTERED;
|
|
||||||
|
|
||||||
case RETURN_HOME:
|
case RETURN_HOME:
|
||||||
// 飞行中、到达目的地可以返航(急停状态不能返航)
|
return droneState == DroneState.FLYING ;
|
||||||
return (droneState == DroneState.FLYING || droneState == DroneState.ARRIVED) &&
|
|
||||||
stopState != StopState.ENTERED;
|
|
||||||
|
|
||||||
case EMERGENCY_STOP:
|
case EMERGENCY_STOP:
|
||||||
// 飞行中、返航中可以急停(未处于急停状态)
|
// 飞行中、返航中可以急停(未处于急停状态)
|
||||||
|
|
@ -139,11 +131,7 @@ public class DjiVendorConfig implements VendorConfig {
|
||||||
.setTimeout(90000);
|
.setTimeout(90000);
|
||||||
transactionMap.put(CommandType.TAKE_OFF, takeOffTransaction);
|
transactionMap.put(CommandType.TAKE_OFF, takeOffTransaction);
|
||||||
|
|
||||||
// 降落命令
|
|
||||||
Transaction landTransaction = new Transaction("降落", CommandType.LAND)
|
|
||||||
.addInstruction(new DjiLandInstruction())
|
|
||||||
.setTimeout(90000);
|
|
||||||
transactionMap.put(CommandType.LAND, landTransaction);
|
|
||||||
|
|
||||||
// 返航命令
|
// 返航命令
|
||||||
Transaction returnHomeTransaction = new Transaction("返航", CommandType.RETURN_HOME)
|
Transaction returnHomeTransaction = new Transaction("返航", CommandType.RETURN_HOME)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue