基于MobileSDKV4版固件开发大疆无人机手机端遥控器(3)

原创 美男子玩编程 2023-06-15 12:00

点击上方蓝色字体,关注我们



第三篇文章准备单独拿出来写,因为在大疆为人机的所有功能中,航线规划的功能最为复杂,也相当的繁琐,这里需要说仔细一点,可能会将代码进行多步分解。


1


航线规划


航线打点 


在地图中手动选择点位选择完成航线打点;若打点位置错了可进行点位删除。


航点设置 


可对航线点位进行设置,如飞行高度,速度(慢速:3m/s;中速: 7m/s;高速:10 m/s)、任务结束后操作及航向,点击[设置]按钮完成设置。

设置完成后会显示总距离及飞行总时间。


航线上传


点击[上传]按钮,进行航线上传。可以进入本地存储中选择航线文件进行上传,航线文件为 .kml结尾。


航线执行 


点击 [开始]按钮,则可对航线进行执行。若中途需要暂停也可点击[暂停]安装进行暂停操作。


航线管理


按钮即可进入航线管理界面。


获取航线 


点击[获取]按钮,即可将航线信息展示到地图界面中。


2


主要功能代码


创建activity_setting_route.xml及SettingRouteActivity文件。


activity_setting_route.xml



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".ui.SettingRouteActivity">


    <include
        android:id="@+id/layout_route"
        layout="@layout/activity_toolbar">
include>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.amap.api.maps.MapView
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerInParent="true"
            android:layout_marginTop="5dp">

            <Button
                android:id="@+id/btn_delete"
                android:layout_width="60dp"
                android:layout_height="30dp"
                android:visibility="gone"
                android:text="删除"
                android:textColor="@color/white"
                android:background="@drawable/button_task_background">
Button>
            <Button
                android:id="@+id/btn_finish"
                android:layout_width="60dp"
                android:layout_height="30dp"
                android:visibility="gone"
                android:textColor="@color/white"
                android:background="@drawable/button_task_background"
                android:text="完成">
Button>
            <Button
                android:id="@+id/btn_setting"
                android:layout_width="60dp"
                android:layout_height="30dp"
                android:visibility="gone"
                android:textColor="@color/white"
                android:background="@drawable/button_task_background"
                android:text="设置">
Button>
            <Button
                android:id="@+id/btn_upload"
                android:layout_width="60dp"
                android:layout_height="30dp"
                android:visibility="gone"
                android:textColor="@color/white"
                android:background="@drawable/button_task_background"
                android:text="上传">
Button>
            <Button
                android:id="@+id/btn_start"
                android:layout_width="60dp"
                android:layout_height="30dp"
                android:visibility="gone"
                android:textColor="@color/white"
                android:background="@drawable/button_task_background"
                android:text="开始">
Button>
            <Button
                android:id="@+id/btn_stop"
                android:layout_width="60dp"
                android:layout_height="30dp"
                android:visibility="gone"
                android:textColor="@color/white"
                android:background="@drawable/button_task_background"
                android:text="暂停">
Button>
        LinearLayout>
        <LinearLayout
            android:id="@+id/ll_information"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerInParent="true"
            android:layout_marginBottom="5dp"
            android:padding="10dp"
            android:visibility="gone"
            android:background="@color/color_nav_Item_unselected">

            <TextView
                android:id="@+id/tv_height"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="高度:"
                android:textColor="@color/white"
                >
TextView>
            <TextView
                android:id="@+id/tv_speed"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="速度:"
                android:textColor="@color/white"
                android:layout_marginLeft="10dp"
                >
TextView>
            <TextView
                android:id="@+id/tv_count"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="航点数:"
                android:textColor="@color/white"
                android:layout_marginLeft="10dp"
                >
TextView>
            <TextView
                android:id="@+id/tv_distance"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="总距离:"
                android:textColor="@color/white"
                android:layout_marginLeft="10dp"
                >
TextView>
            <TextView
                android:id="@+id/tv_time"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="总时间:"
                android:textColor="@color/white"
                android:layout_marginLeft="10dp"
                >
TextView>
        LinearLayout>
    RelativeLayout>
LinearLayout>


SettingRouteActivity


public class SettingRouteActivity extends BaseActivity implements AMap.OnMarkerClickListenerView.OnClickListenerAMap.OnMapClickListenerLocationSourceAMapLocationListenerAMap.InfoWindowAdapter {
    @BindView(R.id.layout_route)
        View mViewLayoutToolbar;
        @BindView(R.id.ll_route)
        LinearLayout mLinearLayout;
        @BindView(R.id.tv_toolbar_title)
        TextView mTextViewToolbarTitle;
    //    @BindView(R.id.map)
    //    MapView mMapView;

        @BindView(R.id.btn_delete)
        Button mButtonDelete;
        @BindView(R.id.btn_finish)
        Button mButtonFinish;
        @BindView(R.id.btn_setting)
        Button mButtonSetting;
        @BindView(R.id.btn_upload)
        Button mButtonUpload;
        @BindView(R.id.btn_start)
        Button mButtonStart;
        @BindView(R.id.btn_stop)
        Button mButtonStop;

        @BindView(R.id.ll_information)
        LinearLayout mLinearLayoutInformation;
        @BindView(R.id.tv_height)
        TextView mTextViewHeight;
        @BindView(R.id.tv_speed)
        TextView mTextViewSpeed;
        @BindView(R.id.tv_count)
        TextView mTextViewCount;
        @BindView(R.id.tv_distance)
        TextView mTextViewDistance;
        @BindView(R.id.tv_time)
        TextView mTextViewTime;

        private MapView mMapView;
        private OnLocationChangedListener mListener;
        private AMapLocationClient mlocationClient;
        private AMapLocationClientOption mLocationOption;
        private double D_latitude, D_longitude;
        private UiSettings mUiSettings;
        private AMap aMap;
        private Marker droneMarker = null;

        private float altitude = 100.0f;
        private float mSpeed = 10.0f;

        private boolean isAdd = false;

        private final Map mMarkers = new ConcurrentHashMap();
        private Marker mClickMarker;
        private List waypointList = new ArrayList<>();
        private List mLatLng = new ArrayList<>();
        private List mPointInfo = new ArrayList<>();

        public static WaypointMission.Builder waypointMissionBuilder;
        private FlightController mFlightController;
        private WaypointMissionOperator instance;
        private WaypointMissionFinishedAction mFinishedAction = WaypointMissionFinishedAction.NO_ACTION;
        private WaypointMissionHeadingMode mHeadingMode = WaypointMissionHeadingMode.AUTO;

        private SQLiteHelper mSQLiteHelper;
        private String FinishedAction, HeadingMode;

        //自定义窗体
        View infoWindow = null;

        int speed_RG_id = 0;
        int actionAfterFinished_RG_id = 0;
        int heading_RG_id = 0;

        //kim
        static ReadKml readKml = new ReadKml();
        private static List sampleList = readKml.getCoordinateList();

        @Override
        public void initViews() {
            mLinearLayout.setVisibility(View.VISIBLE);
            mTextViewToolbarTitle.setText("航线规划");
            IntentFilter filter = new IntentFilter();
            filter.addAction(ReceiverApplication.FLAG_CONNECTION_CHANGE);
            registerReceiver(mReceiver, filter);
            mMapView = findViewById(R.id.map);
            mMapView.onCreate(InstanceState);
            initMapView();
            addListener();
            onProductConnectionChange();

        }

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

        /**
         * 方法必须重写
         */

        @Override
        protected void onSaveInstanceState(Bundle outState) {
            super.onSaveInstanceState(outState);
            mMapView.onSaveInstanceState(outState);
        }

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

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

        }

        @Override
        public void initDatas() {

        }

        @Override
        protected void requestData() {

        }

        private void initMapView() {
            if (aMap == null) {
                aMap = mMapView.getMap();
                mUiSettings = aMap.getUiSettings();
                mUiSettings.setMyLocationButtonEnabled(true);
                mUiSettings.setScaleControlsEnabled(true);
                aMap.setOnMapClickListener(this);// add the listener for click for amap object
                aMap.setLocationSource(this);
                aMap.setMyLocationEnabled(true);
                aMap.setInfoWindowAdapter(this);
                aMap.setOnMarkerClickListener(this);
                setupLocationStyle();
            }
        }

        private void setupLocationStyle() {
            // 自定义系统定位蓝点
            MyLocationStyle myLocationStyle = new MyLocationStyle();
            // 自定义定位蓝点图标
            myLocationStyle.myLocationIcon(BitmapDescriptorFactory.
                    fromResource(R.mipmap.icv_gps_point_36dp));
            // 自定义精度范围的圆形边框颜色
            myLocationStyle.strokeColor(Color.parseColor("#00000000"));
            //自定义精度范围的圆形边框宽度
            myLocationStyle.strokeWidth(5);
            // 设置圆形的填充颜色
            myLocationStyle.radiusFillColor(Color.parseColor("#00000000"));
            // 将自定义的 myLocationStyle 对象添加到地图上
            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
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.img_back:
                    SettingRouteActivity.this.finish();
                    break;
                case R.id.img_kml_input:
                    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                    intent.setType("*/*");//设置类型,我这里是任意类型,任意后缀的可以这样写。
                    intent.addCategory(Intent.CATEGORY_OPENABLE);
                    startActivityForResult(intent, MyStatic.REQUEST_CODE_FILE);
                    break;
                case R.id.img_setting_route:
                    enableDisableAdd();
                    break;
                case R.id.img_setting_clear:
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            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;
                case R.id.img_start_fly:
                    atyAction(WaypointActivity.classMyStatic.REQUEST_CODE_ID);
                    break;
                case R.id.btn_delete:
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            aMap.clear();
                        }
                    });
                    for (int i = 0; i < mMarkers.size(); i++) {
                        if (mMarkers.get(i).getTitle().equals(mClickMarker.getTitle())) {
                            for (int j = i; j < mMarkers.size() - 1; j++) {
                                mMarkers.put(j, mMarkers.get(j + 1));
                            }
                            mMarkers.remove(mMarkers.size() - 1);
                        }
                    }
                    for (int i = 0; i < mMarkers.size(); i++) {
                        mMarkers.get(i).setTitle("航点" + (i + 1));
                    }
                    updateMarkWaypoint();
                    break;
                case R.id.btn_finish:
                    MyLog.d("航点数:" + waypointMissionBuilder.getWaypointCount());
                    MyLog.d("总距离:" + waypointMissionBuilder.calculateTotalDistance());
                    MyLog.d("总时间:" + waypointMissionBuilder.calculateTotalTime());
                    isAdd = false;
                    mButtonFinish.setVisibility(View.GONE);
                    mButtonSetting.setVisibility(View.VISIBLE);
                    mButtonUpload.setVisibility(View.VISIBLE);
                    showSettingDialog();
                    break;
                case R.id.btn_setting:
                    showSettingDialog();
                    break;
                case R.id.btn_upload:
                    uploadWayPointMission();
                    break;
                case R.id.btn_start:
                    startWaypointMission();
                    break;
                case R.id.btn_stop:
                    stopWaypointMission();
                    break;
            }
        }

        private void enableDisableAdd() {
            if (isAdd == false) {
                isAdd = true;
                mButtonFinish.setVisibility(View.VISIBLE);
            } else {
                isAdd = false;
            }
        }

        private void initFlightController() {
            BaseProduct product = ReceiverApplication.getProductInstance();
            if (product != null && product.isConnected()) {
                if (product instanceof Aircraft) {
                    mFlightController = ((Aircraft) product).getFlightController();
                }
            }
            if (mFlightController != null) {
                mFlightController.setStateCallback(
                        new FlightControllerState.Callback() {
                            @Override
                            public void onUpdate(FlightControllerState
                                                         djiFlightControllerCurrentState)
 
{
                                if (djiFlightControllerCurrentState.getAircraftLocation().getLatitude() != 0.0 && djiFlightControllerCurrentState.getAircraftLocation().getLongitude() != 0.0) {
                                    D_latitude = djiFlightControllerCurrentState.getAircraftLocation().getLatitude();
                                    D_longitude = djiFlightControllerCurrentState.getAircraftLocation().getLongitude();
                                }
                                updateDroneLocation();
                            }
                        });
            }
        }

        private void updateDroneLocation() {
            LatLng pos = new LatLng(D_latitude, D_longitude);
            //Create MarkerOptions object
            final MarkerOptions markerOptions = new MarkerOptions();
            markerOptions.position(pos);
            markerOptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_aircraft_write_36dp));
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if (droneMarker != null) {
                        droneMarker.remove();
                    }

                    if (checkGpsCoordination(D_latitude, D_longitude)) {
                        droneMarker = aMap.addMarker(markerOptions);
                    }
                }
            });
        }

        public static boolean checkGpsCoordination(double latitude, double longitude) {
            return (latitude > -90 && latitude < 90 && longitude > -180 && longitude < 180) && (latitude != 0f && longitude != 0f);
        }

        protected BroadcastReceiver mReceiver = new BroadcastReceiver() {

            @Override
            public void onReceive(Context context, Intent intent) {
                onProductConnectionChange();
            }
        };

        private void onProductConnectionChange() {
            initFlightController();
        }

        private void addListener() {
            if (getWaypointMissionOperator() != null) {
                getWaypointMissionOperator().addListener(eventNotificationListener);
            }
        }

        private void removeListener() {
            if (getWaypointMissionOperator() != null) {
                getWaypointMissionOperator().removeListener(eventNotificationListener);
            }
        }

        private WaypointMissionOperatorListener eventNotificationListener = new WaypointMissionOperatorListener() {
            @Override
            public void onDownloadUpdate(WaypointMissionDownloadEvent downloadEvent) {

            }

            @Override
            public void onUploadUpdate(WaypointMissionUploadEvent uploadEvent) {

            }

            @Override
            public void onExecutionUpdate(WaypointMissionExecutionEvent executionEvent) {

            }

            @Override
            public void onExecutionStart() {

            }

            @Override
            public void onExecutionFinish(@Nullable final DJIError error) {
                showToasts("Execution finished: " + (error == null ? "Success!" : error.getDescription()));
            }
        };

        public WaypointMissionOperator getWaypointMissionOperator() {
            if (instance == null) {
                instance = DJISDKManager.getInstance().getMissionControl().getWaypointMissionOperator();
            }
            return instance;
        }

        @Override
        public void onMapClick(LatLng point) {
            if (isAdd == true) {
                markWaypoint(point);
                Waypoint mWaypoint = new Waypoint(point.latitude, point.longitude, altitude);
                //Add Waypoints to Waypoint arraylist;
                if (waypointMissionBuilder != null) {
                    waypointList.add(mWaypoint);
                    waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
                } else {
                    waypointMissionBuilder = new WaypointMission.Builder();
                    waypointList.add(mWaypoint);
                    waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
                }
                mTextViewCount.setText("航点数:" + waypointMissionBuilder.getWaypointCount());
                mTextViewDistance.setText("总距离:" + Math.round(waypointMissionBuilder.calculateTotalDistance()) + "m");
                mTextViewTime.setText("总时间:" + Math.round(waypointMissionBuilder.calculateTotalTime()) + "min");
            } else {
                if (mClickMarker != null && mClickMarker.isInfoWindowShown()) {
                    mClickMarker.hideInfoWindow();
                    mButtonDelete.setVisibility(View.GONE);
                }
                //            showToasts("当前未开启增加点模式");
            }

        }

        private void markWaypoint(LatLng point) {
            MarkerOptions markerOptions = new MarkerOptions();
            markerOptions.position(point);
            mPointInfo.add(new PointInfo(point.latitude, point.longitude));
            markerOptions.title("航点" + (mMarkers.size() + 1));
            markerOptions.snippet("事件:");
            markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
            markerOptions.infoWindowEnable(true);
            Marker marker = aMap.addMarker(markerOptions);
            mMarkers.put(mMarkers.size(), marker);
            marker.showInfoWindow();
            if (mMarkers.size() > 0) {
                mLatLng.clear();
                PolylineOptions PolylineOptions = new PolylineOptions();
                for (int i = 0; i < mMarkers.size(); i++) {
                    mLatLng.add(mMarkers.get(i).getPosition());
                }
                PolylineOptions.addAll(mLatLng);
                PolylineOptions.width(10);
                PolylineOptions.color(Color.argb(255111));
                aMap.addPolyline(PolylineOptions);
            }
        }

        private void updateMarkWaypoint() {
            mLatLng.clear();
            waypointList.clear();
            mPointInfo.clear();
            waypointMissionBuilder.waypointList(waypointList);
            for (int i = 0; i < mMarkers.size(); i++) {
                mPointInfo.add(new PointInfo(mMarkers.get(i).getPosition().latitude, mMarkers.get(i).getPosition().longitude));
                MarkerOptions markerOptions = new MarkerOptions();
                Waypoint mWaypoint = new Waypoint(mMarkers.get(i).getPosition().latitude, mMarkers.get(i).getPosition().longitude, altitude);
                waypointList.add(mWaypoint);
                markerOptions.position(mMarkers.get(i).getPosition());
                markerOptions.title(mMarkers.get(i).getTitle());
                markerOptions.snippet(mMarkers.get(i).getSnippet());
                markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
                aMap.addMarker(markerOptions);
                mLatLng.add(mMarkers.get(i).getPosition());
            }
            if (mMarkers.size() > 0) {
                PolylineOptions PolylineOptions = new PolylineOptions();
                PolylineOptions.addAll(mLatLng);
                PolylineOptions.width(10);
                PolylineOptions.color(Color.argb(255111));
                aMap.addPolyline(PolylineOptions);
            }
            waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
            mTextViewCount.setText("航点数:" + waypointMissionBuilder.getWaypointCount());
            mTextViewDistance.setText("总距离:" + Math.round(waypointMissionBuilder.calculateTotalDistance()) + "m");
            mTextViewTime.setText("总时间:" + Math.round(waypointMissionBuilder.calculateTotalTime()) + "min");
            MyLog.d("航点数:" + waypointMissionBuilder.getWaypointCount());
            MyLog.d("总距离:" + waypointMissionBuilder.calculateTotalDistance());
            MyLog.d("总时间:" + waypointMissionBuilder.calculateTotalTime());
            mButtonDelete.setVisibility(View.GONE);
        }


        /**
         * 定位成功后回调函数
         */

        @Override
        public void onLocationChanged(AMapLocation amapLocation) {
            if (mListener != null && amapLocation != null) {
                if (amapLocation != null
                        && amapLocation.getErrorCode() == 0) {
                    D_latitude = amapLocation.getLatitude(); //获取纬度
                    D_longitude = amapLocation.getLongitude(); //获取经度
                    mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
                    aMap.moveCamera(CameraUpdateFactory.zoomTo(18));
                } else {
                    String errText = "定位失败," + amapLocation.getErrorCode() + ": " + amapLocation.getErrorInfo();
                    Log.e("AmapErr", errText);
                }
            }
        }

        @Override
        public void activate(OnLocationChangedListener listener) {
            mListener = listener;
            if (mlocationClient == null) {
                try {
                    mlocationClient = new AMapLocationClient(this);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                mLocationOption = new AMapLocationClientOption();
                //设置定位监听
                mlocationClient.setLocationListener(this);
                //设置为高精度定位模式
                mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
                //设置定位参数
                mLocationOption.setOnceLocation(true);
                mlocationClient.setLocationOption(mLocationOption);
                // 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗,
                // 注意设置合适的定位时间的间隔(最小间隔支持为2000ms),并且在合适时间调用stopLocation()方法来取消定位请求
                // 在定位结束后,在合适的生命周期调用onDestroy()方法
                // 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除
                mlocationClient.startLocation();
            }
        }

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

        @Override
        public View getInfoWindow(Marker marker) {
            if (infoWindow == null) {
                infoWindow = LayoutInflater.from(this).inflate(R.layout.amap_info_window, null);
            }
            render(marker, infoWindow);
            return infoWindow;
        }

        /**
         * 自定义infoWindow窗口
         */

        private void render(Marker marker, View infoWindow) {
            TextView title = infoWindow.findViewById(R.id.info_window_title);
            TextView content = infoWindow.findViewById(R.id.info_window_content);
            title.setText(marker.getTitle());
            content.setText(marker.getSnippet());
        }


        @Override
        public View getInfoContents(Marker marker) {
            return null;
        }

        @Override
        public boolean onMarkerClick(Marker marker) {
            marker.showInfoWindow();
            mClickMarker = marker;
            mButtonDelete.setVisibility(View.VISIBLE);
            //        aMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(marker.getPosition(),18,0,0)));
            return true;
        }

        private void showSettingDialog() {
            LinearLayout wayPointSettings = (LinearLayout) getLayoutInflater().inflate(R.layout.dialog_waypointsetting, null);

            final TextView wpAltitude_TV = (TextView) wayPointSettings.findViewById(R.id.altitude);
            RadioGroup speed_RG = (RadioGroup) wayPointSettings.findViewById(R.id.speed);
            RadioGroup actionAfterFinished_RG = (RadioGroup) wayPointSettings.findViewById(R.id.actionAfterFinished);
            RadioGroup heading_RG = (RadioGroup) wayPointSettings.findViewById(R.id.heading);
            wpAltitude_TV.setText(Math.round(altitude) + "");
            if (speed_RG_id != 0) {
                RadioButton radioButton = (RadioButton) speed_RG.findViewById(speed_RG_id);
                radioButton.setChecked(true);
            }
            if (actionAfterFinished_RG_id != 0) {
                RadioButton radioButton = (RadioButton) actionAfterFinished_RG.findViewById(actionAfterFinished_RG_id);
                radioButton.setChecked(true);
            }
            if (heading_RG_id != 0) {
                RadioButton radioButton = (RadioButton) heading_RG.findViewById(heading_RG_id);
                radioButton.setChecked(true);
            }
            speed_RG.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(RadioGroup group, int checkedId) {
                    if (checkedId == R.id.lowSpeed) {
                        mSpeed = 3.0f;
                    } else if (checkedId == R.id.MidSpeed) {
                        mSpeed = 5.0f;
                    } else if (checkedId == R.id.HighSpeed) {
                        mSpeed = 10.0f;
                    }
                    speed_RG_id = checkedId;
                }

            });

            actionAfterFinished_RG.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(RadioGroup group, int checkedId) {
                    MyLog.d("选择动作完成");
                    if (checkedId == R.id.finishNone) {
                        mFinishedAction = WaypointMissionFinishedAction.NO_ACTION;
                        FinishedAction = "0";
                    } else if (checkedId == R.id.finishGoHome) {
                        mFinishedAction = WaypointMissionFinishedAction.GO_HOME;
                        FinishedAction = "1";
                    } else if (checkedId == R.id.finishAutoLanding) {
                        mFinishedAction = WaypointMissionFinishedAction.AUTO_LAND;
                        FinishedAction = "2";
                    } else if (checkedId == R.id.finishToFirst) {
                        mFinishedAction = WaypointMissionFinishedAction.GO_FIRST_WAYPOINT;
                        FinishedAction = "3";
                    }
                    actionAfterFinished_RG_id = checkedId;
                }
            });

            heading_RG.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(RadioGroup group, int checkedId) {
                    MyLog.d("选择标题");
                    if (checkedId == R.id.headingNext) {
                        mHeadingMode = WaypointMissionHeadingMode.AUTO;
                        HeadingMode = "0";
                    } else if (checkedId == R.id.headingInitDirec) {
                        mHeadingMode = WaypointMissionHeadingMode.USING_INITIAL_DIRECTION;
                        HeadingMode = "1";
                    } else if (checkedId == R.id.headingRC) {
                        mHeadingMode = WaypointMissionHeadingMode.CONTROL_BY_REMOTE_CONTROLLER;
                        HeadingMode = "2";
                    } else if (checkedId == R.id.headingWP) {
                        mHeadingMode = WaypointMissionHeadingMode.USING_WAYPOINT_HEADING;
                        HeadingMode = "3";
                    }
                    heading_RG_id = checkedId;
                }
            });

            new AlertDialog.Builder(this)
                    .setTitle("航点设置")
                    .setView(wayPointSettings)
                    .setNeutralButton("设置"new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            String altitudeString = 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();
        }

        String nulltoIntegerDefalt(String value) {
            if (!isIntValue(value))
                value = "0";
            return value;
        }

        boolean isIntValue(String val) {
            try {
                val = val.replace(" """);
                Integer.parseInt(val);
            } catch (Exception e) {
                return false;
            }
            return true;
        }

        private void configWayPointMission() {

            if (waypointMissionBuilder == null) {

                waypointMissionBuilder = new WaypointMission.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 (int i = 0; i < waypointMissionBuilder.getWaypointList().size(); i++) {
                    waypointMissionBuilder.getWaypointList().get(i).altitude = altitude;
                }
            }

            DJIError error = getWaypointMissionOperator().loadMission(waypointMissionBuilder.build());
            if (error == null) {
                if (mLinearLayoutInformation.getVisibility() == View.GONE) {
                    mLinearLayoutInformation.setVisibility(View.VISIBLE);
                }
                mTextViewHeight.setText("高度:" + altitude + "m");
                mTextViewSpeed.setText("速度:" + mSpeed + "m/s");
                mTextViewCount.setText("航点数:" + waypointMissionBuilder.getWaypointCount());
                mTextViewDistance.setText("总距离:" + Math.round(waypointMissionBuilder.calculateTotalDistance()) + "m");
                mTextViewTime.setText("总时间:" + Math.round(waypointMissionBuilder.calculateTotalTime()) + "min");
                MyLog.d("航点数:" + waypointMissionBuilder.getWaypointCount());
                MyLog.d("总距离:" + waypointMissionBuilder.calculateTotalDistance());
                MyLog.d("总时间:" + waypointMissionBuilder.calculateTotalTime());
                showToasts("航路点配置成功");
            } else {
                showToasts("航路点配置失败 " + error.getDescription());
            }

        }

        private void uploadWayPointMission() {
            getWaypointMissionOperator().uploadMission(new CommonCallbacks.CompletionCallback() {
                @Override
                public void onResult(DJIError error) {
                    if (error == null) {
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                mButtonSetting.setVisibility(View.GONE);
                                mButtonUpload.setVisibility(View.GONE);
                                mButtonStart.setVisibility(View.VISIBLE);
                                mButtonStop.setVisibility(View.VISIBLE);
                            }
                        });
                        showToasts("任务上传成功!");
                        mSQLiteHelper = new SQLiteHelper(SettingRouteActivity.this);
                        MyLog.d("航点值:" + GsonUtil.GsonString(mPointInfo));
                        mSQLiteHelper.doInsert(GsonUtil.GsonString(mPointInfo), altitude, mSpeed, HeadingMode, FinishedAction,
                                waypointMissionBuilder.getWaypointCount(), Math.round(waypointMissionBuilder.calculateTotalDistance()),
                                Math.round(waypointMissionBuilder.calculateTotalTime()), DateUtils.getCurrentDate());
                        mSQLiteHelper.close();
                    } else {
                        showToasts("任务上传失败, error: " + error.getDescription() + " retrying...");
                        getWaypointMissionOperator().retryUploadMission(null);
                    }
                }
            });

        }

        private void startWaypointMission() {

            getWaypointMissionOperator().startMission(new CommonCallbacks.CompletionCallback() {
                @Override
                public void onResult(DJIError error) {
                    showToasts("任务开始: " + (error == null ? "成功" : "失败:" + error.getDescription()));
                }
            });

        }

        private void stopWaypointMission() {

            getWaypointMissionOperator().stopMission(new CommonCallbacks.CompletionCallback() {
                @Override
                public void onResult(DJIError error) {
                    showToasts("任务暂停: " + (error == null ? "成功" : "失败" + error.getDescription()));
                }
            });
        }

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            switch (requestCode) {
                case 101:
                    int Id = data.getExtras().getInt("id");
                    MyLog.d("返回的ID:" + Id);
                    if (Id > -1) {
                        refreshMapPoint(Id);
                    }
                    break;
                case 102:
                    if (data.getData() != null) {
                        Uri uri = data.getData();//得到uri,后面就是将uri转化成file的过程。
                        String img_path = uri.getPath();
                        try {
                            if (!TextUtils.isEmpty(img_path)) {
                                readKml.parseKml(img_path);
                                addSampleMarker();
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    break;
                default:
                    break;
            }

        }

        private void refreshMapPoint(int id) {
            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 = new SQLiteHelper(SettingRouteActivity.this);
            Cursor c = mSQLiteHelper.doSelectWaypoint(id);
            if (c != null) {
                if (c.moveToNext()) {
                    MyLog.d("航点:" + "{'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 (int i = 0; i < mPointInfo.size(); i++) {
                showWaypoint(new LatLng(mPointInfo.get(i).getLatitude(), mPointInfo.get(i).getLongitude()));
                Waypoint mWaypoint = new Waypoint(mPointInfo.get(i).getLatitude(), mPointInfo.get(i).getLongitude(), altitude);
                if (waypointMissionBuilder != null) {
                    waypointList.add(mWaypoint);
                    waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
                } else {
                    waypointMissionBuilder = new WaypointMission.Builder();
                    waypointList.add(mWaypoint);
                    waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
                }
            }
            aMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(new LatLng(mPointInfo.get(0).getLatitude(), mPointInfo.get(0).getLongitude()), 1800)));
            ResultconfigWayPointMission();
            getWaypointMissionOperator().uploadMission(new CommonCallbacks.CompletionCallback() {
                @Override
                public void onResult(DJIError djiError) {
                    if (djiError == null) {
                        showToasts("获取任务成功!");
                    }
                }
            });
        }

        private void showWaypoint(LatLng point) {
            MarkerOptions markerOptions = new MarkerOptions();
            markerOptions.position(point);
            markerOptions.title("航点" + (mMarkers.size() + 1));
            markerOptions.snippet("事件:");
            markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
            markerOptions.infoWindowEnable(true);
            Marker marker = aMap.addMarker(markerOptions);
            mMarkers.put(mMarkers.size(), marker);
            marker.showInfoWindow();
            if (mMarkers.size() > 0) {
                mLatLng.clear();
                PolylineOptions PolylineOptions = new PolylineOptions();
                for (int i = 0; i < mMarkers.size(); i++) {
                    mLatLng.add(mMarkers.get(i).getPosition());
                }
                PolylineOptions.addAll(mLatLng);
                PolylineOptions.width(10);
                PolylineOptions.color(Color.argb(255111));
                aMap.addPolyline(PolylineOptions);
            }
        }

        private void ResultconfigWayPointMission() {

            if (waypointMissionBuilder == null) {

                waypointMissionBuilder = new WaypointMission.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 (int i = 0; i < waypointMissionBuilder.getWaypointList().size(); i++) {
                    waypointMissionBuilder.getWaypointList().get(i).altitude = altitude;
                }
            }

            DJIError error = getWaypointMissionOperator().loadMission(waypointMissionBuilder.build());
            if (error == null) {
                if (mLinearLayoutInformation.getVisibility() == View.GONE) {
                    mLinearLayoutInformation.setVisibility(View.VISIBLE);
                }
                mButtonStart.setVisibility(View.VISIBLE);
                mButtonStop.setVisibility(View.VISIBLE);
                mTextViewHeight.setText("高度:" + altitude + "m");
                mTextViewSpeed.setText("速度:" + mSpeed + "m/s");
                mTextViewCount.setText("航点数:" + waypointMissionBuilder.getWaypointCount());
                mTextViewDistance.setText("总距离:" + Math.round(waypointMissionBuilder.calculateTotalDistance()) + "m");
                mTextViewTime.setText("总时间:" + Math.round(waypointMissionBuilder.calculateTotalTime()) + "min");
            }
        }

        private void addSampleMarker() {
            if (ReadKml.addSampleSuccess) {
                aMap.clear();
                mMarkers.clear();
                mPointInfo.clear();
                waypointList.clear();
                if (mLinearLayoutInformation.getVisibility() == View.VISIBLE) {
                    mLinearLayoutInformation.setVisibility(View.GONE);
                }
                mButtonFinish.setVisibility(View.GONE);
                mButtonSetting.setVisibility(View.GONE);
                mButtonUpload.setVisibility(View.GONE);
                mButtonStart.setVisibility(View.GONE);
                mButtonStop.setVisibility(View.GONE);
                for (int i = 0; i < sampleList.size(); i++) {
                    showWaypoint(new LatLng(sampleList.get(i).getX(), sampleList.get(i).getY()));
                    Waypoint mWaypoint = new Waypoint(sampleList.get(i).getX(), sampleList.get(i).getY(), altitude);
                    //Add Waypoints to Waypoint arraylist;
                    if (waypointMissionBuilder != null) {
                        waypointList.add(mWaypoint);
                        waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
                    } else {
                        waypointMissionBuilder = new WaypointMission.Builder();
                        waypointList.add(mWaypoint);
                        waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
                    }
                }
                aMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(new LatLng(sampleList.get(0).getX(), sampleList.get(0).getY()), 1800)));
                showSettingDialog();
                mButtonSetting.setVisibility(View.VISIBLE);
                mButtonUpload.setVisibility(View.VISIBLE);
            } else {
                Log.d("MainActivity""addSampleSuccess is false or aMap is null");
            }
        }



3


航线管理


创建activity_waypoint.xml和WaypointActivity文件。


activity_waypoint.xml



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.WaypointActivity"
    android:orientation="vertical"
    android:background="@drawable/shape_corner_eight">

    <include
        android:id="@+id/layout_waypoint"
        layout="@layout/activity_toolbar">
include>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#5B6782"
        android:layout_marginTop="1dp"
        android:layout_marginRight="20dp"
        android:layout_marginLeft="20dp"
        >
View>
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv_waypoint"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginRight="20dp"
        android:layout_marginLeft="20dp">
androidx.recyclerview.widget.RecyclerView>
LinearLayout>


WaypointActivity


@Layout(R.layout.activity_waypoint)
public class WaypointActivity extends BaseActivity implements View.OnClickListener {
    @BindView(R.id.layout_waypoint)
    View mViewLayoutToolbar;
    @BindView(R.id.ll_waypoint)
    LinearLayout mLinearLayout;
    @BindView(R.id.tv_toolbar_title)
    TextView mTextViewToolbarTitle;
    @BindView(R.id.rv_waypoint)
    RecyclerView mRecyclerView;

    private SQLiteHelper mSQLiteHelper;
    private List mWaypointInfo = new ArrayList<>();
    private WaypointAdapter mWaypointAdapter;

    private List mWaypointId = new ArrayList<>();
    private String StrId = "";

    @Override
    public void initViews() {
        mLinearLayout.setVisibility(View.VISIBLE);
        mTextViewToolbarTitle.setText("航线管理");
        MyStatic.isChoose = false;
    }

    @Override
    public void initDatas() {
        mSQLiteHelper = new SQLiteHelper(WaypointActivity.this);
        Cursor c = mSQLiteHelper.doSelect();
        if (c!=null){
            while (c.moveToNext()){
                mWaypointInfo.add(new WaypointInfo(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 = new WaypointAdapter(R.layout.item_waypoint);
        mWaypointAdapter.setNewData(mWaypointInfo);
        initRv(mRecyclerView,mWaypointAdapter);
        mWaypointAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                Intent intent = new Intent();
                intent.putExtra("id", mWaypointInfo.get(position).getId());
                setResult(RESULT_OK, intent);
                finish();
            }
        });
        mWaypointAdapter.setOnCheckboxCheckedListener(new WaypointAdapter.OnCheckboxCheckedListener() {
            @Override
            public void OnCheckboxChecked(boolean isCheck, int position) {
                if (isCheck){
                    mWaypointId.add(position);
                }else {
                    if (mWaypointId.contains(position)){
                        mWaypointId.remove(position);
                    }
                }
            }
        });

    }

    @Override
    protected void requestData() {

    }

    @OnClick({R.id.img_way_choose,R.id.img_way_delete,R.id.img_back})
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.img_way_choose:
                if (MyStatic.isChoose){
                    MyStatic.isChoose = false;
                }else {
                    MyStatic.isChoose = true;
                }
                if (mWaypointAdapter!=null){
                    mWaypointAdapter.notifyDataSetChanged();
                }
                break;
            case R.id.img_way_delete:
                if (mWaypointId.size() > 0){
                    for (int i = 0; i < mWaypointId.size(); i++){
                        StrId += mWaypointInfo.get(mWaypointId.get(i)).getId()+",";
                    }
                    if (!TextUtils.isEmpty(StrId)){
                        StrId = StrId.substring(0,StrId.length()-1);
                        mSQLiteHelper = new SQLiteHelper(WaypointActivity.this);
                        mSQLiteHelper.doDelete(StrId);
                        mSQLiteHelper.close();
                        for (int j = 0; j < mWaypointId.size(); j++){
                            mWaypointInfo.remove(mWaypointId.get(j).intValue());
                        }
                        if (mWaypointAdapter!=null){
                            mWaypointId.clear();
                            MyStatic.isChoose = false;
                            mWaypointAdapter.setNewData(mWaypointInfo);
                        }
                    }
                }else {
                    showToasts("请先选择删除的航线!");
                }
                break;
            case R.id.img_back:
                Intent intent = new Intent();
                intent.putExtra("id", -1);
                setResult(RESULT_OK, intent);
                finish();
                break;
        }
    }

以上代码仅供参考,如果想了解更多的大疆无人机二次开发过程可以私信我,源代码因为涉及到商业使用不能给大家共享,有什么问题我可以帮你解决。

往期推荐
  • 毕业设计So Easy:基于C++实现网络扫描器

  • 详解CAN总线:CAN节点硬件构成方案

  • LabVIEW串口通信

  • LabVIEW感兴趣区域分析(实战篇—1)

  • Python Qt GUI设计:信号与槽的使用方法(基础篇—7)

  • 和12岁小同志搞创客开发:如何使用继电器?

  • PCB天线无线模组如何布局摆放?

  • 芯片内部长啥样?牛人用1500张照片,一层一层放给你看!

  • 移柯L620模组使用MQTT协议连接移动OneNet云平台

点击阅读原文,更精彩~

美男子玩编程 多领域、有深度的开发者交流平台
评论 (0)
  • 在人工智能技术飞速发展的今天,语音交互正以颠覆性的方式重塑我们的生活体验。WTK6900系列语音识别芯片凭借其离线高性能、抗噪远场识别、毫秒级响应的核心优势,为智能家居领域注入全新活力。以智能风扇为起点,我们开启一场“解放双手”的科技革命,让每一缕凉风都随“声”而至。一、核心技术:精准识别,无惧环境挑战自适应降噪,听懂你的每一句话WTK6900系列芯片搭载前沿信号处理技术,通过自适应降噪算法,可智能过滤环境噪声干扰。无论是家中电视声、户外虫鸣声,还是厨房烹饪的嘈杂声,芯片均能精准提取有效指令,识
    广州唯创电子 2025-04-08 08:40 146浏览
  • 在全球电子产业面临供应链波动、技术迭代和市场需求变化等多重挑战的背景下,安博电子始终秉持“让合作伙伴赢得更多一点”的核心理念,致力于打造稳健、高效、可持续的全球供应链体系。依托覆盖供应商管理、品质检测、智能交付的全链路品控体系,安博电子不仅能确保电子元器件的高可靠性与一致性,更以高透明的供应链管理模式,助力客户降低风险、提升运营效率,推动行业标准升级,与全球合作伙伴共同塑造更具前瞻性的产业生态。动态优选机制:构建纯净供应链生态安博电子将供应商管理视为供应链安全的根基。打造动态优选管控体系,以严格
    电子资讯报 2025-04-07 17:06 87浏览
  • 在万物互联时代,智能化安防需求持续升级,传统报警系统已难以满足实时性、可靠性与安全性并重的要求。WT2003H-16S低功耗语音芯片方案,以4G实时音频传输、超低功耗设计、端云加密交互为核心,重新定义智能报警设备的性能边界,为家庭、工业、公共安防等领域提供高效、稳定的安全守护。一、技术内核:五大核心突破,构建全场景安防基座1. 双模音频传输,灵活应对复杂场景实时音频流传输:内置高灵敏度MIC,支持环境音实时采集,通过4G模块直接上传至云端服务器,响应速度低至毫秒级,适用于火灾警报、紧急呼救等需即
    广州唯创电子 2025-04-08 08:59 125浏览
  • 文/Leon编辑/cc孙聪颖‍转手绢、跳舞、骑车、后空翻,就在宇树、智元等独角兽企业率领“机器人大军”入侵短视频时,却有资本和科技大佬向此产业泼了一盆冷水。金沙江创投管理合伙人朱啸虎近日突然对人形机器人发难,他表示“最近几个月正在批量退出人形机器人公司”。“只是买回去做研究的,或者买回去做展示的,这种都不是我们意义上的商业化,谁会花十几万买一个机器人去干这些活?”朱啸虎吐槽。不过,朱啸虎的观点很快就遭到驳斥,众擎机器人的创始人、董事长赵同阳回怼道:“(朱啸虎)甚至问出了人形机器人在这个阶段有什么
    华尔街科技眼 2025-04-07 19:24 143浏览
  • 在追求环境质量升级与产业效能突破的当下,温湿度控制正成为横跨多个行业领域的核心命题。作为环境参数中的关键指标,温湿度的精准调控不仅承载着人们对舒适人居环境的期待,更深度关联着工业生产、科研实验及仓储物流等场景的运营效率与安全标准。从应用场景上看,智能家居领域要求温湿度系统实现与人体节律的协同调节,半导体洁净车间要求控制温湿度范围及其波动以保障良品率,而现代化仓储物流体系则依赖温湿度的实时监测预防各种产品的腐损与锈化。温湿度传感器作为实现温湿度监测的关键元器件,其重要性正在各行各业中凸显而出。温湿
    华普微HOPERF 2025-04-07 10:05 130浏览
  •   工业自动化领域电磁兼容与接地系统深度剖析   一、电磁兼容(EMC)基础认知   定义及关键意义   电磁兼容性(EMC),指的是设备或者系统在既定的电磁环境里,不但能按预期功能正常运转,而且不会对周边其他设备或系统造成难以承受的电磁干扰。在工业自动化不断发展的当下,大功率电机、变频器等设备被大量应用,现场总线、工业网络等技术也日益普及,致使工业自动化系统所处的电磁环境变得愈发复杂,电磁兼容(EMC)问题也越发严峻。   ​电磁兼容三大核心要素   屏蔽:屏蔽旨在切断电磁波的传播路
    北京华盛恒辉软件开发 2025-04-07 22:55 180浏览
  • 曾几何时,汽车之家可是汽车资讯平台领域响当当的“扛把子”。2005 年成立之初,它就像一位贴心的汽车小助手,一下子就抓住了大家的心。它不仅吸引了海量用户,更是成为汽车厂商和经销商眼中的“香饽饽”,广告投放、合作推广不断,营收和利润一路高歌猛进,2013年成功在纽交所上市,风光无限。2021年更是在香港二次上市,达到了发展的巅峰,当年3月15日上市首日,港股股价一度高达184.6港元,市值可观。然而,如今的汽车之家却陷入了困境,业务下滑明显。业务增长瓶颈从近年来汽车之家公布的财报数据来看,情况不容
    用户1742991715177 2025-04-07 21:48 106浏览
  • 贞光科技作为三星电机车规电容代理商,针对电动汽车领域日益复杂的电容选型难题,提供全方位一站式解决方案。面对高温稳定性、高可靠性、高纹波电流和小型化等严苛要求,三星车规电容凭借完整产品矩阵和卓越技术优势,完美满足BMS、电机控制器和OBC等核心系统需求。无论技术选型、供应链保障、样品测试还是成本优化,贞光科技助力客户在电动汽车产业高速发展中占据技术先机。在电动汽车技术高速发展的今天,作为汽车电子系统中不可或缺的关键元器件,电容的选型已成为困扰许多工程师和采购人员的难题。如何在众多参数和型号中找到最
    贞光科技 2025-04-07 17:06 68浏览
  • 医疗影像设备(如CT、MRI、超声诊断仪等)对PCB的精度、可靠性和信号完整性要求极高。这类设备需要处理微伏级信号、高频数据传输,同时需通过严格的EMC/EMI测试。制造此类PCB需从材料选择、层叠设计、工艺控制等多维度优化。以下是关键技术与经验分享。 1. 材料选择:高频与生物兼容性优先医疗影像设备PCB常采用 Rogers RO4000系列 或 Isola FR4高速材料,以降低介电损耗并保证信号稳定性。例如,捷多邦在客户案例中曾为某超声探头厂商推荐 Rogers RO4350B
    捷多邦 2025-04-07 10:22 111浏览
  •     在研究Corona现象时发现:临界电压与介电材料表面的清洁程度有关。表面越清洁的介电材料,临界电压越高;表面污染物越多的地方,越容易“爬电”。关于Corona现象,另见基础理论第007篇。    这里说的“污染物”,定义为——可能影响介电强度或表面电阻率的固体、液体或气体(电离气体)的任何情况。    IEC 60664-1 (对应GB/T 16935.1-2023) 定义了 Pollution Degree,中文术语是“污染等
    电子知识打边炉 2025-04-07 22:06 90浏览
  • 及时生产 JIT(Just In Time)的起源JIT 起源于 20 世纪 70 年代爆发的全球石油危机和由此引发的自然资源短缺,这对仰赖进口原物料发展经济的日本冲击最大。当时日本的生产企业为了增强竞争力、提高产品利润,在原物料成本难以降低的情况下,只能从生产和流通过程中寻找利润源,降低库存、库存和运输等方面的生产性费用。根据这种思想,日本丰田汽车公司创立的一种具有特色的现代化生产方式,即 JIT,并由此取得了意想不到的成果。由于它不断地用于汽车生产,随后被越来越多的许多行业和企业所采用,为日
    优思学院 2025-04-07 11:56 106浏览
  • HDMI从2.1版本开始采用FRL传输模式,和2.0及之前的版本不同。两者在物理层信号上有所区别,这就需要在一些2.1版本的电路设计上增加匹配电路,使得2.1版本的电路能够向下兼容2.0及之前版本。2.1版本的信号特性下面截取自2.1版本规范定义,可以看到2.1版本支持直流耦合和交流耦合,其共模电压和AVCC相关,信号摆幅在400mV-1200mV2.0及之前版本的信号特性HDMI2.0及之前版本采用TMDS信号物理层,其结构和参数如下:兼容设计根据以上规范定义,可以看出TMDS信号的共模电压范
    durid 2025-04-08 19:01 121浏览
  •     根据 IEC术语,瞬态过电压是指持续时间几个毫秒及以下的过高电压,通常是以高阻尼(快速衰减)形式出现,波形可以是振荡的,也可以是非振荡的。    瞬态过电压的成因和机理,IEC 60664-1给出了以下四种:    1. 自然放电,最典型的例子是雷击,感应到电力线路上,并通过电网配电系统传输,抵达用户端;        2. 电网中非特定感性负载通断。例如热处理工厂、机加工工厂对
    电子知识打边炉 2025-04-07 22:59 117浏览
我要评论
0
0
点击右上角,分享到朋友圈 我知道啦
请使用浏览器分享功能 我知道啦