C# Class MissionPlanner.MAVLinkInterface

Inheritance: MAVLink, IDisposable
显示文件 Open project: ArduPilot/MissionPlanner Class Usage Examples

Public Properties

Property Type Description
CONNECT_TIMEOUT_SECONDS double
MAVlist MAVList
ReadOnly bool
Terrain MissionPlanner.Utilities.TerrainFollow
speechenabled bool

Private Properties

Property Type Description
FrmProgressReporterDoWorkAndParams void
FrmProgressReporterDoWorkNOParams void
FrmProgressReporterGetParams void
OpenBg void
PacketReceived void
SetupMavConnect void
doAction bool
generatePacket void
generatePacket void
generatePacket void
getDatastream void
getDatastream void
getParamListBG System.Collections.Hashtable
getWPsfromstream void
hzratecheck bool
readlogPacketMavlink MAVLinkMessage

Public Methods

Method Description
Close ( ) : void
DebugPacket ( MAVLinkMessage datin ) : object
DebugPacket ( MAVLinkMessage datin, bool PrintToConsole ) : object
DebugPacket ( MAVLinkMessage datin, string &text ) : object
DebugPacket ( MAVLinkMessage datin, string &text, bool PrintToConsole, string delimeter = " " ) : object

Print entire decoded packet to console

Dispose ( ) : void
EraseLog ( ) : void
GetLog ( ushort no ) : FileStream
GetLogEntry ( ushort startno, ushort endno = ushort.MaxValue ) : mavlink_log_entry_t
GetLogList ( ) : List
GetMountStatus ( ) : void
GetParam ( byte sysid, byte compid, string name = "", short index = -1, bool requireresponce = true ) : float

Get param by either index or name

GetParam ( short index ) : float
GetParam ( string name ) : float
GetParam ( string name = "", short index = -1, bool requireresponce = true ) : float
InjectGpsData ( byte data, byte length ) : void
InjectGpsData ( byte sysid, byte compid, byte data, byte length, bool rtcm_message = true ) : void

used to inject data into the gps ie rtcm/sbp/ubx

MAVLinkInterface ( ) : System
MAVLinkInterface ( Stream logfileStream ) : System
Open ( ) : void
Open ( bool getparams, bool skipconnectedcheck = false ) : void
SendAck ( ) : void
SendSerialControl ( SERIAL_CONTROL_DEV port, ushort timeoutms, byte data, uint baudrate, bool close = false ) : void
SetSensorOffsets ( sensoroffsetsenum sensor, float x, float y, float z ) : bool
SubscribeToPacketType ( MAVLINK_MSG_ID type, bool>.Func function, bool exclusive = false ) : KeyValuePair>
ToString ( ) : string
UnSubscribeToPacketType ( bool>.KeyValuePair item ) : void
UnSubscribeToPacketType ( MAVLINK_MSG_ID msgtype, bool>.Func item ) : void
Write ( string line ) : bool
disableSigning ( int sysid, int compid ) : bool
doARM ( bool armit ) : bool
doARM ( byte sysid, byte compid, bool armit ) : bool
doAbortLand ( ) : bool
doCommand ( MAV_CMD actionid, float p1, float p2, float p3, float p4, float p5, float p6, float p7, bool requireack = true ) : bool
doCommand ( byte sysid, byte compid, MAV_CMD actionid, float p1, float p2, float p3, float p4, float p5, float p6, float p7, bool requireack = true ) : bool
doMotorTest ( int motor, MAVLink thr_type, int throttle, int timeout, int motorcount ) : bool
doReboot ( bool bootloadermode = false, bool currentvehicle = true ) : bool

reboot the vehicle

enableSigning ( int sysid, int compid ) : bool
getFencePoint ( int no, int &total ) : MissionPlanner.Utilities.PointLatLngAlt
getHeartBeat ( ) : MAVLinkMessage
getHomePosition ( ) : Locationwp
getParamList ( ) : void
getParamPoll ( ) : void
getRallyPoint ( int no, int &total ) : MissionPlanner.Utilities.PointLatLngAlt
getRallyPoints ( ) : List
getRequestedWPNo ( ) : int
getVersion ( ) : bool
getWP ( ushort index ) : Locationwp

Gets specfied WP

getWPCount ( ) : ushort

Returns WP count

modifyParamForDisplay ( bool fromapm, string paramname, float &value ) : void
readPacket ( ) : MAVLinkMessage

Serial Reader to read mavlink packets. POLL method

requestDatastream ( MAVLink id, byte hzrate, int sysid = -1, int compid = -1 ) : void
sendPacket ( object indata, int sysid, int compid ) : void
setAPType ( byte sysid, byte compid ) : void
setAttitudeTarget ( ) : void
setDigicamConfigure ( ) : void
setDigicamControl ( bool shot ) : void
setFencePoint ( byte index, PointLatLngAlt plla, byte fencepointcount ) : bool
setGuidedModeWP ( Locationwp gotohere, bool setguidedmode = true ) : void
setMode ( byte sysid, byte compid, mavlink_set_mode_t mode, MAV_MODE_FLAG base_mode ) : void
setMode ( byte sysid, byte compid, string modein ) : void
setMode ( mavlink_set_mode_t mode, MAV_MODE_FLAG base_mode ) : void
setMode ( string modein ) : void
setMountConfigure ( MAV_MOUNT_MODE mountmode, bool stabroll, bool stabpitch, bool stabyaw ) : void
setMountControl ( double pa, double pb, double pc, bool islatlng ) : void
setNewWPAlt ( Locationwp gotohere ) : void
setNextWPTargetAlt ( ushort wpno, float alt ) : void
setParam ( byte sysid, byte compid, string paramname, double value, bool force = false ) : bool

Set parameter on apm

setParam ( string paramnames, double value ) : bool

set param on apm, used for param rename

setParam ( string paramname, double value, bool force = false ) : bool
setPositionTargetGlobalInt ( byte sysid, byte compid, bool pos, bool vel, bool acc, MAV_FRAME frame, double lat, double lng, double alt, double vx, double vy, double vz ) : void
setRallyPoint ( byte index, PointLatLngAlt plla, short break_alt, UInt16 land_dir_cd, byte flags, byte rallypointcount ) : bool
setWP ( Locationwp loc, ushort index, MAV_FRAME frame, byte current, byte autocontinue = 1, bool use_int = false ) : MAV_MISSION_RESULT

Save wp to eeprom

setWP ( mavlink_mission_item_int_t req ) : MAV_MISSION_RESULT
setWP ( mavlink_mission_item_t req ) : MAV_MISSION_RESULT
setWPACK ( ) : void
setWPCurrent ( ushort index ) : bool
setWPPartialUpdate ( ushort startwp, ushort endwp ) : void

Set start and finish for partial wp upload.

setWPTotal ( ushort wp_total ) : void

Sets wp total count

setupSigning ( string userseed, byte key = null ) : bool
stopall ( bool forget ) : void

Stops all requested data packets.

translateMode ( byte sysid, byte compid, string modein, MAVLink &mode ) : bool
translateMode ( string modein, MAVLink &mode ) : bool

Private Methods

Method Description
FrmProgressReporterDoWorkAndParams ( object sender, MissionPlanner.Controls.ProgressWorkerEventArgs e, object passdata = null ) : void
FrmProgressReporterDoWorkNOParams ( object sender, MissionPlanner.Controls.ProgressWorkerEventArgs e, object passdata = null ) : void
FrmProgressReporterGetParams ( object sender, MissionPlanner.Controls.ProgressWorkerEventArgs e, object passdata = null ) : void
OpenBg ( object PRsender, bool getparams, MissionPlanner.Controls.ProgressWorkerEventArgs progressWorkerEventArgs ) : void
PacketReceived ( MAVLinkMessage buffer ) : void
SetupMavConnect ( MAVLinkMessage message, mavlink_heartbeat_t hb ) : void
doAction ( object actionid ) : bool
generatePacket ( MAVLINK_MSG_ID messageType, object indata ) : void
generatePacket ( int messageType, object indata ) : void
generatePacket ( int messageType, object indata, int sysid, int compid, bool forcemavlink2 = false, bool forcesigning = false ) : void

Generate a Mavlink Packet and write to serial

getDatastream ( MAVLink id, byte hzrate ) : void
getDatastream ( byte sysid, byte compid, MAVLink id, byte hzrate ) : void
getParamListBG ( ) : Hashtable

Get param list from apm

getWPsfromstream ( MAVLinkMessage &buffer, byte sysid, byte compid ) : void

Used to extract mission from log file - both sent or received

hzratecheck ( double pps, int hzrate ) : bool
readlogPacketMavlink ( ) : MAVLinkMessage

Method Details

Close() public method

public Close ( ) : void
return void

DebugPacket() public method

public DebugPacket ( MAVLinkMessage datin ) : object
datin MAVLinkMessage
return object

DebugPacket() public method

public DebugPacket ( MAVLinkMessage datin, bool PrintToConsole ) : object
datin MAVLinkMessage
PrintToConsole bool
return object

DebugPacket() public method

public DebugPacket ( MAVLinkMessage datin, string &text ) : object
datin MAVLinkMessage
text string
return object

DebugPacket() public method

Print entire decoded packet to console
public DebugPacket ( MAVLinkMessage datin, string &text, bool PrintToConsole, string delimeter = " " ) : object
datin MAVLinkMessage packet byte array
text string
PrintToConsole bool
delimeter string
return object

Dispose() public method

public Dispose ( ) : void
return void

EraseLog() public method

public EraseLog ( ) : void
return void

GetLog() public method

public GetLog ( ushort no ) : FileStream
no ushort
return System.IO.FileStream

GetLogEntry() public method

public GetLogEntry ( ushort startno, ushort endno = ushort.MaxValue ) : mavlink_log_entry_t
startno ushort
endno ushort
return mavlink_log_entry_t

GetLogList() public method

public GetLogList ( ) : List
return List

GetMountStatus() public method

public GetMountStatus ( ) : void
return void

GetParam() public method

Get param by either index or name
public GetParam ( byte sysid, byte compid, string name = "", short index = -1, bool requireresponce = true ) : float
sysid byte
compid byte
name string
index short
requireresponce bool
return float

GetParam() public method

public GetParam ( short index ) : float
index short
return float

GetParam() public method

public GetParam ( string name ) : float
name string
return float

GetParam() public method

public GetParam ( string name = "", short index = -1, bool requireresponce = true ) : float
name string
index short
requireresponce bool
return float

InjectGpsData() public method

public InjectGpsData ( byte data, byte length ) : void
data byte
length byte
return void

InjectGpsData() public method

used to inject data into the gps ie rtcm/sbp/ubx
public InjectGpsData ( byte sysid, byte compid, byte data, byte length, bool rtcm_message = true ) : void
sysid byte
compid byte
data byte
length byte
rtcm_message bool
return void

MAVLinkInterface() public method

public MAVLinkInterface ( ) : System
return System

MAVLinkInterface() public method

public MAVLinkInterface ( Stream logfileStream ) : System
logfileStream Stream
return System

Open() public method

public Open ( ) : void
return void

Open() public method

public Open ( bool getparams, bool skipconnectedcheck = false ) : void
getparams bool
skipconnectedcheck bool
return void

SendAck() public method

public SendAck ( ) : void
return void

SendSerialControl() public method

public SendSerialControl ( SERIAL_CONTROL_DEV port, ushort timeoutms, byte data, uint baudrate, bool close = false ) : void
port SERIAL_CONTROL_DEV
timeoutms ushort
data byte
baudrate uint
close bool
return void

SetSensorOffsets() public method

public SetSensorOffsets ( sensoroffsetsenum sensor, float x, float y, float z ) : bool
sensor sensoroffsetsenum
x float
y float
z float
return bool

SubscribeToPacketType() public method

public SubscribeToPacketType ( MAVLINK_MSG_ID type, bool>.Func function, bool exclusive = false ) : KeyValuePair>
type MAVLINK_MSG_ID
function bool>.Func
exclusive bool
return KeyValuePair>

ToString() public method

public ToString ( ) : string
return string

UnSubscribeToPacketType() public method

public UnSubscribeToPacketType ( bool>.KeyValuePair item ) : void
item bool>.KeyValuePair
return void

UnSubscribeToPacketType() public method

public UnSubscribeToPacketType ( MAVLINK_MSG_ID msgtype, bool>.Func item ) : void
msgtype MAVLINK_MSG_ID
item bool>.Func
return void

Write() public method

public Write ( string line ) : bool
line string
return bool

disableSigning() public method

public disableSigning ( int sysid, int compid ) : bool
sysid int
compid int
return bool

doARM() public method

public doARM ( bool armit ) : bool
armit bool
return bool

doARM() public method

public doARM ( byte sysid, byte compid, bool armit ) : bool
sysid byte
compid byte
armit bool
return bool

doAbortLand() public method

public doAbortLand ( ) : bool
return bool

doCommand() public method

public doCommand ( MAV_CMD actionid, float p1, float p2, float p3, float p4, float p5, float p6, float p7, bool requireack = true ) : bool
actionid MAV_CMD
p1 float
p2 float
p3 float
p4 float
p5 float
p6 float
p7 float
requireack bool
return bool

doCommand() public method

public doCommand ( byte sysid, byte compid, MAV_CMD actionid, float p1, float p2, float p3, float p4, float p5, float p6, float p7, bool requireack = true ) : bool
sysid byte
compid byte
actionid MAV_CMD
p1 float
p2 float
p3 float
p4 float
p5 float
p6 float
p7 float
requireack bool
return bool

doMotorTest() public method

public doMotorTest ( int motor, MAVLink thr_type, int throttle, int timeout, int motorcount ) : bool
motor int
thr_type MAVLink
throttle int
timeout int
motorcount int
return bool

doReboot() public method

reboot the vehicle
public doReboot ( bool bootloadermode = false, bool currentvehicle = true ) : bool
bootloadermode bool reboot into bootloader mode?
currentvehicle bool use current sysid/compid or scan for it
return bool

enableSigning() public method

public enableSigning ( int sysid, int compid ) : bool
sysid int
compid int
return bool

getFencePoint() public method

public getFencePoint ( int no, int &total ) : MissionPlanner.Utilities.PointLatLngAlt
no int
total int
return MissionPlanner.Utilities.PointLatLngAlt

getHeartBeat() public method

public getHeartBeat ( ) : MAVLinkMessage
return MAVLinkMessage

getHomePosition() public method

public getHomePosition ( ) : Locationwp
return MissionPlanner.Utilities.Locationwp

getParamList() public method

public getParamList ( ) : void
return void

getParamPoll() public method

public getParamPoll ( ) : void
return void

getRallyPoint() public method

public getRallyPoint ( int no, int &total ) : MissionPlanner.Utilities.PointLatLngAlt
no int
total int
return MissionPlanner.Utilities.PointLatLngAlt

getRallyPoints() public method

public getRallyPoints ( ) : List
return List

getRequestedWPNo() public method

public getRequestedWPNo ( ) : int
return int

getVersion() public method

public getVersion ( ) : bool
return bool

getWP() public method

Gets specfied WP
public getWP ( ushort index ) : Locationwp
index ushort
return MissionPlanner.Utilities.Locationwp

getWPCount() public method

Returns WP count
public getWPCount ( ) : ushort
return ushort

modifyParamForDisplay() public static method

public static modifyParamForDisplay ( bool fromapm, string paramname, float &value ) : void
fromapm bool
paramname string
value float
return void

readPacket() public method

Serial Reader to read mavlink packets. POLL method
public readPacket ( ) : MAVLinkMessage
return MAVLinkMessage

requestDatastream() public method

public requestDatastream ( MAVLink id, byte hzrate, int sysid = -1, int compid = -1 ) : void
id MAVLink
hzrate byte
sysid int
compid int
return void

sendPacket() public method

public sendPacket ( object indata, int sysid, int compid ) : void
indata object
sysid int
compid int
return void

setAPType() public method

public setAPType ( byte sysid, byte compid ) : void
sysid byte
compid byte
return void

setAttitudeTarget() public method

public setAttitudeTarget ( ) : void
return void

setDigicamConfigure() public method

public setDigicamConfigure ( ) : void
return void

setDigicamControl() public method

public setDigicamControl ( bool shot ) : void
shot bool
return void

setFencePoint() public method

public setFencePoint ( byte index, PointLatLngAlt plla, byte fencepointcount ) : bool
index byte
plla PointLatLngAlt
fencepointcount byte
return bool

setGuidedModeWP() public method

public setGuidedModeWP ( Locationwp gotohere, bool setguidedmode = true ) : void
gotohere Locationwp
setguidedmode bool
return void

setMode() public method

public setMode ( byte sysid, byte compid, mavlink_set_mode_t mode, MAV_MODE_FLAG base_mode ) : void
sysid byte
compid byte
mode mavlink_set_mode_t
base_mode MAV_MODE_FLAG
return void

setMode() public method

public setMode ( byte sysid, byte compid, string modein ) : void
sysid byte
compid byte
modein string
return void

setMode() public method

public setMode ( mavlink_set_mode_t mode, MAV_MODE_FLAG base_mode ) : void
mode mavlink_set_mode_t
base_mode MAV_MODE_FLAG
return void

setMode() public method

public setMode ( string modein ) : void
modein string
return void

setMountConfigure() public method

public setMountConfigure ( MAV_MOUNT_MODE mountmode, bool stabroll, bool stabpitch, bool stabyaw ) : void
mountmode MAV_MOUNT_MODE
stabroll bool
stabpitch bool
stabyaw bool
return void

setMountControl() public method

public setMountControl ( double pa, double pb, double pc, bool islatlng ) : void
pa double
pb double
pc double
islatlng bool
return void

setNewWPAlt() public method

public setNewWPAlt ( Locationwp gotohere ) : void
gotohere Locationwp
return void

setNextWPTargetAlt() public method

public setNextWPTargetAlt ( ushort wpno, float alt ) : void
wpno ushort
alt float
return void

setParam() public method

Set parameter on apm
public setParam ( byte sysid, byte compid, string paramname, double value, bool force = false ) : bool
sysid byte
compid byte
paramname string name as a string
value double
force bool
return bool

setParam() public method

set param on apm, used for param rename
public setParam ( string paramnames, double value ) : bool
paramnames string
value double
return bool

setParam() public method

public setParam ( string paramname, double value, bool force = false ) : bool
paramname string
value double
force bool
return bool

setPositionTargetGlobalInt() public method

public setPositionTargetGlobalInt ( byte sysid, byte compid, bool pos, bool vel, bool acc, MAV_FRAME frame, double lat, double lng, double alt, double vx, double vy, double vz ) : void
sysid byte
compid byte
pos bool
vel bool
acc bool
frame MAV_FRAME
lat double
lng double
alt double
vx double
vy double
vz double
return void

setRallyPoint() public method

public setRallyPoint ( byte index, PointLatLngAlt plla, short break_alt, UInt16 land_dir_cd, byte flags, byte rallypointcount ) : bool
index byte
plla PointLatLngAlt
break_alt short
land_dir_cd UInt16
flags byte
rallypointcount byte
return bool

setWP() public method

Save wp to eeprom
public setWP ( Locationwp loc, ushort index, MAV_FRAME frame, byte current, byte autocontinue = 1, bool use_int = false ) : MAV_MISSION_RESULT
loc Locationwp location struct
index ushort wp no
frame MAV_FRAME global or relative
current byte 0 = no , 2 = guided mode
autocontinue byte
use_int bool
return MAV_MISSION_RESULT

setWP() public method

public setWP ( mavlink_mission_item_int_t req ) : MAV_MISSION_RESULT
req mavlink_mission_item_int_t
return MAV_MISSION_RESULT

setWP() public method

public setWP ( mavlink_mission_item_t req ) : MAV_MISSION_RESULT
req mavlink_mission_item_t
return MAV_MISSION_RESULT

setWPACK() public method

public setWPACK ( ) : void
return void

setWPCurrent() public method

public setWPCurrent ( ushort index ) : bool
index ushort
return bool

setWPPartialUpdate() public method

Set start and finish for partial wp upload.
public setWPPartialUpdate ( ushort startwp, ushort endwp ) : void
startwp ushort
endwp ushort
return void

setWPTotal() public method

Sets wp total count
public setWPTotal ( ushort wp_total ) : void
wp_total ushort
return void

setupSigning() public method

public setupSigning ( string userseed, byte key = null ) : bool
userseed string
key byte
return bool

stopall() public method

Stops all requested data packets.
public stopall ( bool forget ) : void
forget bool
return void

translateMode() public method

public translateMode ( byte sysid, byte compid, string modein, MAVLink &mode ) : bool
sysid byte
compid byte
modein string
mode MAVLink
return bool

translateMode() public method

public translateMode ( string modein, MAVLink &mode ) : bool
modein string
mode MAVLink
return bool

Property Details

CONNECT_TIMEOUT_SECONDS public_oe property

public double CONNECT_TIMEOUT_SECONDS
return double

MAVlist public_oe property

public MAVList MAVlist
return MAVList

ReadOnly public_oe property

public bool ReadOnly
return bool

Terrain public_oe property

public TerrainFollow,MissionPlanner.Utilities Terrain
return MissionPlanner.Utilities.TerrainFollow

speechenabled public_oe property

used to disable all speech originating from this module
public bool speechenabled
return bool