• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Drone类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.o3dr.android.client.Drone的典型用法代码示例。如果您正苦于以下问题:Java Drone类的具体用法?Java Drone怎么用?Java Drone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Drone类属于com.o3dr.android.client包,在下文中一共展示了Drone类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: goToDroneLocation

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Override
public void goToDroneLocation() {
    Drone dpApi = getDroneApi();
    if (!dpApi.isConnected())
        return;

    Gps gps = dpApi.getGps();
    if (!gps.isValid()) {
        Toast.makeText(getActivity().getApplicationContext(), R.string.drone_no_location, Toast.LENGTH_SHORT).show();
        return;
    }

    final float currentZoomLevel = getBaiduMap().getMapStatus().zoom;
    final LatLong droneLocation = gps.getPosition();
    updateCamera(droneLocation, (int) currentZoomLevel);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:17,代码来源:BaiduMapFragment.java


示例2: updateItemView

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Override
public void updateItemView(final Context context, final Drone drone) {
	if (mItemView != null) {

		final String update;
		if (drone == null || !drone.isConnected()) {
			update = "--";
		} else{
                  Gps droneGps = drone.getGps();
                  if (mAppPrefs.shouldGpsHdopBeDisplayed()) {
                      update = String.format(Locale.ENGLISH, "Satellite\n%d, %.1f", droneGps
                              .getSatellitesCount(), droneGps.getGpsEph());
                  } else {
                      update = String.format(Locale.ENGLISH, "Satellite\n%d, %s", droneGps
                              .getSatellitesCount(), droneGps.getFixStatus());
                  }
              }

		((TextView) mItemView).setText(update);
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:22,代码来源:InfoBarItem.java


示例3: proceedWithCalibration

import com.o3dr.android.client.Drone; //导入依赖的package包/类
private void proceedWithCalibration(@CompassCalibrationStep int step) {
    final Drone drone = getDrone();
    if(drone == null || !drone.isConnected()){
        //TODO: send a message to the notification handler for toast and voice
        Toast.makeText(getContext(), "Please connect drone before proceeding.", Toast.LENGTH_LONG).show();
        return;
    }

    switch (step) {
        case STEP_BEGIN_CALIBRATION:
        case STEP_CALIBRATION_FAILED:
        case STEP_CALIBRATION_CANCELLED:
            startCalibration();
            break;

        case STEP_CALIBRATION_SUCCESSFUL:
            startActivity(new Intent(getContext(), FlightActivity.class));
            break;

        case STEP_CALIBRATION_STARTED:
        case STEP_CALIBRATION_WAITING_TO_START:
        default:
            //nothing to do
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:27,代码来源:FragmentSetupCompass.java


示例4: enableFollowMe

import com.o3dr.android.client.Drone; //导入依赖的package包/类
private void enableFollowMe(final Drone drone) {
    if(drone == null)
        return;

    final LocationRequest locationReq = LocationRequest.create()
            .setPriority(FOLLOW_LOCATION_PRIORITY)
            .setFastestInterval(FOLLOW_LOCATION_UPDATE_FASTEST_INTERVAL)
            .setInterval(FOLLOW_LOCATION_UPDATE_INTERVAL)
            .setSmallestDisplacement(FOLLOW_LOCATION_UPDATE_MIN_DISPLACEMENT);

    final CheckLocationSettings locationSettingsChecker = new CheckLocationSettings(getActivity(), locationReq,
            new Runnable() {
                @Override
                public void run() {
                    FollowApi.getApi(drone).enableFollowMe(getAppPrefs().getLastKnownFollowType());
                }
            });

    locationSettingsChecker.check();
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:21,代码来源:BaseFlightControlFragment.java


示例5: getTakeOffInAutoConfirmation

import com.o3dr.android.client.Drone; //导入依赖的package包/类
private void getTakeOffInAutoConfirmation() {
    final SlideToUnlockDialog unlockDialog = SlideToUnlockDialog.newInstance("take off in auto", new Runnable() {
        @Override
        public void run() {

            final double takeOffAltitude = getAppPrefs().getDefaultAltitude();

            final Drone drone = getDrone();
            ControlApi.getApi(drone).takeoff(takeOffAltitude, new SimpleCommandListener() {
                @Override
                public void onSuccess() {
                    VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_AUTO);
                }
            });
        }
    });
    unlockDialog.show(getChildFragmentManager(), "Slide to take off in auto");
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:19,代码来源:CopterFlightControlFragment.java


示例6: onReceive

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    if (AttributeEvent.STATE_DISCONNECTED.equals(action)) {
        updateMavlinkVersionPreference(null);
        updateFirmwareVersionPreference(null);
    } else if (AttributeEvent.HEARTBEAT_FIRST.equals(action)
            || AttributeEvent.HEARTBEAT_RESTORED.equals(action)) {
        int mavlinkVersion = intent.getIntExtra(AttributeEventExtra.EXTRA_MAVLINK_VERSION, -1);
        if (mavlinkVersion == -1)
            updateMavlinkVersionPreference(null);
        else
            updateMavlinkVersionPreference(String.valueOf(mavlinkVersion));
    } else if (AttributeEvent.TYPE_UPDATED.equals(action)) {
        Drone drone = dpApp.getDrone();
        if (drone.isConnected()) {
            updateFirmwareVersionPreference(drone.getType().getFirmwareVersion());
        } else
            updateFirmwareVersionPreference(null);
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:22,代码来源:SettingsFragment.java


示例7: updateFlightModeButtons

import com.o3dr.android.client.Drone; //导入依赖的package包/类
private void updateFlightModeButtons() {
    resetFlightModeButtons();

    final Drone drone = getDrone();
    final State droneState = drone.getAttribute(AttributeType.STATE);
    final VehicleMode flightMode = droneState.getVehicleMode();
    if (flightMode != null) {
        switch (flightMode) {
            case PLANE_AUTO:
                autoBtn.setActivated(true);
                break;

            case PLANE_GUIDED:
                final GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
                final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
                if (guidedState.isInitialized() && !followState.isEnabled()) {
                    pauseBtn.setActivated(true);
                }
                break;

            case PLANE_RTL:
                homeBtn.setActivated(true);
                break;
        }
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:27,代码来源:PlaneFlightControlFragment.java


示例8: onApiConnected

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Override
public void onApiConnected() {
    Drone drone = dpApp.getDrone();
    State droneState = drone.getState();
    Type droneType = drone.getType();
    final int mavlinkVersion = droneState == null
            ? State.INVALID_MAVLINK_VERSION
            : droneState.getMavlinkVersion();

    if (mavlinkVersion != State.INVALID_MAVLINK_VERSION) {
        updateMavlinkVersionPreference(String.valueOf(mavlinkVersion));
    } else {
        updateMavlinkVersionPreference(null);
    }

    String firmwareVersion = droneType == null ? null : droneType.getFirmwareVersion();
    updateFirmwareVersionPreference(firmwareVersion);

    LocalBroadcastManager.getInstance(getActivity().getApplicationContext()).registerReceiver(
            broadcastReceiver, intentFilter);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:22,代码来源:SettingsFragment.java


示例9: onGuidedClick

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Override
public void onGuidedClick(LatLong coord) {
    final Drone drone = getDrone();
    final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
    if (followState != null && followState.isEnabled() && followState.getMode().hasParam(FollowType.EXTRA_FOLLOW_ROI_TARGET)) {
        Toast.makeText(getContext(), R.string.guided_scan_roi_set_message, Toast.LENGTH_LONG).show();

        final double roiHeight = roiHeightWheel.getCurrentValue().toBase().getValue();
        final LatLongAlt roiCoord = new LatLongAlt(coord.getLatitude(), coord.getLongitude(), roiHeight);

        pushROITargetToVehicle(drone, roiCoord);
        updateROITargetMarker(coord);
    } else {
        super.onGuidedClick(coord);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:17,代码来源:ModeFollowFragment.java


示例10: writeModifiedParametersToDrone

import com.o3dr.android.client.Drone; //导入依赖的package包/类
private void writeModifiedParametersToDrone() {
    final Drone drone = getDrone();
    if (!drone.isConnected())
        return;

    final int adapterCount = adapter.getCount();
    List<Parameter> parametersList = new ArrayList<Parameter>(adapterCount);
    for (int i = 0; i < adapterCount; i++) {
        final ParamsAdapterItem item = adapter.getItem(i);
        if (!item.isDirty())
            continue;

        parametersList.add(item.getParameter());
        item.commit();
    }

    final int parametersCount = parametersList.size();
    if (parametersCount > 0) {
        VehicleApi.getApi(drone).writeParameters(new Parameters(parametersList));
        adapter.notifyDataSetChanged();
        Toast.makeText(getActivity(),
                parametersCount + " " + getString(R.string.msg_parameters_written_to_drone),
                Toast.LENGTH_SHORT).show();
    }
    snackbar = null;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:27,代码来源:ParamsFragment.java


示例11: updateFlightModeButtons

import com.o3dr.android.client.Drone; //导入依赖的package包/类
private void updateFlightModeButtons() {
	resetFlightModeButtons();

	final Drone drone = getDrone();
	final VehicleMode flightMode = drone.getState().getVehicleMode();
       if(flightMode != null) {
           switch (flightMode) {
               case PLANE_AUTO:
                   autoBtn.setActivated(true);
                   break;

               case PLANE_GUIDED:
                   if (drone.getGuidedState().isInitialized() && !drone.getFollowState().isEnabled()) {
                       pauseBtn.setActivated(true);
                   }
                   break;

               case PLANE_RTL:
                   homeBtn.setActivated(true);
                   break;
           }
       }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:24,代码来源:PlaneFlightActionsFragment.java


示例12: getDroneVariable

import com.o3dr.android.client.Drone; //导入依赖的package包/类
protected void getDroneVariable(Drone mDrone, CheckListItem mListItem) {
	String sys_tag = mListItem.getSys_tag();

       final Battery droneBattery = mDrone.getAttribute(AttributeType.BATTERY);
	if (sys_tag.equalsIgnoreCase("SYS_BATTREM_LVL")) {
		mListItem.setSys_value(droneBattery.getBatteryRemain());
	} else if (sys_tag.equalsIgnoreCase("SYS_BATTVOL_LVL")) {
		mListItem.setSys_value(droneBattery.getBatteryVoltage());
	} else if (sys_tag.equalsIgnoreCase("SYS_BATTCUR_LVL")) {
		mListItem.setSys_value(droneBattery.getBatteryCurrent());
	}

       final Gps droneGps = mDrone.getAttribute(AttributeType.GPS);
       if (sys_tag.equalsIgnoreCase("SYS_GPS3D_LVL")) {
		mListItem.setSys_value(droneGps.getSatellitesCount());
	}

       final State droneState = mDrone.getAttribute(AttributeType.STATE);
       if (sys_tag.equalsIgnoreCase("SYS_ARM_STATE")) {
		mListItem.setSys_activated(droneState.isArmed());
	} else if (sys_tag.equalsIgnoreCase("SYS_FAILSAFE_STATE")) {
		mListItem.setSys_activated(droneState.isWarning());
	} else if (sys_tag.equalsIgnoreCase("SYS_CONNECTION_STATE")) {
		mListItem.setSys_activated(droneState.isConnected());
	}
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:27,代码来源:ListRow.java


示例13: initItemView

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Override
protected void initItemView(Context context, View parentView, Drone drone) {
	super.initItemView(context, parentView, drone);
	if (mItemView == null)
		return;

	mPopup = initPopupWindow(context, sPopupWindowLayoutId);

	final View popupView = mPopup.getContentView();
	currentView = (TextView) popupView.findViewById(R.id.bar_power_current);
	mAhView = (TextView) popupView.findViewById(R.id.bar_power_mAh);

	mItemView.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			if (mPopup == null)
				return;

			mPopup.showAsDropDown(mItemView);
		}
	});

	updateItemView(context, drone);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:25,代码来源:InfoBarItem.java


示例14: goToDroneLocation

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Override
public void goToDroneLocation() {
    Drone dpApi = getDroneApi();
    if (!dpApi.isConnected())
        return;

    Gps gps = dpApi.getAttribute(AttributeType.GPS);
    if (!gps.isValid()) {
        Toast.makeText(getActivity().getApplicationContext(),
                R.string.drone_no_location, Toast.LENGTH_SHORT).show();
        return;
    }

    final float currentZoomLevel = getBaiduMap().getMapStatus().zoom;
    final LatLong droneLocation = gps.getPosition();
    updateCamera(droneLocation, (int) currentZoomLevel);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:18,代码来源:BaiduMapFragment.java


示例15: setDrone

import com.o3dr.android.client.Drone; //导入依赖的package包/类
/**
 * This is used to update the current drone state.
 * 
 * @param drone
 */
public void setDrone(Drone drone) {
       LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(mContext);
       if(drone == null) {
           if(mDrone != null) {
               lbm.unregisterReceiver(eventReceiver);
               updateInfoBar();
           }
       }
       else {
           updateInfoBar();
           lbm.registerReceiver(eventReceiver, eventFilter);
       }

       mDrone = drone;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:21,代码来源:InfoBarActionProvider.java


示例16: getDroneVariable

import com.o3dr.android.client.Drone; //导入依赖的package包/类
protected void getDroneVariable(Drone mDrone, CheckListItem mListItem) {
	String sys_tag = mListItem.getSys_tag();

	if (sys_tag.equalsIgnoreCase("SYS_BATTREM_LVL")) {
		mListItem.setSys_value(mDrone.getBattery().getBatteryRemain());
	} else if (sys_tag.equalsIgnoreCase("SYS_BATTVOL_LVL")) {
		mListItem.setSys_value(mDrone.getBattery().getBatteryVoltage());
	} else if (sys_tag.equalsIgnoreCase("SYS_BATTCUR_LVL")) {
		mListItem.setSys_value(mDrone.getBattery().getBatteryCurrent());
	} else if (sys_tag.equalsIgnoreCase("SYS_GPS3D_LVL")) {
		mListItem.setSys_value(mDrone.getGps().getSatellitesCount());
	} else if (sys_tag.equalsIgnoreCase("SYS_ARM_STATE")) {
		mListItem.setSys_activated(mDrone.getState().isArmed());
	} else if (sys_tag.equalsIgnoreCase("SYS_FAILSAFE_STATE")) {
		mListItem.setSys_activated(mDrone.getState().isWarning());
	} else if (sys_tag.equalsIgnoreCase("SYS_CONNECTION_STATE")) {
		mListItem.setSys_activated(mDrone.isConnected());
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:20,代码来源:ListRow.java


示例17: getDroneState

import com.o3dr.android.client.Drone; //导入依赖的package包/类
public DroneState getDroneState(Drone drone) {
    DroneState droneState = new DroneState();

    Speed speed = drone.getAttribute(AttributeType.SPEED);
    if (speed != null) {
        droneState.setVerticalSpeed(speed.getVerticalSpeed());
        droneState.setGroundSpeed(speed.getGroundSpeed());
    }

    Altitude altitude = drone.getAttribute(AttributeType.ALTITUDE);
    if (altitude != null) {
        droneState.setTargetAltitude(altitude.getTargetAltitude());
        droneState.setAltitude(altitude.getAltitude());
    }

    Type type = drone.getAttribute(AttributeType.TYPE);
    if (type != null && type.getFirmware() != null) {
        droneState.setFirmeware(type.getFirmware().getLabel());
    }

    return droneState;
}
 
开发者ID:Project-Helin,项目名称:drone-onboard-app,代码行数:23,代码来源:DroneStateMapper.java


示例18: setupServiceAndListener

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Before
public void setupServiceAndListener() {
    tower = mock(ControlTower.class);
    drone = mock(Drone.class);
    TestAppModule module = new TestAppModule();
    module.setControlTower(tower);
    module.setDrone(drone);

    DaggerTestAppComponent.builder()
            .testAppModule(module)
            .build();

    droneConnectionListener = mock(DroneConnectionListener.class);
    missionListener = mock(MissionListener.class);
    service = new DroneConnectionService(tower, drone, new RouteMissionMapper(), new DroneStateMapper());
}
 
开发者ID:Project-Helin,项目名称:drone-onboard-app,代码行数:17,代码来源:DroneConnectionServiceTest.java


示例19: enableSlidingUpPanel

import com.o3dr.android.client.Drone; //导入依赖的package包/类
private void enableSlidingUpPanel(Drone api){
    if (mSlidingPanel == null || api == null) {
        return;
    }

    final boolean isEnabled = flightActions != null && flightActions.isSlidingUpPanelEnabled
            (api);

    if (isEnabled) {
        mSlidingPanel.setSlidingEnabled(true);
    } else {
        if(!mSlidingPanelCollapsing.get()) {
            if (mSlidingPanel.isPanelExpanded()) {
                mSlidingPanel.setPanelSlideListener(mDisablePanelSliding);
                mSlidingPanel.collapsePanel();
                mSlidingPanelCollapsing.set(true);
            } else {
                mSlidingPanel.setSlidingEnabled(false);
                mSlidingPanelCollapsing.set(false);
            }
        }
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:24,代码来源:FlightActivity.java


示例20: onCreate

import com.o3dr.android.client.Drone; //导入依赖的package包/类
@Override
public void onCreate() {
    SDKInitializer.initialize(getApplicationContext());
    super.onCreate();
    final Context context = getApplicationContext();

    dpPrefs = new DroidPlannerPrefs(context);
    lbm = LocalBroadcastManager.getInstance(context);

    serviceMgr = new ServiceManager(context);
    drone = new Drone(serviceMgr, handler);
    missionProxy = new MissionProxy(context, this.drone);

    exceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
    Thread.setDefaultUncaughtExceptionHandler(dpExceptionHandler);

    GAUtils.initGATracker(this);
    GAUtils.startNewSession(context);

    registerReceiver(broadcastReceiver, new IntentFilter(ACTION_TOGGLE_DRONE_CONNECTION));
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:22,代码来源:DroidPlannerApp.java



注:本文中的com.o3dr.android.client.Drone类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DecompressingHttpClient类代码示例发布时间:2022-05-22
下一篇:
Java ItemTool类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap