RM新时代网站-首页

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

基于Mobile SDK V4版固件開發(fā)大疆無(wú)人機(jī)手機(jī)端遙控器(3)

jf_Vqngj70R ? 來(lái)源:美男子玩編程 ? 2023-06-15 12:22 ? 次閱讀

第三篇文章準(zhǔn)備單獨(dú)拿出來(lái)寫,因?yàn)樵?a target="_blank">大疆為人機(jī)的所有功能中,航線規(guī)劃的功能最為復(fù)雜,也相當(dāng)?shù)姆爆?,這里需要說(shuō)仔細(xì)一點(diǎn),可能會(huì)將代碼進(jìn)行多步分解。

1航線規(guī)劃

航線打點(diǎn)

在地圖中手動(dòng)選擇點(diǎn)位選擇完成航線打點(diǎn);若打點(diǎn)位置錯(cuò)了可進(jìn)行點(diǎn)位刪除。

efff7e88-0b31-11ee-962d-dac502259ad0.png

航點(diǎn)設(shè)置

可對(duì)航線點(diǎn)位進(jìn)行設(shè)置,如飛行高度,速度(慢速:3m/s;中速: 7m/s;高速:10 m/s)、任務(wù)結(jié)束后操作及航向,點(diǎn)擊[設(shè)置]按鈕完成設(shè)置。

f05eb5ce-0b31-11ee-962d-dac502259ad0.png

設(shè)置完成后會(huì)顯示總距離及飛行總時(shí)間。

f0958e64-0b31-11ee-962d-dac502259ad0.png

航線上傳

點(diǎn)擊[上傳]按鈕,進(jìn)行航線上傳??梢赃M(jìn)入本地存儲(chǔ)中選擇航線文件進(jìn)行上傳,航線文件為 .kml結(jié)尾。

f0aeac32-0b31-11ee-962d-dac502259ad0.png

航線執(zhí)行

點(diǎn)擊 [開始]按鈕,則可對(duì)航線進(jìn)行執(zhí)行。若中途需要暫停也可點(diǎn)擊[暫停]安裝進(jìn)行暫停操作。

f0cd745a-0b31-11ee-962d-dac502259ad0.png

航線管理

按鈕即可進(jìn)入航線管理界面。

efff7e88-0b31-11ee-962d-dac502259ad0.pngf131a1aa-0b31-11ee-962d-dac502259ad0.png

獲取航線

點(diǎn)擊[獲取]按鈕,即可將航線信息展示到地圖界面中。

f131a1aa-0b31-11ee-962d-dac502259ad0.png

2主要功能代碼

創(chuàng)建activity_setting_route.xml及SettingRouteActivity文件。

activity_setting_route.xml
























SettingRouteActivity

publicclassSettingRouteActivityextendsBaseActivityimplementsAMap.OnMarkerClickListener,View.OnClickListener,AMap.OnMapClickListener,LocationSource,AMapLocationListener,AMap.InfoWindowAdapter{
@BindView(R.id.layout_route)
ViewmViewLayoutToolbar;
@BindView(R.id.ll_route)
LinearLayoutmLinearLayout;
@BindView(R.id.tv_toolbar_title)
TextViewmTextViewToolbarTitle;
//@BindView(R.id.map)
//MapViewmMapView;

@BindView(R.id.btn_delete)
ButtonmButtonDelete;
@BindView(R.id.btn_finish)
ButtonmButtonFinish;
@BindView(R.id.btn_setting)
ButtonmButtonSetting;
@BindView(R.id.btn_upload)
ButtonmButtonUpload;
@BindView(R.id.btn_start)
ButtonmButtonStart;
@BindView(R.id.btn_stop)
ButtonmButtonStop;

@BindView(R.id.ll_information)
LinearLayoutmLinearLayoutInformation;
@BindView(R.id.tv_height)
TextViewmTextViewHeight;
@BindView(R.id.tv_speed)
TextViewmTextViewSpeed;
@BindView(R.id.tv_count)
TextViewmTextViewCount;
@BindView(R.id.tv_distance)
TextViewmTextViewDistance;
@BindView(R.id.tv_time)
TextViewmTextViewTime;

privateMapViewmMapView;
privateOnLocationChangedListenermListener;
privateAMapLocationClientmlocationClient;
privateAMapLocationClientOptionmLocationOption;
privatedoubleD_latitude,D_longitude;
privateUiSettingsmUiSettings;
privateAMapaMap;
privateMarkerdroneMarker=null;

privatefloataltitude=100.0f;
privatefloatmSpeed=10.0f;

privatebooleanisAdd=false;

privatefinalMapmMarkers=newConcurrentHashMap();
privateMarkermClickMarker;
privateListwaypointList=newArrayList<>();
privateListmLatLng=newArrayList<>();
privateListmPointInfo=newArrayList<>();

publicstaticWaypointMission.BuilderwaypointMissionBuilder;
privateFlightControllermFlightController;
privateWaypointMissionOperatorinstance;
privateWaypointMissionFinishedActionmFinishedAction=WaypointMissionFinishedAction.NO_ACTION;
privateWaypointMissionHeadingModemHeadingMode=WaypointMissionHeadingMode.AUTO;

privateSQLiteHelpermSQLiteHelper;
privateStringFinishedAction,HeadingMode;

//自定義窗體
ViewinfoWindow=null;

intspeed_RG_id=0;
intactionAfterFinished_RG_id=0;
intheading_RG_id=0;

//kim
staticReadKmlreadKml=newReadKml();
privatestaticListsampleList=readKml.getCoordinateList();

@Override
publicvoidinitViews(){
mLinearLayout.setVisibility(View.VISIBLE);
mTextViewToolbarTitle.setText("航線規(guī)劃");
IntentFilterfilter=newIntentFilter();
filter.addAction(ReceiverApplication.FLAG_CONNECTION_CHANGE);
registerReceiver(mReceiver,filter);
mMapView=findViewById(R.id.map);
mMapView.onCreate(InstanceState);
initMapView();
addListener();
onProductConnectionChange();

}

@Override
protectedvoidonResume(){
super.onResume();
initFlightController();
mMapView.onResume();
}

/**
*方法必須重寫
*/
@Override
protectedvoidonSaveInstanceState(BundleoutState){
super.onSaveInstanceState(outState);
mMapView.onSaveInstanceState(outState);
}

@Override
protectedvoidonPause(){
super.onPause();
mMapView.onPause();
deactivate();
}

@Override
protectedvoidonDestroy(){
super.onDestroy();
unregisterReceiver(mReceiver);
removeListener();
mMapView.onDestroy();
if(null!=mlocationClient){
mlocationClient.onDestroy();
}

}

@Override
publicvoidinitDatas(){

}

@Override
protectedvoidrequestData(){

}

privatevoidinitMapView(){
if(aMap==null){
aMap=mMapView.getMap();
mUiSettings=aMap.getUiSettings();
mUiSettings.setMyLocationButtonEnabled(true);
mUiSettings.setScaleControlsEnabled(true);
aMap.setOnMapClickListener(this);//addthelistenerforclickforamapobject
aMap.setLocationSource(this);
aMap.setMyLocationEnabled(true);
aMap.setInfoWindowAdapter(this);
aMap.setOnMarkerClickListener(this);
setupLocationStyle();
}
}

privatevoidsetupLocationStyle(){
//自定義系統(tǒng)定位藍(lán)點(diǎn)
MyLocationStylemyLocationStyle=newMyLocationStyle();
//自定義定位藍(lán)點(diǎn)圖標(biāo)
myLocationStyle.myLocationIcon(BitmapDescriptorFactory.
fromResource(R.mipmap.icv_gps_point_36dp));
//自定義精度范圍的圓形邊框顏色
myLocationStyle.strokeColor(Color.parseColor("#00000000"));
//自定義精度范圍的圓形邊框?qū)挾?myLocationStyle.strokeWidth(5);
//設(shè)置圓形的填充顏色
myLocationStyle.radiusFillColor(Color.parseColor("#00000000"));
//將自定義的myLocationStyle對(duì)象添加到地圖上
aMap.setMyLocationStyle(myLocationStyle);
}

@OnClick({R.id.img_kml_input,R.id.img_setting_route,R.id.img_start_fly,R.id.btn_delete,
R.id.img_setting_clear,R.id.btn_finish,R.id.btn_setting,R.id.btn_upload,
R.id.btn_start,R.id.btn_stop,R.id.img_back})
@Override
publicvoidonClick(Viewv){
switch(v.getId()){
caseR.id.img_back:
SettingRouteActivity.this.finish();
break;
caseR.id.img_kml_input:
Intentintent=newIntent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");//設(shè)置類型,我這里是任意類型,任意后綴的可以這樣寫。
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent,MyStatic.REQUEST_CODE_FILE);
break;
caseR.id.img_setting_route:
enableDisableAdd();
break;
caseR.id.img_setting_clear:
runOnUiThread(newRunnable(){
@Override
publicvoidrun(){
aMap.clear();
mMarkers.clear();
mPointInfo.clear();
mLinearLayoutInformation.setVisibility(View.GONE);
mButtonFinish.setVisibility(View.GONE);
mButtonSetting.setVisibility(View.GONE);
mButtonUpload.setVisibility(View.GONE);
mButtonStart.setVisibility(View.GONE);
mButtonStop.setVisibility(View.GONE);
}
});
waypointList.clear();
waypointMissionBuilder.waypointList(waypointList);
break;
caseR.id.img_start_fly:
atyAction(WaypointActivity.class,MyStatic.REQUEST_CODE_ID);
break;
caseR.id.btn_delete:
runOnUiThread(newRunnable(){
@Override
publicvoidrun(){
aMap.clear();
}
});
for(inti=0;i-90&&latitude-180&&longitude0){
mLatLng.clear();
PolylineOptionsPolylineOptions=newPolylineOptions();
for(inti=0;i0){
PolylineOptionsPolylineOptions=newPolylineOptions();
PolylineOptions.addAll(mLatLng);
PolylineOptions.width(10);
PolylineOptions.color(Color.argb(255,1,1,1));
aMap.addPolyline(PolylineOptions);
}
waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
mTextViewCount.setText("航點(diǎn)數(shù):"+waypointMissionBuilder.getWaypointCount());
mTextViewDistance.setText("總距離:"+Math.round(waypointMissionBuilder.calculateTotalDistance())+"m");
mTextViewTime.setText("總時(shí)間:"+Math.round(waypointMissionBuilder.calculateTotalTime())+"min");
MyLog.d("航點(diǎn)數(shù):"+waypointMissionBuilder.getWaypointCount());
MyLog.d("總距離:"+waypointMissionBuilder.calculateTotalDistance());
MyLog.d("總時(shí)間:"+waypointMissionBuilder.calculateTotalTime());
mButtonDelete.setVisibility(View.GONE);
}


/**
*定位成功后回調(diào)函數(shù)
*/
@Override
publicvoidonLocationChanged(AMapLocationamapLocation){
if(mListener!=null&&amapLocation!=null){
if(amapLocation!=null
&&amapLocation.getErrorCode()==0){
D_latitude=amapLocation.getLatitude();//獲取緯度
D_longitude=amapLocation.getLongitude();//獲取經(jīng)度
mListener.onLocationChanged(amapLocation);//顯示系統(tǒng)小藍(lán)點(diǎn)
aMap.moveCamera(CameraUpdateFactory.zoomTo(18));
}else{
StringerrText="定位失敗,"+amapLocation.getErrorCode()+":"+amapLocation.getErrorInfo();
Log.e("AmapErr",errText);
}
}
}

@Override
publicvoidactivate(OnLocationChangedListenerlistener){
mListener=listener;
if(mlocationClient==null){
try{
mlocationClient=newAMapLocationClient(this);
}catch(Exceptione){
e.printStackTrace();
}
mLocationOption=newAMapLocationClientOption();
//設(shè)置定位監(jiān)聽
mlocationClient.setLocationListener(this);
//設(shè)置為高精度定位模式
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//設(shè)置定位參數(shù)
mLocationOption.setOnceLocation(true);
mlocationClient.setLocationOption(mLocationOption);
//此方法為每隔固定時(shí)間會(huì)發(fā)起一次定位請(qǐng)求,為了減少電量消耗或網(wǎng)絡(luò)流量消耗,
//注意設(shè)置合適的定位時(shí)間的間隔(最小間隔支持為2000ms),并且在合適時(shí)間調(diào)用stopLocation()方法來(lái)取消定位請(qǐng)求
//在定位結(jié)束后,在合適的生命周期調(diào)用onDestroy()方法
//在單次定位情況下,定位無(wú)論成功與否,都無(wú)需調(diào)用stopLocation()方法移除請(qǐng)求,定位sdk內(nèi)部會(huì)移除
mlocationClient.startLocation();
}
}

@Override
publicvoiddeactivate(){
mListener=null;
if(mlocationClient!=null){
mlocationClient.stopLocation();
mlocationClient.onDestroy();
}
mlocationClient=null;
}

@Override
publicViewgetInfoWindow(Markermarker){
if(infoWindow==null){
infoWindow=LayoutInflater.from(this).inflate(R.layout.amap_info_window,null);
}
render(marker,infoWindow);
returninfoWindow;
}

/**
*自定義infoWindow窗口
*/
privatevoidrender(Markermarker,ViewinfoWindow){
TextViewtitle=infoWindow.findViewById(R.id.info_window_title);
TextViewcontent=infoWindow.findViewById(R.id.info_window_content);
title.setText(marker.getTitle());
content.setText(marker.getSnippet());
}


@Override
publicViewgetInfoContents(Markermarker){
returnnull;
}

@Override
publicbooleanonMarkerClick(Markermarker){
marker.showInfoWindow();
mClickMarker=marker;
mButtonDelete.setVisibility(View.VISIBLE);
//aMap.moveCamera(CameraUpdateFactory.newCameraPosition(newCameraPosition(marker.getPosition(),18,0,0)));
returntrue;
}

privatevoidshowSettingDialog(){
LinearLayoutwayPointSettings=(LinearLayout)getLayoutInflater().inflate(R.layout.dialog_waypointsetting,null);

finalTextViewwpAltitude_TV=(TextView)wayPointSettings.findViewById(R.id.altitude);
RadioGroupspeed_RG=(RadioGroup)wayPointSettings.findViewById(R.id.speed);
RadioGroupactionAfterFinished_RG=(RadioGroup)wayPointSettings.findViewById(R.id.actionAfterFinished);
RadioGroupheading_RG=(RadioGroup)wayPointSettings.findViewById(R.id.heading);
wpAltitude_TV.setText(Math.round(altitude)+"");
if(speed_RG_id!=0){
RadioButtonradioButton=(RadioButton)speed_RG.findViewById(speed_RG_id);
radioButton.setChecked(true);
}
if(actionAfterFinished_RG_id!=0){
RadioButtonradioButton=(RadioButton)actionAfterFinished_RG.findViewById(actionAfterFinished_RG_id);
radioButton.setChecked(true);
}
if(heading_RG_id!=0){
RadioButtonradioButton=(RadioButton)heading_RG.findViewById(heading_RG_id);
radioButton.setChecked(true);
}
speed_RG.setOnCheckedChangeListener(newRadioGroup.OnCheckedChangeListener(){
@Override
publicvoidonCheckedChanged(RadioGroupgroup,intcheckedId){
if(checkedId==R.id.lowSpeed){
mSpeed=3.0f;
}elseif(checkedId==R.id.MidSpeed){
mSpeed=5.0f;
}elseif(checkedId==R.id.HighSpeed){
mSpeed=10.0f;
}
speed_RG_id=checkedId;
}

});

actionAfterFinished_RG.setOnCheckedChangeListener(newRadioGroup.OnCheckedChangeListener(){

@Override
publicvoidonCheckedChanged(RadioGroupgroup,intcheckedId){
MyLog.d("選擇動(dòng)作完成");
if(checkedId==R.id.finishNone){
mFinishedAction=WaypointMissionFinishedAction.NO_ACTION;
FinishedAction="0";
}elseif(checkedId==R.id.finishGoHome){
mFinishedAction=WaypointMissionFinishedAction.GO_HOME;
FinishedAction="1";
}elseif(checkedId==R.id.finishAutoLanding){
mFinishedAction=WaypointMissionFinishedAction.AUTO_LAND;
FinishedAction="2";
}elseif(checkedId==R.id.finishToFirst){
mFinishedAction=WaypointMissionFinishedAction.GO_FIRST_WAYPOINT;
FinishedAction="3";
}
actionAfterFinished_RG_id=checkedId;
}
});

heading_RG.setOnCheckedChangeListener(newRadioGroup.OnCheckedChangeListener(){
@Override
publicvoidonCheckedChanged(RadioGroupgroup,intcheckedId){
MyLog.d("選擇標(biāo)題");
if(checkedId==R.id.headingNext){
mHeadingMode=WaypointMissionHeadingMode.AUTO;
HeadingMode="0";
}elseif(checkedId==R.id.headingInitDirec){
mHeadingMode=WaypointMissionHeadingMode.USING_INITIAL_DIRECTION;
HeadingMode="1";
}elseif(checkedId==R.id.headingRC){
mHeadingMode=WaypointMissionHeadingMode.CONTROL_BY_REMOTE_CONTROLLER;
HeadingMode="2";
}elseif(checkedId==R.id.headingWP){
mHeadingMode=WaypointMissionHeadingMode.USING_WAYPOINT_HEADING;
HeadingMode="3";
}
heading_RG_id=checkedId;
}
});

newAlertDialog.Builder(this)
.setTitle("航點(diǎn)設(shè)置")
.setView(wayPointSettings)
.setNeutralButton("設(shè)置",newDialogInterface.OnClickListener(){
publicvoidonClick(DialogInterfacedialog,intid){
StringaltitudeString=wpAltitude_TV.getText().toString();
altitude=Integer.parseInt(nulltoIntegerDefalt(altitudeString));
MyLog.e("altitude"+altitude);
MyLog.e("speed"+mSpeed);
MyLog.e("mFinishedAction"+mFinishedAction);
MyLog.e("mHeadingMode"+mHeadingMode);
configWayPointMission();
}
})
.setCancelable(false)
.create()
.show();
}

StringnulltoIntegerDefalt(Stringvalue){
if(!isIntValue(value))
value="0";
returnvalue;
}

booleanisIntValue(Stringval){
try{
val=val.replace("","");
Integer.parseInt(val);
}catch(Exceptione){
returnfalse;
}
returntrue;
}

privatevoidconfigWayPointMission(){

if(waypointMissionBuilder==null){

waypointMissionBuilder=newWaypointMission.Builder().finishedAction(mFinishedAction)
.headingMode(mHeadingMode)
.autoFlightSpeed(mSpeed)
.maxFlightSpeed(mSpeed)
.flightPathMode(WaypointMissionFlightPathMode.NORMAL);

}else{
waypointMissionBuilder.finishedAction(mFinishedAction)
.headingMode(mHeadingMode)
.autoFlightSpeed(mSpeed)
.maxFlightSpeed(mSpeed)
.flightPathMode(WaypointMissionFlightPathMode.NORMAL);

}

if(waypointMissionBuilder.getWaypointList().size()>0){
for(inti=0;i-1){
refreshMapPoint(Id);
}
break;
case102:
if(data.getData()!=null){
Uriuri=data.getData();//得到uri,后面就是將uri轉(zhuǎn)化成file的過(guò)程。
Stringimg_path=uri.getPath();
try{
if(!TextUtils.isEmpty(img_path)){
readKml.parseKml(img_path);
addSampleMarker();
}
}catch(Exceptione){
e.printStackTrace();
}
}
break;
default:
break;
}

}

privatevoidrefreshMapPoint(intid){
aMap.clear();
mMarkers.clear();
mPointInfo.clear();
mLinearLayoutInformation.setVisibility(View.GONE);
mButtonFinish.setVisibility(View.GONE);
mButtonSetting.setVisibility(View.GONE);
mButtonUpload.setVisibility(View.GONE);
mButtonStart.setVisibility(View.GONE);
mButtonStop.setVisibility(View.GONE);
waypointList.clear();
mSQLiteHelper=newSQLiteHelper(SettingRouteActivity.this);
Cursorc=mSQLiteHelper.doSelectWaypoint(id);
if(c!=null){
if(c.moveToNext()){
MyLog.d("航點(diǎn):"+"{'pointInfo':"+c.getString(1)+"}");
mPointInfo.addAll(GsonUtil.GsonToBean("{'pointInfo':"+c.getString(1)+"}",Root.class).getPointInfo());
altitude=c.getFloat(2);
mSpeed=c.getFloat(3);
switch(c.getString(4)){
case"0":
mHeadingMode=WaypointMissionHeadingMode.AUTO;
break;
case"1":
mHeadingMode=WaypointMissionHeadingMode.USING_INITIAL_DIRECTION;
break;
case"2":
mHeadingMode=WaypointMissionHeadingMode.CONTROL_BY_REMOTE_CONTROLLER;
break;
case"3":
mHeadingMode=WaypointMissionHeadingMode.USING_WAYPOINT_HEADING;
break;
case"4":
mHeadingMode=WaypointMissionHeadingMode.TOWARD_POINT_OF_INTEREST;
break;
}
switch(c.getString(5)){
case"0":
mFinishedAction=WaypointMissionFinishedAction.NO_ACTION;
break;
case"1":
mFinishedAction=WaypointMissionFinishedAction.GO_HOME;
break;
case"2":
mFinishedAction=WaypointMissionFinishedAction.AUTO_LAND;
break;
case"3":
mFinishedAction=WaypointMissionFinishedAction.GO_FIRST_WAYPOINT;
break;
case"4":
mFinishedAction=WaypointMissionFinishedAction.CONTINUE_UNTIL_END;
break;
}
}
}
for(inti=0;i0){
mLatLng.clear();
PolylineOptionsPolylineOptions=newPolylineOptions();
for(inti=0;i0){
for(inti=0;i

3

航線管理

創(chuàng)建activity_waypoint.xml和WaypointActivity文件。

activity_waypoint.xml






WaypointActivity

@Layout(R.layout.activity_waypoint)
publicclassWaypointActivityextendsBaseActivityimplementsView.OnClickListener{
@BindView(R.id.layout_waypoint)
ViewmViewLayoutToolbar;
@BindView(R.id.ll_waypoint)
LinearLayoutmLinearLayout;
@BindView(R.id.tv_toolbar_title)
TextViewmTextViewToolbarTitle;
@BindView(R.id.rv_waypoint)
RecyclerViewmRecyclerView;

privateSQLiteHelpermSQLiteHelper;
privateListmWaypointInfo=newArrayList<>();
privateWaypointAdaptermWaypointAdapter;

privateListmWaypointId=newArrayList<>();
privateStringStrId="";

@Override
publicvoidinitViews(){
mLinearLayout.setVisibility(View.VISIBLE);
mTextViewToolbarTitle.setText("航線管理");
MyStatic.isChoose=false;
}

@Override
publicvoidinitDatas(){
mSQLiteHelper=newSQLiteHelper(WaypointActivity.this);
Cursorc=mSQLiteHelper.doSelect();
if(c!=null){
while(c.moveToNext()){
mWaypointInfo.add(newWaypointInfo(c.getInt(0),c.getString(1),c.getFloat(2),c.getFloat(3),
c.getString(4),c.getString(5),c.getString(6),c.getInt(7),c.getInt(8),
c.getInt(9),c.getString(10)));
}
}
c.close();
mSQLiteHelper.close();
mWaypointAdapter=newWaypointAdapter(R.layout.item_waypoint);
mWaypointAdapter.setNewData(mWaypointInfo);
initRv(mRecyclerView,mWaypointAdapter);
mWaypointAdapter.setOnItemChildClickListener(newBaseQuickAdapter.OnItemChildClickListener(){
@Override
publicvoidonItemChildClick(BaseQuickAdapteradapter,Viewview,intposition){
Intentintent=newIntent();
intent.putExtra("id",mWaypointInfo.get(position).getId());
setResult(RESULT_OK,intent);
finish();
}
});
mWaypointAdapter.setOnCheckboxCheckedListener(newWaypointAdapter.OnCheckboxCheckedListener(){
@Override
publicvoidOnCheckboxChecked(booleanisCheck,intposition){
if(isCheck){
mWaypointId.add(position);
}else{
if(mWaypointId.contains(position)){
mWaypointId.remove(position);
}
}
}
});

}

@Override
protectedvoidrequestData(){

}

@OnClick({R.id.img_way_choose,R.id.img_way_delete,R.id.img_back})
@Override
publicvoidonClick(Viewv){
switch(v.getId()){
caseR.id.img_way_choose:
if(MyStatic.isChoose){
MyStatic.isChoose=false;
}else{
MyStatic.isChoose=true;
}
if(mWaypointAdapter!=null){
mWaypointAdapter.notifyDataSetChanged();
}
break;
caseR.id.img_way_delete:
if(mWaypointId.size()>0){
for(inti=0;i

以上代碼僅供參考,如果想了解更多的大疆無(wú)人機(jī)二次開發(fā)過(guò)程可以私信我,源代碼因?yàn)樯婕暗缴虡I(yè)使用不能給大家共享,有什么問(wèn)題我可以幫你解決。

審核編輯:湯梓紅

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • Mobile
    +關(guān)注

    關(guān)注

    0

    文章

    518

    瀏覽量

    26483
  • 遙控器
    +關(guān)注

    關(guān)注

    18

    文章

    836

    瀏覽量

    66053
  • 無(wú)人機(jī)
    +關(guān)注

    關(guān)注

    229

    文章

    10420

    瀏覽量

    180109
  • SDK
    SDK
    +關(guān)注

    關(guān)注

    3

    文章

    1035

    瀏覽量

    45897
  • 大疆無(wú)人機(jī)
    +關(guān)注

    關(guān)注

    13

    文章

    111

    瀏覽量

    30207

原文標(biāo)題:基于Mobile SDK V4版固件開發(fā)大疆無(wú)人機(jī)手機(jī)端遙控器(3)

文章出處:【微信號(hào):美男子玩編程,微信公眾號(hào):美男子玩編程】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。

收藏 人收藏

    評(píng)論

    相關(guān)推薦

    拆解大Mavic Air2無(wú)人機(jī)配套遙控器

    Mavic Air2遙控器內(nèi)部多使用螺絲或卡扣固定部件,伸縮式天線一體化手機(jī)支架將原來(lái)位于遙控器下方的手機(jī)移到了手機(jī)上方,方便觀察
    的頭像 發(fā)表于 07-21 13:37 ?2.8w次閱讀
    拆解大<b class='flag-5'>疆</b>Mavic Air2<b class='flag-5'>無(wú)人機(jī)</b>配套<b class='flag-5'>遙控器</b>

    【Aworks申請(qǐng)】開放式無(wú)人機(jī)地面基站

    申請(qǐng)理由:我們是在校大學(xué)生EDA興趣團(tuán)隊(duì),正在設(shè)計(jì)制作無(wú)人機(jī)項(xiàng)目。我們發(fā)現(xiàn),現(xiàn)在無(wú)人機(jī)只能通過(guò)遙控器或者電腦上位機(jī)控制飛行。所以,我們?cè)噲D開發(fā)一個(gè)通用式地面基站,開放API和視頻數(shù)據(jù)流
    發(fā)表于 06-27 08:59

    【云智易申請(qǐng)】智能無(wú)人機(jī)通信

    申請(qǐng)理由:本次項(xiàng)目是基于STM32做無(wú)人機(jī),主要用WiFi實(shí)現(xiàn)無(wú)人機(jī)遙控器之間通信,無(wú)人機(jī)的電機(jī)我們可以用云智易開發(fā)板上面的電機(jī)進(jìn)行調(diào)試,
    發(fā)表于 08-07 11:02

    無(wú)人機(jī)遙控方向控制問(wèn)題

    前段時(shí)間我弟弟買了個(gè)遙控無(wú)人機(jī)玩具,但是我發(fā)現(xiàn)一個(gè)問(wèn)題。該無(wú)人機(jī)方向控制有問(wèn)題,假設(shè)無(wú)人機(jī)有四個(gè)電機(jī),分別為A,B,C,D,遙控器四個(gè)按鍵1
    發(fā)表于 05-10 11:26

    stm32四軸無(wú)人機(jī)遙控器資料

    stm32四軸無(wú)人機(jī)遙控器資料
    發(fā)表于 06-09 23:16

    無(wú)人機(jī)怎么懸停

    `  誰(shuí)能闡述下大無(wú)人機(jī)怎么懸停?`
    發(fā)表于 08-27 15:13

    【快速上手教程6】瘋殼·開源編隊(duì)無(wú)人機(jī)-遙控器固件燒寫

    COCOFLY 教程——瘋殼·無(wú)人機(jī)·系列遙控器固件燒寫 圖1 一、遙控器固件燒寫 這里的固件
    發(fā)表于 05-25 11:49

    【快速上手教程6】瘋殼·開源編隊(duì)無(wú)人機(jī)-遙控器固件燒寫

    COCOFLY 教程——瘋殼·無(wú)人機(jī)·系列遙控器固件燒寫 圖1 一、遙控器固件燒寫 這里的固件
    發(fā)表于 07-07 10:05

    【瘋殼·無(wú)人機(jī)教程6】開源編隊(duì)無(wú)人機(jī)-遙控器固件燒寫

    COCOFLY 教程——瘋殼·無(wú)人機(jī)·系列遙控器固件燒寫圖1 一、遙控器固件燒寫 這里的固件
    發(fā)表于 08-23 17:49

    CES 2019:大推出帶屏無(wú)人機(jī)遙控器 便攜式無(wú)線電源Yoolox亮相

    現(xiàn)如今航拍已成為年輕人的拍攝興趣,但智能手機(jī)好像并不是最理想控制航拍的遙控器。作為無(wú)人機(jī)生產(chǎn)廠家,大在今年的國(guó)際消費(fèi)類電子產(chǎn)品展覽會(huì)上展出了專為Mavic 2航拍
    的頭像 發(fā)表于 01-10 16:16 ?8036次閱讀

    音圈馬達(dá)裝置在大無(wú)人機(jī)的應(yīng)用

    音圈馬達(dá)助力的大將發(fā)布多款新品,大家都知道大是一家專業(yè)生產(chǎn)無(wú)人機(jī)的廠家,就在近日,大新公布的一份專利文件中,發(fā)現(xiàn)大已經(jīng)申請(qǐng)了一款新的
    發(fā)表于 08-31 15:55 ?731次閱讀

    基于Mobile SDK V4固件開發(fā)無(wú)人機(jī)手機(jī)遙控器(1)

    剛剛結(jié)束了項(xiàng)目交付,趁熱打鐵分享一下這次遇到的新東西。首先了解一下大無(wú)人機(jī),它大致可以分為三級(jí)。
    的頭像 發(fā)表于 06-07 09:53 ?1148次閱讀
    基于<b class='flag-5'>Mobile</b> <b class='flag-5'>SDK</b> <b class='flag-5'>V4</b>版<b class='flag-5'>固件</b><b class='flag-5'>開發(fā)</b>大<b class='flag-5'>疆</b><b class='flag-5'>無(wú)人機(jī)手機(jī)</b><b class='flag-5'>端</b><b class='flag-5'>遙控器</b>(1)

    基于Mobile SDK V4固件開發(fā)無(wú)人機(jī)手機(jī)遙控器(2)

    上一篇文章(基于Mobile SDK V4固件開發(fā)無(wú)人
    的頭像 發(fā)表于 06-09 11:33 ?982次閱讀
    基于<b class='flag-5'>Mobile</b> <b class='flag-5'>SDK</b> <b class='flag-5'>V4</b>版<b class='flag-5'>固件</b><b class='flag-5'>開發(fā)</b>大<b class='flag-5'>疆</b><b class='flag-5'>無(wú)人機(jī)手機(jī)</b><b class='flag-5'>端</b><b class='flag-5'>遙控器</b>(2)

    基于Mobile SDK V5版固件開發(fā)無(wú)人機(jī)手機(jī)遙控器(4)

    相較與V4版本開發(fā),V5版本有了更方便簡(jiǎn)介的方式。V5不僅再功能上與V4增加更多的功能,而且在功能的使用及API的調(diào)用也做了優(yōu)化。雖然
    的頭像 發(fā)表于 06-25 12:24 ?2574次閱讀
    基于<b class='flag-5'>Mobile</b> <b class='flag-5'>SDK</b> <b class='flag-5'>V</b>5版<b class='flag-5'>固件</b><b class='flag-5'>開發(fā)</b>大<b class='flag-5'>疆</b><b class='flag-5'>無(wú)人機(jī)手機(jī)</b><b class='flag-5'>端</b><b class='flag-5'>遙控器</b>(<b class='flag-5'>4</b>)

    基于Mobile SDK V5版固件開發(fā)無(wú)人機(jī)手機(jī)遙控器(5)

    v5.x版本的功能與v4.x基本相同,都是獲取飛機(jī)的姿態(tài)信息、獲取無(wú)人機(jī)多媒體文件、操作多媒體文件、航線規(guī)劃等。不過(guò)在上一章節(jié)中也大致說(shuō)了一些兩個(gè)版本的中API的差別,下面是根據(jù)一些API使用所完成的一些功能,因?yàn)轫?xiàng)目原因只能提
    的頭像 發(fā)表于 07-07 12:21 ?2301次閱讀
    基于<b class='flag-5'>Mobile</b> <b class='flag-5'>SDK</b> <b class='flag-5'>V</b>5版<b class='flag-5'>固件</b><b class='flag-5'>開發(fā)</b>大<b class='flag-5'>疆</b><b class='flag-5'>無(wú)人機(jī)手機(jī)</b><b class='flag-5'>端</b><b class='flag-5'>遙控器</b>(5)
    RM新时代网站-首页