DroneKit简单的起飞不起作用

时间:2017-04-26 13:27:41

标签: dronekit dronekit-android 3dr

我试图制作一个简单的{ "size": 1, "from": 0, "query": { "bool": { "must": [ { "match": { "status": "active" }}, { "match": { "last_action_state": "accepted" }} ], "filter": [ {"missing" : { "field" : "store_id" }}, { "range": { "list_time": { "gte": "2017/01/01 00:00:00", "lte": "2017/03/01 23:59:59", "format": "yyyy/MM/dd HH:mm:ss"}}} ] } } } 命令。

以下是代码:

{
  "avindex_v3": {
    "aliases": {
      "avindex": {}
    },
    "mappings": {
      "ads": {
        "properties": {
          "account_id": {
            "type": "long"
          },
          "ad_id": {
            "type": "long"
          },
          "ad_params": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "category": {
            "type": "long"
          },
          "city": {
            "type": "long"
          },
          "company_ad": {
            "type": "boolean"
          },
          "email": {
            "type": "string"
          },
          "images": {
            "type": "string"
          },
          "lang": {
            "type": "string"
          },
          "last_action_state": {
            "type": "string"
          },
          "list_date": {
            "type": "long"
          },
          "list_id": {
            "type": "long"
          },
          "list_time": {
            "type": "string"
          },
          "modified_at": {
            "type": "string"
          },
          "modified_ts": {
            "type": "double"
          },
          "name": {
            "type": "string"
          },
          "orig_date": {
            "type": "long"
          },
          "orig_list_time": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "phone_hidden": {
            "type": "boolean"
          },
          "price": {
            "type": "long"
          },
          "region": {
            "type": "long"
          },
          "status": {
            "type": "string"
          },
          "store_id": {
            "type": "long"
          },
          "subject": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "user_id": {
            "type": "long"
          }
        }
      }
    },
    "settings": {
      "index": {
        "creation_date": "1493216710928",
        "number_of_shards": "5",
        "number_of_replicas": "1",
        "uuid": "WEHGLF8iRyGk3Xgbmo7H8Q",
        "version": {
          "created": "2040499"
        }
      }
    },
    "warmers": {}
  }
}

虽然我正在管理ARM直升机,但是起飞命令总是返回错误,Takeoff 3或4 我不知道这意味着什么? 任何人都有ControlApi.getApi(this.drone).takeoff(10, new AbstractCommandListener() { @Override public void onSuccess() { } @Override public void onError(int executionError) { alertUser("Error: " + executionError); } @Override public void onTimeout() { alertUser("timeout"); } }); 代码含义? 或者也许知道问题是什么?

1 个答案:

答案 0 :(得分:1)

<强> [解决] 即可。 以下是为使代码正常工作所需采取的步骤:

<强> 1

VehicleApi.getApi(this.drone).arm(true, new AbstractCommandListener() {
            @Override
            public void onSuccess() {

            }

            @Override
            public void onError(int executionError) {

            }

            @Override
            public void onTimeout() {

            }
        });

确保您使用onSuccess方法获得适当的回复。

<强> 2

VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_GUIDED);

这是我的问题所在。我以某种方式设法把直升机放在Guided_NoGps 根据Arducopter的文档,这种模式可以在没有足够的GPS卫星计数​​的情况下进行。 您还需要GPS中的3DFix才能切换到Guided模式。 你需要确保你有超过9个稳定的卫星锁或者这个代码不起作用。

第3

运行以下代码

ControlApi.getApi(this.drone).takeoff(10, new AbstractCommandListener() {
            @Override
            public void onSuccess() {

            }

            @Override
            public void onError(int executionError) {
                alertUser("Error: " + executionError);
            }

            @Override
            public void onTimeout() {

                alertUser("timeout");

            }
        });

我在基于PX4控制器的真正四轮直升机上进行了测试。 您还需要ArduCopter版本3.4(或更高版本)