当前位置: 首页>>代码示例>>Java>>正文


Java VehicleMode类代码示例

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


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

示例1: getTakeOffInAutoConfirmation

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的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

示例2: updateFlightModeButtons

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的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 ROVER_AUTO:
                autoBtn.setActivated(true);
                break;

            case ROVER_HOLD:
            case ROVER_GUIDED:
                pauseBtn.setActivated(true);
                break;

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

示例3: updateFlightModeButtons

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的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

示例4: getTakeOffInAutoConfirmation

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
private void getTakeOffInAutoConfirmation() {
    YesNoWithPrefsDialog ynd = YesNoWithPrefsDialog.newInstance(getActivity()
                    .getApplicationContext(), getString(R.string.dialog_confirm_take_off_in_auto_title),
            getString(R.string.dialog_confirm_take_off_in_auto_msg), new YesNoDialog.Listener() {
                @Override
                public void onYes() {
                    Drone drone = getDrone();
                    drone.doGuidedTakeoff(TAKEOFF_ALTITUDE);
                    drone.changeVehicleMode(VehicleMode.COPTER_AUTO);
                }

                @Override
                public void onNo() {
                }
            }, getString(R.string.pref_warn_on_takeoff_in_auto_key));

    if(ynd != null){
        ynd.show(getChildFragmentManager(), "Confirm take off in auto");
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:21,代码来源:CopterFlightActionsFragment.java

示例5: updateFlightModeButtons

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的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

示例6: changeVehicleMode

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
@Override
public void changeVehicleMode(VehicleMode newMode) throws RemoteException {
    int mavType;
    switch (newMode.getDroneType()) {
        default:
        case Type.TYPE_COPTER:
            mavType = MAV_TYPE.MAV_TYPE_QUADROTOR;
            break;

        case Type.TYPE_PLANE:
            mavType = MAV_TYPE.MAV_TYPE_FIXED_WING;
            break;

        case Type.TYPE_ROVER:
            mavType = MAV_TYPE.MAV_TYPE_GROUND_ROVER;
            break;
    }

    this.droneMgr.getDrone().getState().changeFlightMode(ApmModes.getMode(newMode.getMode(), mavType));
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:21,代码来源:DroneApi.java

示例7: updateItemView

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
@Override
public void updateItemView(final Context context, final Drone drone) {
	mDrone = drone;

	if (mItemView == null)
		return;

	final SpinnerSelfSelect modesSpinner = (SpinnerSelfSelect) mItemView;
	final int droneType = drone == null || !drone.isConnected() ? -1 : drone.getType()
                  .getDroneType();
	if (droneType != mLastDroneType) {
		final List<VehicleMode> flightModes = VehicleMode.getVehicleModePerDroneType(droneType);

		mModeAdapter.clear();
		mModeAdapter.addAll(flightModes);
		mModeAdapter.notifyDataSetChanged();

		mLastDroneType = droneType;
	}

	if (mDrone != null && mDrone.isConnected()) {
              modesSpinner.forcedSetSelection(mModeAdapter.getPosition(mDrone.getState()
                      .getVehicleMode()));
          }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:26,代码来源:InfoBarItem.java

示例8: handleIntent

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
private void handleIntent(Intent intent) {
    VehicleMode flightMode = intent.getParcelableExtra(WearReceiverService.EXTRA_EVENT_DATA);
    if(flightMode == null)
        flightMode = VehicleMode.UNKNOWN;

    List<VehicleMode> vehicleModes = VehicleMode.getVehicleModePerDroneType(flightMode.getDroneType());
    WearableListView listView = (WearableListView) findViewById(R.id.wear_list);
    listView.setAdapter(new VehicleModeAdapter(vehicleModes));
    listView.setClickListener(this);

    RecyclerView.LayoutManager layoutMgr = listView.getLayoutManager();
    if (layoutMgr != null) {
        int currentPos = vehicleModes.indexOf(flightMode);
        if (currentPos != -1)
            layoutMgr.scrollToPosition(currentPos);
    }
}
 
开发者ID:DroidPlanner,项目名称:tower-wear,代码行数:18,代码来源:FlightModesSelectionActivity.java

示例9: onFlightModeSelected

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
public void onFlightModeSelected(View view) {
    VehicleMode vehicleMode = (VehicleMode) this.modeSelector.getSelectedItem();

    VehicleApi.getApi(this.drone).setVehicleMode(vehicleMode, new AbstractCommandListener() {
        @Override
        public void onSuccess() {
            alertUser("Vehicle mode change successful.");
        }

        @Override
        public void onError(int executionError) {
            alertUser("Vehicle mode change failed: " + executionError);
        }

        @Override
        public void onTimeout() {
            alertUser("Vehicle mode change timed out.");
        }
    });
}
 
开发者ID:3drobotics,项目名称:DroneKit-Android-Starter,代码行数:21,代码来源:MainActivity.java

示例10: speakMode

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
private void speakMode(VehicleMode mode) {
    if (mode == null)
        return;

    String modeString = context.getString(R.string.fly_mode_mode);
    switch (mode) {
        case PLANE_FLY_BY_WIRE_A:
            modeString += context.getString(R.string.fly_mode_wire_a);
            break;
        case PLANE_FLY_BY_WIRE_B:
            modeString += context.getString(R.string.fly_mode_wire_b);
            break;
        case COPTER_ACRO:
            modeString += context.getString(R.string.fly_mode_acro);
            break;
        case COPTER_ALT_HOLD:
            modeString += context.getString(R.string.fly_mode_alt_hold);
            break;
        case COPTER_POSHOLD:
            modeString += context.getString(R.string.fly_mode_pos_hold);
            break;
        case PLANE_RTL:
        case COPTER_RTL:
            modeString += context.getString(R.string.fly_mode_rtl);
            break;
        default:
            modeString += mode.getLabel();
            break;
    }
    speak(modeString);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:32,代码来源:TTSNotificationProvider.java

示例11: updateFlightMode

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
private void updateFlightMode(Drone drone) {
    if (mNotificationBuilder == null)
        return;

    State droneState = drone.getAttribute(AttributeType.STATE);
    VehicleMode mode = droneState == null ? null : droneState.getVehicleMode();
    String update = mode == null ? "--" : mode.getLabel();
    final CharSequence modeSummary = SpannableUtils.normal("Flight Mode:  ", SpannableUtils.bold(update));
    mNotificationBuilder.setContentTitle(modeSummary);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:11,代码来源:StatusBarNotificationProvider.java

示例12: updateFlightModeButtons

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
private void updateFlightModeButtons() {
    resetFlightModeButtons();

    State droneState = getDrone().getAttribute(AttributeType.STATE);
    if (droneState == null)
        return;

    final VehicleMode flightMode = droneState.getVehicleMode();
    if (flightMode == null)
        return;

    switch (flightMode) {
        case COPTER_AUTO:
            autoBtn.setActivated(true);
            break;

        case COPTER_BRAKE:
            pauseBtn.setActivated(true);
            break;

        case COPTER_RTL:
            homeBtn.setActivated(true);
            break;

        case COPTER_LAND:
            landBtn.setActivated(true);
            break;
        default:
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:32,代码来源:CopterFlightControlFragment.java

示例13: onClick

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
@Override
public void onClick(View v) {
    final Drone drone = getDrone();
    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
            .setCategory(GAUtils.Category.FLIGHT);

    switch (v.getId()) {
        case R.id.mc_connectBtn:
            ((SuperUI) getActivity()).toggleDroneConnection();
            break;

        case R.id.mc_homeBtn:
            VehicleApi.getApi(drone).setVehicleMode(VehicleMode.ROVER_RTL);
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.ROVER_RTL.getLabel());
            break;

        case R.id.mc_pause: {
            VehicleApi.getApi(drone).setVehicleMode(VehicleMode.ROVER_HOLD);
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.ROVER_HOLD.getLabel());
            break;
        }

        case R.id.mc_autoBtn:
            VehicleApi.getApi(drone).setVehicleMode(VehicleMode.ROVER_AUTO);
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.ROVER_AUTO.getLabel());
            break;

        default:
            eventBuilder = null;
            break;
    }

    if (eventBuilder != null) {
        GAUtils.sendEvent(eventBuilder);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:37,代码来源:RoverFlightControlFragment.java

示例14: getView

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	final VehicleMode mode = getItem(position);
	TextView view = (TextView) super.getView(position, convertView, parent);
	view.setText(mode.getLabel());
	return view;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:8,代码来源:ModeAdapter.java

示例15: startAutoPilotWhenTakeOffFinished

import com.o3dr.services.android.lib.drone.property.VehicleMode; //导入依赖的package包/类
private void startAutoPilotWhenTakeOffFinished(Altitude altitude) {

        double minAltitudeToStartMission = TAKEOFF_ALTITUDE * ALTITUDE_INACCURACY_RATIO;
        if (altitude != null && altitude.getTargetAltitude() > minAltitudeToStartMission && minAltitudeToStartMission < altitude.getAltitude()) {
            DroneStateApi.setVehicleMode(drone, VehicleMode.COPTER_AUTO);
            startMission = false;
            endMissionWhenLanded = true;
        }
    }
 
开发者ID:Project-Helin,项目名称:drone-onboard-app,代码行数:10,代码来源:DroneConnectionService.java


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