/* * Use this function to tell the copter what data you want to see and how often */ private void RequestMav() { Msg_request_data_stream ds = new Msg_request_data_stream(); ds.req_message_rate = 2; ds.req_stream_id = (byte)MAV_DATA_STREAM.MAV_DATA_STREAM_ALL; ds.start_stop = 1; ds.target_component = (byte)MAV_COMPONENT.MAV_COMP_ID_ALL; ds.target_system = (byte)Systemid; SendPacket(ds); }
// Use this for initialization void Start() { SystemId = (byte)MAV_MODE.MAV_MODE_MANUAL_ARMED; ComponentId = (byte)MAV_COMPONENT.MAV_COMP_ID_AUTOPILOT1; Application.runInBackground = true; mlpn = new Msg_local_position_ned(); mgpi = new Msg_global_position_int(); Mheratbeat = new Msg_heartbeat(); Msts = new Msg_sys_status(); Matt = new Msg_attitude(); Mdatastream = new Msg_request_data_stream(); Mgpsr = new Msg_gps_raw_int(); Mattq = new Msg_attitude_quaternion(); Mvhud = new Msg_vfr_hud(); MattTar = new Msg_attitude_target(); MHome = new Msg_home_position(); setMHome = new Msg_set_home_position(); setMode = new Msg_set_mode(); EstimatorStatus = new Msg_estimator_status(); Mvirbration = new Msg_vibration(); ExtendState = new Msg_extended_sys_state(); latlonalt = new LatLonAlt(); Malt = new Msg_altitude(); positionL = new Msg_position_target_local_ned(); setPositionL = new Msg_set_position_target_local_ned(); setPositionG = new Msg_set_position_target_global_int(); PositionG = new Msg_position_target_global_int(); MhiIMU = new Msg_highres_imu(); BatteryStatus = new Msg_battery_status(); player = GameObject.FindGameObjectWithTag("Player"); DM = player.GetComponent <DroneMove> (); InitSocket(); setHomePosition(); setPositionTargetLocal(); setPositionTargetGlobal(); }