From aeb4c6a32326ef6bd7f6bf77cd4bb00d2fabac6d Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 23 Mar 2015 23:38:37 +0100 Subject: use common mavlink dialect; temporary disabling of instruments --- mavlink/common.xml | 2669 ++++++++++++++++++++ mavlink/concise.xml | 106 - project/Build.scala | 3 +- project/plugins.sbt | 2 +- .../vfd/dashboard/ui/panels/Communication.scala | 20 +- .../scala/vfd/dashboard/ui/panels/Primary.scala | 5 +- .../src/main/scala/vfd/index/ActiveVehicle.scala | 44 + vfd-index/src/main/scala/vfd/index/Main.scala | 14 +- vfd-uav/src/main/scala/vfd/uav/Connection.scala | 6 +- vfd-uav/src/main/scala/vfd/uav/MavlinkUtil.scala | 13 +- .../src/main/scala/vfd/uav/MockConnection.scala | 46 +- .../src/main/scala/vfd/uav/SerialConnection.scala | 28 +- 12 files changed, 2778 insertions(+), 178 deletions(-) create mode 100644 mavlink/common.xml delete mode 100644 mavlink/concise.xml create mode 100644 vfd-index/src/main/scala/vfd/index/ActiveVehicle.scala diff --git a/mavlink/common.xml b/mavlink/common.xml new file mode 100644 index 0000000..7f35f07 --- /dev/null +++ b/mavlink/common.xml @@ -0,0 +1,2669 @@ + + + 3 + + + Micro air vehicle / autopilot classes. This identifies the individual model. + + Generic autopilot, full support for everything + + + PIXHAWK autopilot, http://pixhawk.ethz.ch + + + SLUGS autopilot, http://slugsuav.soe.ucsc.edu + + + ArduPilotMega / ArduCopter, http://diydrones.com + + + OpenPilot, http://openpilot.org + + + Generic autopilot only supporting simple waypoints + + + Generic autopilot supporting waypoints and other simple navigation commands + + + Generic autopilot supporting the full mission command set + + + No valid autopilot, e.g. a GCS or other MAVLink component + + + PPZ UAV - http://nongnu.org/paparazzi + + + UAV Dev Board + + + FlexiPilot + + + PX4 Autopilot - http://pixhawk.ethz.ch/px4/ + + + SMACCMPilot - http://smaccmpilot.org + + + AutoQuad -- http://autoquad.org + + + Armazila -- http://armazila.com + + + Aerob -- http://aerob.ru + + + ASLUAV autopilot -- http://www.asl.ethz.ch + + + + + Generic micro air vehicle. + + + Fixed wing aircraft. + + + Quadrotor + + + Coaxial helicopter + + + Normal helicopter with tail rotor. + + + Ground installation + + + Operator control unit / ground control station + + + Airship, controlled + + + Free balloon, uncontrolled + + + Rocket + + + Ground rover + + + Surface vessel, boat, ship + + + Submarine + + + Hexarotor + + + Octorotor + + + Octorotor + + + Flapping wing + + + Flapping wing + + + Onboard companion controller + + + Two-rotor VTOL using control surfaces in vertical operation in addition. Tailsitter. + + + Quad-rotor VTOL using a V-shaped quad config in vertical operation. Tailsitter. + + + + VTOL reserved 1 + + + VTOL reserved 2 + + + VTOL reserved 3 + + + VTOL reserved 4 + + + VTOL reserved 5 + + + Onboard gimbal + + + + + These flags encode the MAV mode. + + 0b10000000 MAV safety set to armed. Motors are enabled / running / can start. Ready to fly. + + + 0b01000000 remote control input is enabled. + + + 0b00100000 hardware in the loop simulation. All motors / actuators are blocked, but internal software is full operational. + + + 0b00010000 system stabilizes electronically its attitude (and optionally position). It needs however further control inputs to move around. + + + 0b00001000 guided mode enabled, system flies MISSIONs / mission items. + + + 0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation. + + + 0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations. + + + 0b00000001 Reserved for future use. + + + + These values encode the bit positions of the decode position. These values can be used to read the value of a flag bit by combining the base_mode variable with AND with the flag position value. The result will be either 0 or 1, depending on if the flag is set or not. + + First bit: 10000000 + + + Second bit: 01000000 + + + Third bit: 00100000 + + + Fourth bit: 00010000 + + + Fifth bit: 00001000 + + + Sixt bit: 00000100 + + + Seventh bit: 00000010 + + + Eighth bit: 00000001 + + + + Override command, pauses current mission execution and moves immediately to a position + + Hold at the current position. + + + Continue with the next item in mission execution. + + + Hold at the current position of the system + + + Hold at the position specified in the parameters of the DO_HOLD action + + + + These defines are predefined OR-combined mode flags. There is no need to use values from this enum, but it + simplifies the use of the mode flags. Note that manual input is enabled in all modes as a safety override. + + System is not ready to fly, booting, calibrating, etc. No flag is set. + + + System is allowed to be active, under assisted RC control. + + + System is allowed to be active, under assisted RC control. + + + System is allowed to be active, under manual (RC) control, no stabilization + + + System is allowed to be active, under manual (RC) control, no stabilization + + + System is allowed to be active, under autonomous control, manual setpoint + + + System is allowed to be active, under autonomous control, manual setpoint + + + System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by MISSIONs) + + + System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by MISSIONs) + + + UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. + + + UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. + + + + + Uninitialized system, state is unknown. + + + System is booting up. + + + System is calibrating and not flight-ready. + + + System is grounded and on standby. It can be launched any time. + + + System is active and might be already airborne. Motors are engaged. + + + System is in a non-normal flight mode. It can however still navigate. + + + System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down. + + + System just initialized its power-down sequence, will shut down now. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + These encode the sensors whose status is sent as part of the SYS_STATUS message. + + 0x01 3D gyro + + + 0x02 3D accelerometer + + + 0x04 3D magnetometer + + + 0x08 absolute pressure + + + 0x10 differential pressure + + + 0x20 GPS + + + 0x40 optical flow + + + 0x80 computer vision position + + + 0x100 laser based position + + + 0x200 external ground truth (Vicon or Leica) + + + 0x400 3D angular rate control + + + 0x800 attitude stabilization + + + 0x1000 yaw position + + + 0x2000 z/altitude control + + + 0x4000 x/y position control + + + 0x8000 motor outputs / control + + + 0x10000 rc receiver + + + 0x20000 2nd 3D gyro + + + 0x40000 2nd 3D accelerometer + + + 0x80000 2nd 3D magnetometer + + + 0x100000 geofence + + + 0x200000 AHRS subsystem health + + + 0x400000 Terrain subsystem health + + + + + Global coordinate frame, WGS84 coordinate system. First value / x: latitude, second value / y: longitude, third value / z: positive altitude over mean sea level (MSL) + + + Local coordinate frame, Z-up (x: north, y: east, z: down). + + + NOT a coordinate frame, indicates a mission command. + + + Global coordinate frame, WGS84 coordinate system, relative altitude over ground with respect to the home position. First value / x: latitude, second value / y: longitude, third value / z: positive altitude with 0 being at the altitude of the home location. + + + Local coordinate frame, Z-down (x: east, y: north, z: up) + + + Global coordinate frame, WGS84 coordinate system. First value / x: latitude in degrees*1.0e-7, second value / y: longitude in degrees*1.0e-7, third value / z: positive altitude over mean sea level (MSL) + + + Global coordinate frame, WGS84 coordinate system, relative altitude over ground with respect to the home position. First value / x: latitude in degrees*10e-7, second value / y: longitude in degrees*10e-7, third value / z: positive altitude with 0 being at the altitude of the home location. + + + Offset to the current local frame. Anything expressed in this frame should be added to the current local frame position. + + + Setpoint in body NED frame. This makes sense if all position control is externalized - e.g. useful to command 2 m/s^2 acceleration to the right. + + + Offset in body NED frame. This makes sense if adding setpoints to the current flight path, to avoid an obstacle - e.g. useful to command 2 m/s^2 acceleration to the east. + + + Global coordinate frame with above terrain level altitude. WGS84 coordinate system, relative altitude over terrain with respect to the waypoint coordinate. First value / x: latitude in degrees, second value / y: longitude in degrees, third value / z: positive altitude in meters with 0 being at ground level in terrain model. + + + Global coordinate frame with above terrain level altitude. WGS84 coordinate system, relative altitude over terrain with respect to the waypoint coordinate. First value / x: latitude in degrees*10e-7, second value / y: longitude in degrees*10e-7, third value / z: positive altitude in meters with 0 being at ground level in terrain model. + + + + + + + + + + + + + + + + + + + + + + + + + + Disable fenced mode + + + Switched to guided mode to return point (fence point 0) + + + Report fence breach, but don't take action + + + Switched to guided mode to return point (fence point 0) with manual throttle control + + + + + + No last fence breach + + + Breached minimum altitude + + + Breached maximum altitude + + + Breached fence boundary + + + + + Enumeration of possible mount operation modes + Load and keep safe position (Roll,Pitch,Yaw) from permant memory and stop stabilization + Load and keep neutral position (Roll,Pitch,Yaw) from permanent memory. + Load neutral position and start MAVLink Roll,Pitch,Yaw control with stabilization + Load neutral position and start RC Roll,Pitch,Yaw control with stabilization + Load neutral position and start to point to Lat,Lon,Alt + + + Commands to be executed by the MAV. They can be executed on user request, or as part of a mission script. If the action is used in a mission, the parameter mapping to the waypoint/mission message is as follows: Param 1, Param 2, Param 3, Param 4, X: Param 5, Y:Param 6, Z:Param 7. This command list is similar what ARINC 424 is for commercial aircraft: A data format how to interpret waypoint/mission data. + + Navigate to MISSION. + Hold time in decimal seconds. (ignored by fixed wing, time to stay at MISSION for rotary wing) + Acceptance radius in meters (if the sphere with this radius is hit, the MISSION counts as reached) + 0 to pass through the WP, if > 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control. + Desired yaw angle at MISSION (rotary wing) + Latitude + Longitude + Altitude + + + Loiter around this MISSION an unlimited amount of time + Empty + Empty + Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise + Desired yaw angle. + Latitude + Longitude + Altitude + + + Loiter around this MISSION for X turns + Turns + Empty + Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise + Desired yaw angle. + Latitude + Longitude + Altitude + + + Loiter around this MISSION for X seconds + Seconds (decimal) + Empty + Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise + Desired yaw angle. + Latitude + Longitude + Altitude + + + Return to launch location + Empty + Empty + Empty + Empty + Empty + Empty + Empty + + + Land at location + Empty + Empty + Empty + Desired yaw angle. + Latitude + Longitude + Altitude + + + Takeoff from ground / hand + Minimum pitch (if airspeed sensor present), desired pitch without sensor + Empty + Empty + Yaw angle (if magnetometer present), ignored without magnetometer + Latitude + Longitude + Altitude + + + Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. + Empty + Empty + Empty + Empty + Empty + Empty + Desired altitude in meters + + + Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras. + Region of intereset mode. (see MAV_ROI enum) + MISSION index/ target ID. (see MAV_ROI enum) + ROI index (allows a vehicle to manage multiple ROI's) + Empty + x the location of the fixed ROI (see MAV_FRAME) + y + z + + + Control autonomous path planning on the MAV. + 0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning + 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid + Empty + Yaw angle at goal, in compass degrees, [0..360] + Latitude/X of goal + Longitude/Y of goal + Altitude/Z of goal + + + Navigate to MISSION using a spline path. + Hold time in decimal seconds. (ignored by fixed wing, time to stay at MISSION for rotary wing) + Empty + Empty + Empty + Latitude/X of goal + Longitude/Y of goal + Altitude/Z of goal + + + + + + hand control over to an external controller + On / Off (> 0.5f on) + Empty + Empty + Empty + Empty + Empty + Empty + + + NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration + Empty + Empty + Empty + Empty + Empty + Empty + Empty + + + Delay mission state machine. + Delay in seconds (decimal) + Empty + Empty + Empty + Empty + Empty + Empty + + + Ascend/descend at rate. Delay mission state machine until desired altitude reached. + Descent / Ascend rate (m/s) + Empty + Empty + Empty + Empty + Empty + Finish Altitude + + + Delay mission state machine until within desired distance of next NAV point. + Distance (meters) + Empty + Empty + Empty + Empty + Empty + Empty + + + Reach a certain target angle. + target angle: [0-360], 0 is north + speed during yaw change:[deg per second] + direction: negative: counter clockwise, positive: clockwise [-1,1] + relative offset or absolute angle: [ 1,0] + Empty + Empty + Empty + + + NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration + Empty + Empty + Empty + Empty + Empty + Empty + Empty + + + Set system mode. + Mode, as defined by ENUM MAV_MODE + Custom mode - this is system specific, please refer to the individual autopilot specifications for details. + Empty + Empty + Empty + Empty + Empty + + + Jump to the desired command in the mission list. Repeat this action only the specified number of times + Sequence number + Repeat count + Empty + Empty + Empty + Empty + Empty + + + Change speed and/or throttle set points. + Speed type (0=Airspeed, 1=Ground Speed) + Speed (m/s, -1 indicates no change) + Throttle ( Percent, -1 indicates no change) + Empty + Empty + Empty + Empty + + + Changes the home location either to the current location or a specified location. + Use current (1=use current location, 0=use specified location) + Empty + Empty + Empty + Latitude + Longitude + Altitude + + + Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. + Parameter number + Parameter value + Empty + Empty + Empty + Empty + Empty + + + Set a relay to a condition. + Relay number + Setting (1=on, 0=off, others possible depending on system hardware) + Empty + Empty + Empty + Empty + Empty + + + Cycle a relay on and off for a desired number of cyles with a desired period. + Relay number + Cycle count + Cycle time (seconds, decimal) + Empty + Empty + Empty + Empty + + + Set a servo to a desired PWM value. + Servo number + PWM (microseconds, 1000 to 2000 typical) + Empty + Empty + Empty + Empty + Empty + + + Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. + Servo number + PWM (microseconds, 1000 to 2000 typical) + Cycle count + Cycle time (seconds) + Empty + Empty + Empty + + + Terminate flight immediately + Flight termination activated if > 0.5 + Empty + Empty + Empty + Empty + Empty + Empty + + + Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0/0 if not needed. If specified then it will be used to help find the closest landing sequence. + Empty + Empty + Empty + Empty + Latitude + Longitude + Empty + + + Mission command to perform a landing from a rally point. + Break altitude (meters) + Landing speed (m/s) + Empty + Empty + Empty + Empty + Empty + + + Mission command to safely abort an autonmous landing. + Altitude (meters) + Empty + Empty + Empty + Empty + Empty + Empty + + + Control onboard camera system. + Camera ID (-1 for all) + Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw + Transmission mode: 0: video stream, >0: single images every n seconds (decimal) + Recording: 0: disabled, 1: enabled compressed, 2: enabled raw + Empty + Empty + Empty + + + Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras. + Region of intereset mode. (see MAV_ROI enum) + MISSION index/ target ID. (see MAV_ROI enum) + ROI index (allows a vehicle to manage multiple ROI's) + Empty + x the location of the fixed ROI (see MAV_FRAME) + y + z + + + + + Mission command to configure an on-board camera controller system. + Modes: P, TV, AV, M, Etc + Shutter speed: Divisor number for one second + Aperture: F stop number + ISO number e.g. 80, 100, 200, Etc + Exposure type enumerator + Command Identity + Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off) + + + + Mission command to control an on-board camera controller system. + Session control e.g. show/hide lens + Zoom's absolute position + Zooming step value to offset zoom from the current position + Focus Locking, Unlocking or Re-locking + Shooting Command + Command Identity + Empty + + + + + Mission command to configure a camera or antenna mount + Mount operation mode (see MAV_MOUNT_MODE enum) + stabilize roll? (1 = yes, 0 = no) + stabilize pitch? (1 = yes, 0 = no) + stabilize yaw? (1 = yes, 0 = no) + Empty + Empty + Empty + + + + Mission command to control a camera or antenna mount + pitch or lat in degrees, depending on mount mode. + roll or lon in degrees depending on mount mode + yaw or alt (in meters) depending on mount mode + reserved + reserved + reserved + MAV_MOUNT_MODE enum value + + + + Mission command to set CAM_TRIGG_DIST for this flight + Camera trigger distance (meters) + Empty + Empty + Empty + Empty + Empty + Empty + + + + Mission command to enable the geofence + enable? (0=disable, 1=enable) + Empty + Empty + Empty + Empty + Empty + Empty + + + + Mission command to trigger a parachute + action (0=disable, 1=enable, 2=release, for some systems see PARACHUTE_ACTION enum, not in general message set.) + Empty + Empty + Empty + Empty + Empty + Empty + + + + Change to/from inverted flight + inverted (0=normal, 1=inverted) + Empty + Empty + Empty + Empty + Empty + Empty + + + + Mission command to control a camera or antenna mount, using a quaternion as reference. + q1 - quaternion param #1, w (1 in null-rotation) + q2 - quaternion param #2, x (0 in null-rotation) + q3 - quaternion param #3, y (0 in null-rotation) + q4 - quaternion param #4, z (0 in null-rotation) + Empty + Empty + Empty + + + + set id of master controller + System ID + Component ID + Empty + Empty + Empty + Empty + Empty + + + + set limits for external control + timeout - maximum time (in seconds) that external controller will be allowed to control vehicle. 0 means no timeout + absolute altitude min (in meters, AMSL) - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit + absolute altitude max (in meters)- if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit + horizontal move limit (in meters, AMSL) - if vehicle moves more than this distance from it's location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal altitude limit + Empty + Empty + Empty + + + + NOP - This command is only used to mark the upper limit of the DO commands in the enumeration + Empty + Empty + Empty + Empty + Empty + Empty + Empty + + + Trigger calibration. This command will be only accepted if in pre-flight mode. + Gyro calibration: 0: no, 1: yes + Magnetometer calibration: 0: no, 1: yes + Ground pressure: 0: no, 1: yes + Radio calibration: 0: no, 1: yes + Accelerometer calibration: 0: no, 1: yes + Compass/Motor interference calibration: 0: no, 1: yes + Empty + + + Set sensor offsets. This command will be only accepted if in pre-flight mode. + Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer + X axis offset (or generic dimension 1), in the sensor's raw units + Y axis offset (or generic dimension 2), in the sensor's raw units + Z axis offset (or generic dimension 3), in the sensor's raw units + Generic dimension 4, in the sensor's raw units + Generic dimension 5, in the sensor's raw units + Generic dimension 6, in the sensor's raw units + + + Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. + Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM + Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM + Reserved + Reserved + Empty + Empty + Empty + + + Request the reboot or shutdown of system components. + 0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot. + 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer. + Reserved + Reserved + Empty + Empty + Empty + + + Hold / continue the current action + MAV_GOTO_DO_HOLD: hold MAV_GOTO_DO_CONTINUE: continue with next item in mission plan + MAV_GOTO_HOLD_AT_CURRENT_POSITION: Hold at current position MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position + MAV_FRAME coordinate frame of hold point + Desired yaw angle in degrees + Latitude / X position + Longitude / Y position + Altitude / Z position + + + start running a mission + first_item: the first mission item to run + last_item: the last mission item to run (after this item is run, the mission ends) + + + Arms / Disarms a component + 1 to arm, 0 to disarm + + + Starts receiver pairing + 0:Spektrum + 0:Spektrum DSM2, 1:Spektrum DSMX + + + Request autopilot capabilities + 1: Request autopilot version + Reserved (all remaining params) + + + Start image capture sequence + Duration between two consecutive pictures (in seconds) + Number of images to capture total - 0 for unlimited capture + Resolution in megapixels (0.3 for 640x480, 1.3 for 1280x720, etc) + + + + Stop image capture sequence + Reserved + Reserved + + + + Starts video capture + Camera ID (0 for all cameras), 1 for first, 2 for second, etc. + Frames per second + Resolution in megapixels (0.3 for 640x480, 1.3 for 1280x720, etc) + + + + Stop the current video capture + Reserved + Reserved + + + + Create a panorama at the current position + Viewing angle horizontal of the panorama (in degrees, +- 0.5 the total angle) + Viewing angle vertical of panorama (in degrees) + Speed of the horizontal rotation (in degrees per second) + Speed of the vertical rotation (in degrees per second) + + + + + + + Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. + Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list. + Desired approach vector in degrees compass heading (0..360). A negative value indicates the system can define the approach vector at will. + Desired ground speed at release time. This can be overriden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will. + Minimum altitude clearance to the release position in meters. A negative value indicates the system can define the clearance at will. + Latitude unscaled for MISSION_ITEM or in 1e7 degrees for MISSION_ITEM_INT + Longitude unscaled for MISSION_ITEM or in 1e7 degrees for MISSION_ITEM_INT + Altitude, in meters AMSL + + + Control the payload deployment. + Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deploment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests. + Reserved + Reserved + Reserved + Reserved + Reserved + Reserved + + + + + Data stream IDs. A data stream is not a fixed set of messages, but rather a + recommendation to the autopilot software. Individual autopilots may or may not obey + the recommended messages. + + Enable all data streams + + + Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. + + + Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS + + + Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW + + + Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. + + + Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. + + + Dependent on the autopilot + + + Dependent on the autopilot + + + Dependent on the autopilot + + + + The ROI (region of interest) for the vehicle. This can be + be used by the vehicle for camera/vehicle attitude alignment (see + MAV_CMD_NAV_ROI). + + No region of interest. + + + Point toward next MISSION. + + + Point toward given MISSION. + + + Point toward fixed location. + + + Point toward of given id. + + + + ACK / NACK / ERROR values as a result of MAV_CMDs and for mission item transmission. + + Command / mission item is ok. + + + Generic error message if none of the other reasons fails or if no detailed error reporting is implemented. + + + The system is refusing to accept this command from this source / communication partner. + + + Command or mission item is not supported, other commands would be accepted. + + + The coordinate frame of this command / mission item is not supported. + + + The coordinate frame of this command is ok, but he coordinate values exceed the safety limits of this system. This is a generic error, please use the more specific error messages below if possible. + + + The X or latitude value is out of range. + + + The Y or longitude value is out of range. + + + The Z or altitude value is out of range. + + + + Specifies the datatype of a MAVLink parameter. + + 8-bit unsigned integer + + + 8-bit signed integer + + + 16-bit unsigned integer + + + 16-bit signed integer + + + 32-bit unsigned integer + + + 32-bit signed integer + + + 64-bit unsigned integer + + + 64-bit signed integer + + + 32-bit floating-point + + + 64-bit floating-point + + + + result from a mavlink command + + Command ACCEPTED and EXECUTED + + + Command TEMPORARY REJECTED/DENIED + + + Command PERMANENTLY DENIED + + + Command UNKNOWN/UNSUPPORTED + + + Command executed, but failed + + + + result in a mavlink mission ack + + mission accepted OK + + + generic error / not accepting mission commands at all right now + + + coordinate frame is not supported + + + command is not supported + + + mission item exceeds storage space + + + one of the parameters has an invalid value + + + param1 has an invalid value + + + param2 has an invalid value + + + param3 has an invalid value + + + param4 has an invalid value + + + x/param5 has an invalid value + + + y/param6 has an invalid value + + + param7 has an invalid value + + + received waypoint out of sequence + + + not accepting any mission commands from this communication partner + + + + Indicates the severity level, generally used for status messages to indicate their relative urgency. Based on RFC-5424 using expanded definitions at: http://www.kiwisyslog.com/kb/info:-syslog-message-levels/. + + System is unusable. This is a "panic" condition. + + + Action should be taken immediately. Indicates error in non-critical systems. + + + Action must be taken immediately. Indicates failure in a primary system. + + + Indicates an error in secondary/redundant systems. + + + Indicates about a possible future error if this is not resolved within a given timeframe. Example would be a low battery warning. + + + An unusual event has occured, though not an error condition. This should be investigated for the root cause. + + + Normal operational messages. Useful for logging. No action is required for these messages. + + + Useful non-operational messages that can assist in debugging. These should not occur during normal operation. + + + + Power supply status flags (bitmask) + + main brick power supply valid + + + main servo power supply valid for FMU + + + USB power is connected + + + peripheral supply is in over-current state + + + hi-power peripheral supply is in over-current state + + + Power status has changed since boot + + + + SERIAL_CONTROL device types + + First telemetry port + + + Second telemetry port + + + First GPS port + + + Second GPS port + + + + SERIAL_CONTROL flags (bitmask) + + Set if this is a reply + + + Set if the sender wants the receiver to send a response as another SERIAL_CONTROL message + + + Set if access to the serial port should be removed from whatever driver is currently using it, giving exclusive access to the SERIAL_CONTROL protocol. The port can be handed back by sending a request without this flag set + + + Block on writes to the serial port + + + Send multiple replies until port is drained + + + + Enumeration of distance sensor types + + Laser altimeter, e.g. LightWare SF02/F or PulsedLight units + + + Ultrasound altimeter, e.g. MaxBotix units + + + + Bitmask of (optional) autopilot capabilities (64 bit). If a bit is set, the autopilot supports this capability. + + Autopilot supports MISSION float message type. + + + Autopilot supports the new param float message type. + + + Autopilot supports MISSION_INT scaled integer message type. + + + Autopilot supports COMMAND_INT scaled integer message type. + + + Autopilot supports the new param union message type. + + + Autopilot supports the new param union message type. + + + Autopilot supports commanding attitude offboard. + + + Autopilot supports commanding position and velocity targets in local NED frame. + + + Autopilot supports commanding position and velocity targets in global scaled integers. + + + Autopilot supports terrain protocol / data handling. + + + Autopilot supports direct actuator control. + + + + Enumeration of estimator types + + This is a naive estimator without any real covariance feedback. + + + Computer vision based estimate. Might be up to scale. + + + Visual-inertial estimate. + + + Plain GPS estimate. + + + Estimator integrating GPS and inertial sensing. + + + + Enumeration of battery types + + Not specified. + + + Lithium polymere battery + + + Lithium ferrite battery + + + Lithium-ION battery + + + Nickel metal hydride battery + + + + Enumeration of battery functions + + Lithium polymere battery + + + Battery supports all flight systems + + + Battery for the propulsion system + + + Avionics battery + + + Payload battery + + + + + + The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receiving system to treat further messages from this system appropriate (e.g. by laying out the user interface based on the autopilot). + Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + Autopilot type / class. defined in MAV_AUTOPILOT ENUM + System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h + A bitfield for use for autopilot-specific flags. + System status flag, see MAV_STATE ENUM + MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version + + + The general system state. If the system is following the MAVLink standard, the system state is mainly defined by three orthogonal states/modes: The system mode, which is either LOCKED (motors shut down and locked), MANUAL (system under RC control), GUIDED (system with autonomous position control, position setpoint controlled manually) or AUTO (system guided by path/waypoint planner). The NAV_MODE defined the current flight state: LIFTOFF (often an open-loop maneuver), LANDING, WAYPOINTS or VECTOR. This represents the internal navigation state machine. The system status shows wether the system is currently active or not and if an emergency occured. During the CRITICAL and EMERGENCY states the MAV is still considered to be active, but should start emergency procedures autonomously. After a failure occured it should first move from active to critical to allow manual intervention and then move to emergency after a certain timeout. + Bitmask showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. Indices defined by ENUM MAV_SYS_STATUS_SENSOR + Bitmask showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR + Bitmask showing which onboard controllers and sensors are operational or have an error: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR + Maximum usage in percent of the mainloop time, (0%: 0, 100%: 1000) should be always below 1000 + Battery voltage, in millivolts (1 = 1 millivolt) + Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current + Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot estimate the remaining battery + Communication drops in percent, (0%: 0, 100%: 10'000), (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) + Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) + Autopilot-specific errors + Autopilot-specific errors + Autopilot-specific errors + Autopilot-specific errors + + + The system time is the time of the master clock, typically the computer clock of the main onboard computer. + Timestamp of the master clock in microseconds since UNIX epoch. + Timestamp of the component clock since boot time in milliseconds. + + + + A ping message either requesting or responding to a ping. This allows to measure the system latencies, including serial port, radio modem and UDP connections. + Unix timestamp in microseconds or since system boot if smaller than MAVLink epoch (1.1.2009) + PING sequence + 0: request ping from all receiving systems, if greater than 0: message is a ping response and number is the system id of the requesting system + 0: request ping from all receiving components, if greater than 0: message is a ping response and number is the system id of the requesting system + + + Request to control this MAV + System the GCS requests control for + 0: request control of this MAV, 1: Release control of this MAV + 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch. + Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" + + + Accept / deny control of this MAV + ID of the GCS this message + 0: request control of this MAV, 1: Release control of this MAV + 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control + + + Emit an encrypted signature / key identifying this system. PLEASE NOTE: This protocol has been kept simple, so transmitting the key requires an encrypted channel for true safety. + key + + + Set the system mode, as defined by enum MAV_MODE. There is no target component id as the mode is by definition for the overall aircraft, not only for one component. + The system setting the mode + The new base mode + The new autopilot-specific mode. This field can be ignored by an autopilot. + + + + Request to read the onboard parameter with the param_id string id. Onboard parameters are stored as key[const char*] -> value[float]. This allows to send a parameter to any other component (such as the GCS) without the need of previous knowledge of possible parameter names. Thus the same GCS can store different parameters for different autopilots. See also http://qgroundcontrol.org/parameter_interface for a full documentation of QGroundControl and IMU code. + System ID + Component ID + Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored) + + + Request all parameters of this component. After his request, all parameters are emitted. + System ID + Component ID + + + Emit the value of a onboard parameter. The inclusion of param_count and param_index in the message allows the recipient to keep track of received parameters and allows him to re-request missing parameters after a loss or timeout. + Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + Onboard parameter value + Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. + Total number of onboard parameters + Index of this onboard parameter + + + Set a parameter value TEMPORARILY to RAM. It will be reset to default on system reboot. Send the ACTION MAV_ACTION_STORAGE_WRITE to PERMANENTLY write the RAM contents to EEPROM. IMPORTANT: The receiving component should acknowledge the new parameter value by sending a param_value message to all communication partners. This will also ensure that multiple GCS all have an up-to-date list of all parameters. If the sending GCS did not receive a PARAM_VALUE message within its timeout time, it should re-send the PARAM_SET message. + System ID + Component ID + Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + Onboard parameter value + Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. + + + The global position, as returned by the Global Positioning System (GPS). This is + NOT the global position estimate of the system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + Latitude (WGS84), in degrees * 1E7 + Longitude (WGS84), in degrees * 1E7 + Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. + GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX + GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX + GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX + Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + Number of satellites visible. If unknown, set to 255 + + + The positioning status, as reported by GPS. This message is intended to display status information about each satellite visible to the receiver. See message GLOBAL_POSITION for the global position estimate. This message can contain information for up to 20 satellites. + Number of satellites visible + Global satellite ID + 0: Satellite not used, 1: used for localization + Elevation (0: right on top of receiver, 90: on the horizon) of satellite + Direction of satellite, 0: 0 deg, 255: 360 deg. + Signal to noise ratio of satellite + + + The RAW IMU readings for the usual 9DOF sensor setup. This message should contain the scaled values to the described units + Timestamp (milliseconds since system boot) + X acceleration (mg) + Y acceleration (mg) + Z acceleration (mg) + Angular speed around X axis (millirad /sec) + Angular speed around Y axis (millirad /sec) + Angular speed around Z axis (millirad /sec) + X Magnetic field (milli tesla) + Y Magnetic field (milli tesla) + Z Magnetic field (milli tesla) + + + The RAW IMU readings for the usual 9DOF sensor setup. This message should always contain the true raw values without any scaling to allow data capture and system debugging. + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + X acceleration (raw) + Y acceleration (raw) + Z acceleration (raw) + Angular speed around X axis (raw) + Angular speed around Y axis (raw) + Angular speed around Z axis (raw) + X Magnetic field (raw) + Y Magnetic field (raw) + Z Magnetic field (raw) + + + The RAW pressure readings for the typical setup of one absolute pressure and one differential pressure sensor. The sensor values should be the raw, UNSCALED ADC values. + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + Absolute pressure (raw) + Differential pressure 1 (raw) + Differential pressure 2 (raw) + Raw Temperature measurement (raw) + + + The pressure readings for the typical setup of one absolute and differential pressure sensor. The units are as specified in each field. + Timestamp (milliseconds since system boot) + Absolute pressure (hectopascal) + Differential pressure 1 (hectopascal) + Temperature measurement (0.01 degrees celsius) + + + The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right). + Timestamp (milliseconds since system boot) + Roll angle (rad, -pi..+pi) + Pitch angle (rad, -pi..+pi) + Yaw angle (rad, -pi..+pi) + Roll angular speed (rad/s) + Pitch angular speed (rad/s) + Yaw angular speed (rad/s) + + + The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right), expressed as quaternion. Quaternion order is w, x, y, z and a zero rotation would be expressed as (1 0 0 0). + Timestamp (milliseconds since system boot) + Quaternion component 1, w (1 in null-rotation) + Quaternion component 2, x (0 in null-rotation) + Quaternion component 3, y (0 in null-rotation) + Quaternion component 4, z (0 in null-rotation) + Roll angular speed (rad/s) + Pitch angular speed (rad/s) + Yaw angular speed (rad/s) + + + The filtered local position (e.g. fused computer vision and accelerometers). Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) + Timestamp (milliseconds since system boot) + X Position + Y Position + Z Position + X Speed + Y Speed + Z Speed + + + The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (right-handed, Z-up). It + is designed as scaled integer message since the resolution of float is not sufficient. + Timestamp (milliseconds since system boot) + Latitude, expressed as * 1E7 + Longitude, expressed as * 1E7 + Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well) + Altitude above ground in meters, expressed as * 1000 (millimeters) + Ground X Speed (Latitude), expressed as m/s * 100 + Ground Y Speed (Longitude), expressed as m/s * 100 + Ground Z Speed (Altitude), expressed as m/s * 100 + Compass heading in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + + + The scaled values of the RC channels received. (-100%) -10000, (0%) 0, (100%) 10000. Channels that are inactive should be set to UINT16_MAX. + Timestamp (milliseconds since system boot) + Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. + RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. + + + The RAW values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. + Timestamp (milliseconds since system boot) + Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. + RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. + + + The RAW values of the servo outputs (for RC input from the remote, use the RC_CHANNELS messages). The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. + Timestamp (microseconds since system boot) + Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos. + Servo output 1 value, in microseconds + Servo output 2 value, in microseconds + Servo output 3 value, in microseconds + Servo output 4 value, in microseconds + Servo output 5 value, in microseconds + Servo output 6 value, in microseconds + Servo output 7 value, in microseconds + Servo output 8 value, in microseconds + + + Request a partial list of mission items from the system/component. http://qgroundcontrol.org/mavlink/waypoint_protocol. If start and end index are the same, just send one waypoint. + System ID + Component ID + Start index, 0 by default + End index, -1 by default (-1: send list to end). Else a valid index of the list + + + This message is sent to the MAV to write a partial list. If start index == end index, only one item will be transmitted / updated. If the start index is NOT 0 and above the current list size, this request should be REJECTED! + System ID + Component ID + Start index, 0 by default and smaller / equal to the largest index of the current onboard list. + End index, equal or greater than start index. + + + Message encoding a mission item. This message is emitted to announce + the presence of a mission item and to set a mission item on the system. The mission item can be either in x, y, z meters (type: LOCAL) or x:lat, y:lon, z:altitude. Local frame is Z-down, right handed (NED), global frame is Z-up, right handed (ENU). See also http://qgroundcontrol.org/mavlink/waypoint_protocol. + System ID + Component ID + Sequence + The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h + The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs + false:0, true:1 + autocontinue to next wp + PARAM1, see MAV_CMD enum + PARAM2, see MAV_CMD enum + PARAM3, see MAV_CMD enum + PARAM4, see MAV_CMD enum + PARAM5 / local: x position, global: latitude + PARAM6 / y position: global: longitude + PARAM7 / z position: global: altitude (relative or absolute, depending on frame. + + + Request the information of the mission item with the sequence number seq. The response of the system to this message should be a MISSION_ITEM message. http://qgroundcontrol.org/mavlink/waypoint_protocol + System ID + Component ID + Sequence + + + Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). + System ID + Component ID + Sequence + + + Message that announces the sequence number of the current active mission item. The MAV will fly towards this mission item. + Sequence + + + Request the overall list of mission items from the system/component. + System ID + Component ID + + + This message is emitted as response to MISSION_REQUEST_LIST by the MAV and to initiate a write transaction. The GCS can then request the individual mission item based on the knowledge of the total number of MISSIONs. + System ID + Component ID + Number of mission items in the sequence + + + Delete all mission items at once. + System ID + Component ID + + + A certain mission item has been reached. The system will either hold this position (or circle on the orbit) or (if the autocontinue on the WP was set) continue to the next MISSION. + Sequence + + + Ack message during MISSION handling. The type field states if this message is a positive ack (type=0) or if an error happened (type=non-zero). + System ID + Component ID + See MAV_MISSION_RESULT enum + + + As local waypoints exist, the global MISSION reference allows to transform between the local coordinate frame and the global (GPS) coordinate frame. This can be necessary when e.g. in- and outdoor settings are connected and the MAV should move from in- to outdoor. + System ID + Latitude (WGS84), in degrees * 1E7 + Longitude (WGS84, in degrees * 1E7 + Altitude (AMSL), in meters * 1000 (positive for up) + + + Once the MAV sets a new GPS-Local correspondence, this message announces the origin (0,0,0) position + Latitude (WGS84), in degrees * 1E7 + Longitude (WGS84), in degrees * 1E7 + Altitude (AMSL), in meters * 1000 (positive for up) + + + Bind a RC channel to a parameter. The parameter should change accoding to the RC channel value. + System ID + Component ID + Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index. + Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC. + Initial parameter value + Scale, maps the RC range [-1, 1] to a parameter value + Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation) + Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation) + + + Set a safety zone (volume), which is defined by two corners of a cube. This message can be used to tell the MAV which setpoints/MISSIONs to accept and which to reject. Safety areas are often enforced by national or competition regulations. + System ID + Component ID + Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. + x position 1 / Latitude 1 + y position 1 / Longitude 1 + z position 1 / Altitude 1 + x position 2 / Latitude 2 + y position 2 / Longitude 2 + z position 2 / Altitude 2 + + + Read out the safety zone the MAV currently assumes. + Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. + x position 1 / Latitude 1 + y position 1 / Longitude 1 + z position 1 / Altitude 1 + x position 2 / Latitude 2 + y position 2 / Longitude 2 + z position 2 / Altitude 2 + + + The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right), expressed as quaternion. Quaternion order is w, x, y, z and a zero rotation would be expressed as (1 0 0 0). + Timestamp (milliseconds since system boot) + Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) + Roll angular speed (rad/s) + Pitch angular speed (rad/s) + Yaw angular speed (rad/s) + Attitude covariance + + + Outputs of the APM navigation controller. The primary use of this message is to check the response and signs of the controller before actual flight and to assist with tuning controller parameters. + Current desired roll in degrees + Current desired pitch in degrees + Current desired heading in degrees + Bearing to current MISSION/target in degrees + Distance to active MISSION in meters + Current altitude error in meters + Current airspeed error in meters/second + Current crosstrack error on x-y plane in meters + + + The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (right-handed, Z-up). It is designed as scaled integer message since the resolution of float is not sufficient. NOTE: This message is intended for onboard networks / companion computers and higher-bandwidth links and optimized for accuracy and completeness. Please use the GLOBAL_POSITION_INT message for a minimal subset. + Timestamp (milliseconds since system boot) + Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver. + Class id of the estimator this estimate originated from. + Latitude, expressed as degrees * 1E7 + Longitude, expressed as degrees * 1E7 + Altitude in meters, expressed as * 1000 (millimeters), above MSL + Altitude above ground in meters, expressed as * 1000 (millimeters) + Ground X Speed (Latitude), expressed as m/s + Ground Y Speed (Longitude), expressed as m/s + Ground Z Speed (Altitude), expressed as m/s + Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.) + + + The filtered local position (e.g. fused computer vision and accelerometers). Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) + Timestamp (milliseconds since system boot) + Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver. + Class id of the estimator this estimate originated from. + X Position + Y Position + Z Position + X Speed + Y Speed + Z Speed + Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.) + + + The PPM values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. + Timestamp (milliseconds since system boot) + Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available. + RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. + + + The target requested to send the message stream. + The target requested to send the message stream. + The ID of the requested data stream + The requested interval between two messages of this type + 1 to start sending, 0 to stop sending. + + + The ID of the requested data stream + The requested interval between two messages of this type + 1 stream is enabled, 0 stream is stopped. + + + This message provides an API for manually controlling the vehicle using standard joystick axes nomenclature, along with a joystick-like input device. Unused axes can be disabled an buttons are also transmit as boolean values of their + The system to be controlled. + X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. + Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. + Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. + R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. + A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + + + The RAW values of the RC channels sent to the MAV to override info received from the RC radio. A value of UINT16_MAX means no change to that channel. A value of 0 means control of that channel should be released back to the RC radio. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. + System ID + Component ID + RC channel 1 value, in microseconds. A value of UINT16_MAX means to ignore this field. + RC channel 2 value, in microseconds. A value of UINT16_MAX means to ignore this field. + RC channel 3 value, in microseconds. A value of UINT16_MAX means to ignore this field. + RC channel 4 value, in microseconds. A value of UINT16_MAX means to ignore this field. + RC channel 5 value, in microseconds. A value of UINT16_MAX means to ignore this field. + RC channel 6 value, in microseconds. A value of UINT16_MAX means to ignore this field. + RC channel 7 value, in microseconds. A value of UINT16_MAX means to ignore this field. + RC channel 8 value, in microseconds. A value of UINT16_MAX means to ignore this field. + + + Message encoding a mission item. This message is emitted to announce + the presence of a mission item and to set a mission item on the system. The mission item can be either in x, y, z meters (type: LOCAL) or x:lat, y:lon, z:altitude. Local frame is Z-down, right handed (NED), global frame is Z-up, right handed (ENU). See alsohttp://qgroundcontrol.org/mavlink/waypoint_protocol. + System ID + Component ID + Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4). + The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h + The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs + false:0, true:1 + autocontinue to next wp + PARAM1, see MAV_CMD enum + PARAM2, see MAV_CMD enum + PARAM3, see MAV_CMD enum + PARAM4, see MAV_CMD enum + PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 + PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7 + PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. + + + Metrics typically displayed on a HUD for fixed wing aircraft + Current airspeed in m/s + Current ground speed in m/s + Current heading in degrees, in compass units (0..360, 0=north) + Current throttle setting in integer percent, 0 to 100 + Current altitude (MSL), in meters + Current climb rate in meters/second + + + Message encoding a command with parameters as scaled integers. Scaling depends on the actual command value. + System ID + Component ID + The coordinate system of the COMMAND. see MAV_FRAME in mavlink_types.h + The scheduled action for the mission item. see MAV_CMD in common.xml MAVLink specs + false:0, true:1 + autocontinue to next wp + PARAM1, see MAV_CMD enum + PARAM2, see MAV_CMD enum + PARAM3, see MAV_CMD enum + PARAM4, see MAV_CMD enum + PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 + PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 + PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. + + + Send a command with up to seven parameters to the MAV + System which should execute the command + Component which should execute the command, 0 for all components + Command ID, as defined by MAV_CMD enum. + 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) + Parameter 1, as defined by MAV_CMD enum. + Parameter 2, as defined by MAV_CMD enum. + Parameter 3, as defined by MAV_CMD enum. + Parameter 4, as defined by MAV_CMD enum. + Parameter 5, as defined by MAV_CMD enum. + Parameter 6, as defined by MAV_CMD enum. + Parameter 7, as defined by MAV_CMD enum. + + + Report status of a command. Includes feedback wether the command was executed. + Command ID, as defined by MAV_CMD enum. + See MAV_RESULT enum + + + Setpoint in roll, pitch, yaw and thrust from the operator + Timestamp in milliseconds since system boot + Desired roll rate in radians per second + Desired pitch rate in radians per second + Desired yaw rate in radians per second + Collective thrust, normalized to 0 .. 1 + Flight mode switch position, 0.. 255 + Override mode switch position, 0.. 255 + + + Set the vehicle attitude and body angular rates. + Timestamp in milliseconds since system boot + System ID + Component ID + Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 6: reserved, bit 7: throttle, bit 8: attitude + Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + Body roll rate in radians per second + Body roll rate in radians per second + Body roll rate in radians per second + Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + + + Set the vehicle attitude and body angular rates. + Timestamp in milliseconds since system boot + Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 7: reserved, bit 8: attitude + Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + Body roll rate in radians per second + Body roll rate in radians per second + Body roll rate in radians per second + Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + + + Set vehicle position, velocity and acceleration setpoint in local frame. + Timestamp in milliseconds since system boot + System ID + Component ID + Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 + Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate + X Position in NED frame in meters + Y Position in NED frame in meters + Z Position in NED frame in meters (note, altitude is negative in NED) + X velocity in NED frame in meter / s + Y velocity in NED frame in meter / s + Z velocity in NED frame in meter / s + X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + yaw setpoint in rad + yaw rate setpoint in rad/s + + + Set vehicle position, velocity and acceleration setpoint in local frame. + Timestamp in milliseconds since system boot + Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 + Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate + X Position in NED frame in meters + Y Position in NED frame in meters + Z Position in NED frame in meters (note, altitude is negative in NED) + X velocity in NED frame in meter / s + Y velocity in NED frame in meter / s + Z velocity in NED frame in meter / s + X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + yaw setpoint in rad + yaw rate setpoint in rad/s + + + Set vehicle position, velocity and acceleration setpoint in the WGS84 coordinate system. + Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. + System ID + Component ID + Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate + X Position in WGS84 frame in 1e7 * meters + Y Position in WGS84 frame in 1e7 * meters + Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT + X velocity in NED frame in meter / s + Y velocity in NED frame in meter / s + Z velocity in NED frame in meter / s + X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + yaw setpoint in rad + yaw rate setpoint in rad/s + + + Set vehicle position, velocity and acceleration setpoint in the WGS84 coordinate system. + Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. + Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate + X Position in WGS84 frame in 1e7 * meters + Y Position in WGS84 frame in 1e7 * meters + Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT + X velocity in NED frame in meter / s + Y velocity in NED frame in meter / s + Z velocity in NED frame in meter / s + X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + yaw setpoint in rad + yaw rate setpoint in rad/s + + + The offset in X, Y, Z and yaw between the LOCAL_POSITION_NED messages of MAV X and the global coordinate frame in NED coordinates. Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) + Timestamp (milliseconds since system boot) + X Position + Y Position + Z Position + Roll + Pitch + Yaw + + + DEPRECATED PACKET! Suffers from missing airspeed fields and singularities due to Euler angles. Please use HIL_STATE_QUATERNION instead. Sent from simulation to autopilot. This packet is useful for high throughput applications such as hardware in the loop simulations. + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + Roll angle (rad) + Pitch angle (rad) + Yaw angle (rad) + Body frame roll / phi angular speed (rad/s) + Body frame pitch / theta angular speed (rad/s) + Body frame yaw / psi angular speed (rad/s) + Latitude, expressed as * 1E7 + Longitude, expressed as * 1E7 + Altitude in meters, expressed as * 1000 (millimeters) + Ground X Speed (Latitude), expressed as m/s * 100 + Ground Y Speed (Longitude), expressed as m/s * 100 + Ground Z Speed (Altitude), expressed as m/s * 100 + X acceleration (mg) + Y acceleration (mg) + Z acceleration (mg) + + + Sent from autopilot to simulation. Hardware in the loop control outputs + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + Control output -1 .. 1 + Control output -1 .. 1 + Control output -1 .. 1 + Throttle 0 .. 1 + Aux 1, -1 .. 1 + Aux 2, -1 .. 1 + Aux 3, -1 .. 1 + Aux 4, -1 .. 1 + System mode (MAV_MODE) + Navigation mode (MAV_NAV_MODE) + + + Sent from simulation to autopilot. The RAW values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + RC channel 1 value, in microseconds + RC channel 2 value, in microseconds + RC channel 3 value, in microseconds + RC channel 4 value, in microseconds + RC channel 5 value, in microseconds + RC channel 6 value, in microseconds + RC channel 7 value, in microseconds + RC channel 8 value, in microseconds + RC channel 9 value, in microseconds + RC channel 10 value, in microseconds + RC channel 11 value, in microseconds + RC channel 12 value, in microseconds + Receive signal strength indicator, 0: 0%, 255: 100% + + + Optical flow from a flow sensor (e.g. optical mouse sensor) + Timestamp (UNIX) + Sensor ID + Flow in pixels * 10 in x-sensor direction (dezi-pixels) + Flow in pixels * 10 in y-sensor direction (dezi-pixels) + Flow in meters in x-sensor direction, angular-speed compensated + Flow in meters in y-sensor direction, angular-speed compensated + Optical flow quality / confidence. 0: bad, 255: maximum quality + Ground distance in meters. Positive value: distance known. Negative value: Unknown distance + + + Timestamp (microseconds, synced to UNIX time or since system boot) + Global X position + Global Y position + Global Z position + Roll angle in rad + Pitch angle in rad + Yaw angle in rad + + + Timestamp (microseconds, synced to UNIX time or since system boot) + Global X position + Global Y position + Global Z position + Roll angle in rad + Pitch angle in rad + Yaw angle in rad + + + Timestamp (microseconds, synced to UNIX time or since system boot) + Global X speed + Global Y speed + Global Z speed + + + Timestamp (microseconds, synced to UNIX time or since system boot) + Global X position + Global Y position + Global Z position + Roll angle in rad + Pitch angle in rad + Yaw angle in rad + + + The IMU readings in SI units in NED body frame + Timestamp (microseconds, synced to UNIX time or since system boot) + X acceleration (m/s^2) + Y acceleration (m/s^2) + Z acceleration (m/s^2) + Angular speed around X axis (rad / sec) + Angular speed around Y axis (rad / sec) + Angular speed around Z axis (rad / sec) + X Magnetic field (Gauss) + Y Magnetic field (Gauss) + Z Magnetic field (Gauss) + Absolute pressure in millibar + Differential pressure in millibar + Altitude calculated from pressure + Temperature in degrees celsius + Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature + + + Optical flow from an angular rate flow sensor (e.g. PX4FLOW or mouse sensor) + Timestamp (microseconds, synced to UNIX time or since system boot) + Sensor ID + Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. + Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) + Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) + RH rotation around X axis (rad) + RH rotation around Y axis (rad) + RH rotation around Z axis (rad) + Temperature * 100 in centi-degrees Celsius + Optical flow quality / confidence. 0: no valid flow, 255: maximum quality + Time in microseconds since the distance was sampled. + Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. + + + The IMU readings in SI units in NED body frame + Timestamp (microseconds, synced to UNIX time or since system boot) + X acceleration (m/s^2) + Y acceleration (m/s^2) + Z acceleration (m/s^2) + Angular speed around X axis in body frame (rad / sec) + Angular speed around Y axis in body frame (rad / sec) + Angular speed around Z axis in body frame (rad / sec) + X Magnetic field (Gauss) + Y Magnetic field (Gauss) + Z Magnetic field (Gauss) + Absolute pressure in millibar + Differential pressure (airspeed) in millibar + Altitude calculated from pressure + Temperature in degrees celsius + Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature + + + + Status of simulation environment, if used + True attitude quaternion component 1, w (1 in null-rotation) + True attitude quaternion component 2, x (0 in null-rotation) + True attitude quaternion component 3, y (0 in null-rotation) + True attitude quaternion component 4, z (0 in null-rotation) + Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs + X acceleration m/s/s + Y acceleration m/s/s + Z acceleration m/s/s + Angular speed around X axis rad/s + Angular speed around Y axis rad/s + Angular speed around Z axis rad/s + Latitude in degrees + Longitude in degrees + Altitude in meters + Horizontal position standard deviation + Vertical position standard deviation + True velocity in m/s in NORTH direction in earth-fixed NED frame + True velocity in m/s in EAST direction in earth-fixed NED frame + True velocity in m/s in DOWN direction in earth-fixed NED frame + + + + Status generated by radio and injected into MAVLink stream. + Local signal strength + Remote signal strength + Remaining free buffer space in percent. + Background noise level + Remote background noise level + Receive errors + Count of error corrected packets + + + File transfer message + Network ID (0 for broadcast) + System ID (0 for broadcast) + Component ID (0 for broadcast) + Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. + + + Time synchronization message. + Time sync timestamp 1 + Time sync timestamp 2 + + + The global position, as returned by the Global Positioning System (GPS). This is + NOT the global position estimate of the sytem, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + Latitude (WGS84), in degrees * 1E7 + Longitude (WGS84), in degrees * 1E7 + Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) + GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 + GPS ground speed (m/s * 100). If unknown, set to: 65535 + GPS velocity in cm/s in NORTH direction in earth-fixed NED frame + GPS velocity in cm/s in EAST direction in earth-fixed NED frame + GPS velocity in cm/s in DOWN direction in earth-fixed NED frame + Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 + Number of satellites visible. If unknown, set to 255 + + + Simulated optical flow from a flow sensor (e.g. PX4FLOW or optical mouse sensor) + Timestamp (microseconds, synced to UNIX time or since system boot) + Sensor ID + Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. + Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) + Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) + RH rotation around X axis (rad) + RH rotation around Y axis (rad) + RH rotation around Z axis (rad) + Temperature * 100 in centi-degrees Celsius + Optical flow quality / confidence. 0: no valid flow, 255: maximum quality + Time in microseconds since the distance was sampled. + Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. + + + Sent from simulation to autopilot, avoids in contrast to HIL_STATE singularities. This packet is useful for high throughput applications such as hardware in the loop simulations. + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation) + Body frame roll / phi angular speed (rad/s) + Body frame pitch / theta angular speed (rad/s) + Body frame yaw / psi angular speed (rad/s) + Latitude, expressed as * 1E7 + Longitude, expressed as * 1E7 + Altitude in meters, expressed as * 1000 (millimeters) + Ground X Speed (Latitude), expressed as m/s * 100 + Ground Y Speed (Longitude), expressed as m/s * 100 + Ground Z Speed (Altitude), expressed as m/s * 100 + Indicated airspeed, expressed as m/s * 100 + True airspeed, expressed as m/s * 100 + X acceleration (mg) + Y acceleration (mg) + Z acceleration (mg) + + + The RAW IMU readings for secondary 9DOF sensor setup. This message should contain the scaled values to the described units + Timestamp (milliseconds since system boot) + X acceleration (mg) + Y acceleration (mg) + Z acceleration (mg) + Angular speed around X axis (millirad /sec) + Angular speed around Y axis (millirad /sec) + Angular speed around Z axis (millirad /sec) + X Magnetic field (milli tesla) + Y Magnetic field (milli tesla) + Z Magnetic field (milli tesla) + + + Request a list of available logs. On some systems calling this may stop on-board logging until LOG_REQUEST_END is called. + System ID + Component ID + First log id (0 for first available) + Last log id (0xffff for last available) + + + Reply to LOG_REQUEST_LIST + Log id + Total number of logs + High log number + UTC timestamp of log in seconds since 1970, or 0 if not available + Size of the log (may be approximate) in bytes + + + Request a chunk of a log + System ID + Component ID + Log id (from LOG_ENTRY reply) + Offset into the log + Number of bytes + + + Reply to LOG_REQUEST_DATA + Log id (from LOG_ENTRY reply) + Offset into the log + Number of bytes (zero for end of log) + log data + + + Erase all logs + System ID + Component ID + + + Stop log transfer and resume normal logging + System ID + Component ID + + + data for injecting into the onboard GPS (used for DGPS) + System ID + Component ID + data length + raw data (110 is enough for 12 satellites of RTCMv2) + + + Second GPS data. Coordinate frame is right-handed, Z-axis up (GPS frame). + Timestamp (microseconds since UNIX epoch or microseconds since system boot) + 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS fix, 5: RTK Fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + Latitude (WGS84), in degrees * 1E7 + Longitude (WGS84), in degrees * 1E7 + Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) + GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX + GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX + GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX + Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + Number of satellites visible. If unknown, set to 255 + Number of DGPS satellites + Age of DGPS info + + + Power supply status + 5V rail voltage in millivolts + servo rail voltage in millivolts + power supply status flags (see MAV_POWER_STATUS enum) + + + Control a serial port. This can be used for raw access to an onboard serial peripheral such as a GPS or telemetry radio. It is designed to make it possible to update the devices firmware via MAVLink messages or change the devices settings. A message with zero bytes can be used to change just the baudrate. + See SERIAL_CONTROL_DEV enum + See SERIAL_CONTROL_FLAG enum + Timeout for reply data in milliseconds + Baudrate of transfer. Zero means no change. + how many bytes in this transfer + serial data + + + RTK GPS data. Gives information on the relative baseline calculation the GPS is reporting + Time since boot of last baseline message received in ms. + Identification of connected RTK receiver. + GPS Week Number of last baseline + GPS Time of Week of last baseline + GPS-specific health report for RTK data. + Rate of baseline messages being received by GPS, in HZ + Current number of sats used for RTK calculation. + Coordinate system of baseline. 0 == ECEF, 1 == NED + Current baseline in ECEF x or NED north component in mm. + Current baseline in ECEF y or NED east component in mm. + Current baseline in ECEF z or NED down component in mm. + Current estimate of baseline accuracy. + Current number of integer ambiguity hypotheses. + + + RTK GPS data. Gives information on the relative baseline calculation the GPS is reporting + Time since boot of last baseline message received in ms. + Identification of connected RTK receiver. + GPS Week Number of last baseline + GPS Time of Week of last baseline + GPS-specific health report for RTK data. + Rate of baseline messages being received by GPS, in HZ + Current number of sats used for RTK calculation. + Coordinate system of baseline. 0 == ECEF, 1 == NED + Current baseline in ECEF x or NED north component in mm. + Current baseline in ECEF y or NED east component in mm. + Current baseline in ECEF z or NED down component in mm. + Current estimate of baseline accuracy. + Current number of integer ambiguity hypotheses. + + + The RAW IMU readings for 3rd 9DOF sensor setup. This message should contain the scaled values to the described units + Timestamp (milliseconds since system boot) + X acceleration (mg) + Y acceleration (mg) + Z acceleration (mg) + Angular speed around X axis (millirad /sec) + Angular speed around Y axis (millirad /sec) + Angular speed around Z axis (millirad /sec) + X Magnetic field (milli tesla) + Y Magnetic field (milli tesla) + Z Magnetic field (milli tesla) + + + type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h) + total data size in bytes (set on ACK only) + Width of a matrix or image + Height of a matrix or image + number of packets beeing sent (set on ACK only) + payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only) + JPEG quality out of [1,100] + + + sequence number (starting with 0 on every transmission) + image data bytes + + + Time since system boot + Minimum distance the sensor can measure in centimeters + Maximum distance the sensor can measure in centimeters + Current distance reading + Type from MAV_DISTANCE_SENSOR enum. + Onboard ID of the sensor + Direction the sensor faces from FIXME enum. + Measurement covariance in centimeters, 0 for unknown / invalid readings + + + Request for terrain data and terrain status + Latitude of SW corner of first grid (degrees *10^7) + Longitude of SW corner of first grid (in degrees *10^7) + Grid spacing in meters + Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits) + + + Terrain data sent from GCS. The lat/lon and grid_spacing must be the same as a lat/lon from a TERRAIN_REQUEST + Latitude of SW corner of first grid (degrees *10^7) + Longitude of SW corner of first grid (in degrees *10^7) + Grid spacing in meters + bit within the terrain request mask + Terrain data in meters AMSL + + + Request that the vehicle report terrain height at the given location. Used by GCS to check if vehicle has all terrain data needed for a mission. + Latitude (degrees *10^7) + Longitude (degrees *10^7) + + + Response from a TERRAIN_CHECK request + Latitude (degrees *10^7) + Longitude (degrees *10^7) + grid spacing (zero if terrain at this location unavailable) + Terrain height in meters AMSL + Current vehicle height above lat/lon terrain height (meters) + Number of 4x4 terrain blocks waiting to be received or read from disk + Number of 4x4 terrain blocks in memory + + + Barometer readings for 2nd barometer + Timestamp (milliseconds since system boot) + Absolute pressure (hectopascal) + Differential pressure 1 (hectopascal) + Temperature measurement (0.01 degrees celsius) + + + Motion capture attitude and position + Timestamp (micros since boot or Unix epoch) + Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + X position in meters (NED) + Y position in meters (NED) + Z position in meters (NED) + + + Set the vehicle attitude and body angular rates. + Timestamp (micros since boot or Unix epoch) + Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. + System ID + Component ID + Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. + + + Set the vehicle attitude and body angular rates. + Timestamp (micros since boot or Unix epoch) + Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. + Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. + + + Battery information + Battery ID + Function of the battery + Type (chemistry) of the battery + Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature. + Battery voltage of cells, in millivolts (1 = 1 millivolt) + Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current + Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate + Consumed energy, in 100*Joules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate + Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery + + + Version and capability of autopilot software + bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum) + Firmware version number + Middleware version number + Operating system version number + HW / board version (last 8 bytes should be silicon ID, if any) + Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + ID of the board vendor + ID of the product + UID if provided by hardware + + + + Message implementing parts of the V2 payload specs in V1 frames for transitional support. + Network ID (0 for broadcast) + System ID (0 for broadcast) + Component ID (0 for broadcast) + A code that identifies the software component that understands this message (analogous to usb device classes or mime type strings). If this code is less than 32768, it is considered a 'registered' protocol extension and the corresponding entry should be added to https://github.com/mavlink/mavlink/extension-message-ids.xml. Software creators can register blocks of message IDs as needed (useful for GCS specific metadata, etc...). Message_types greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. + Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. + + + Send raw controller memory. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. + Starting address of the debug variables + Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below + Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14 + Memory contents at specified address + + + Name + Timestamp + x + y + z + + + Send a key-value pair as float. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. + Timestamp (milliseconds since system boot) + Name of the debug variable + Floating point value + + + Send a key-value pair as integer. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. + Timestamp (milliseconds since system boot) + Name of the debug variable + Signed integer value + + + Status text message. These messages are printed in yellow in the COMM console of QGroundControl. WARNING: They consume quite some bandwidth, so use only for important status and error messages. If implemented wisely, these messages are buffered on the MCU and sent only at a limited rate (e.g. 10 Hz). + Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY. + Status text message, without null termination character + + + Send a debug value. The index is used to discriminate between values. These values show up in the plot of QGroundControl as DEBUG N. + Timestamp (milliseconds since system boot) + index of debug variable + DEBUG value + + + diff --git a/mavlink/concise.xml b/mavlink/concise.xml deleted file mode 100644 index 4d8d174..0000000 --- a/mavlink/concise.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - 1 - - - - Uninitialized system, state is unknown. - - - System is booting up. - - - System is calibrating and not flight-ready. - - - System is grounded and on standby. It can be launched any time. - - - System is active and might be already airborne. Motors are engaged. - - - System is in a non-normal flight mode. It can however still navigate. - - - System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down. - - - System just initialized its power-down sequence, will shut down now. - - - - - - The heartbeat message shows that a system is present and responding. - Global state of system. - - - Information about the main power source. - Voltage of the source (mV) - - - The IMU readings in a NED body frame - X acceleration (mm/s^2) - Y acceleration (mm/s^2) - Z acceleration (mm/s^2) - Angular speed around X axis (mrad / sec) - Angular speed around Y axis (mrad / sec) - Angular speed around Z axis (mrad / sec) - X Magnetic field (uT) - Y Magnetic field (uT) - Z Magnetic field (uT) - Altitude to mean sea level (mm) - Ambient temperature (mK) - - - Information on distance sensors - Relative altitude to ground (mm) - - - Ping a target system, usually used to determine latency. - System ID - Component ID - - - Acknowledgement packet - System ID - Component ID - - - Status of motors - m0 - m1 - m2 - m3 - - - The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right). - Roll angle - Pitch angle - Yaw angle - - - The RAW values of the RC channels sent to the MAV to override info received from the RC radio. A value of UINT16_MAX means no change to that channel. A value of 0 means control of that channel should be released back to the RC radio. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. - System ID - Component ID - RC channel 1 value, in microseconds. A value of UINT16_MAX means to ignore this field. - RC channel 2 value, in microseconds. A value of UINT16_MAX means to ignore this field. - RC channel 3 value, in microseconds. A value of UINT16_MAX means to ignore this field. - RC channel 4 value, in microseconds. A value of UINT16_MAX means to ignore this field. - RC channel 5 value, in microseconds. A value of UINT16_MAX means to ignore this field. - RC channel 6 value, in microseconds. A value of UINT16_MAX means to ignore this field. - RC channel 7 value, in microseconds. A value of UINT16_MAX means to ignore this field. - RC channel 8 value, in microseconds. A value of UINT16_MAX means to ignore this field. - - - Status generated by radio - local signal strength - remote signal strength - how full the tx buffer is as a percentage - background noise level - remote background noise level - receive errors - count of error corrected packets - - - diff --git a/project/Build.scala b/project/Build.scala index 9dd17c5..e469ce7 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -22,7 +22,7 @@ object ApplicationBuild extends Build { val common = Seq( scalaVersion := "2.11.6", scalacOptions ++= Seq("-feature", "-deprecation"), - mavlinkDialect := (baseDirectory in ThisBuild).value / "mavlink" / "concise.xml" + mavlinkDialect := (baseDirectory in ThisBuild).value / "mavlink" / "common.xml" ) //root super-project @@ -33,6 +33,7 @@ object ApplicationBuild extends Build { dashboard, index ) + settings(common: _*) settings( //goto main project on load onLoad in Global := (Command.process("project vfd-main", _: State)) compose (onLoad in Global).value diff --git a/project/plugins.sbt b/project/plugins.sbt index d057ec2..d47ecca 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,4 +6,4 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.2") addSbtPlugin("com.vmunier" % "sbt-play-scalajs" % "0.2.3") -addSbtPlugin("com.github.jodersky" % "sbt-mavlink" % "0.5.0") \ No newline at end of file +addSbtPlugin("com.github.jodersky" % "sbt-mavlink" % "0.5.0") diff --git a/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Communication.scala b/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Communication.scala index 220a7b8..2b79478 100644 --- a/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Communication.scala +++ b/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Communication.scala @@ -1,8 +1,5 @@ package vfd.dashboard.ui.panels -import org.mavlink.messages.Heartbeat -import org.mavlink.messages.Motor -import org.mavlink.messages.Power import org.scalajs.dom.html import rx.core.Obs @@ -46,22 +43,7 @@ object Communication { Obs(socket.message, skipInitial = true) { socket.message() match { - case Motor(m0, m1, m2, m3) => - motor0.update(m0) - motor1.update(m1) - motor2.update(m2) - motor3.update(m3) - powerDistribution.update(m0, m1, m2, m3) - - case Power(mV) => - batteryLevel.update(100 * (mV - 9600) / 12600) - case Heartbeat(_) => { - hb.style.visibility = "hidden" - hb.style.visibility = "visible" - //hb.classList.remove("heartbeat") - //hb.offsetHeight - //hb.classList.add("heartbeat") - } + //TODO match message and update UI case _ => } } diff --git a/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Primary.scala b/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Primary.scala index 6f66208..47c9c97 100644 --- a/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Primary.scala +++ b/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Primary.scala @@ -1,6 +1,5 @@ package vfd.dashboard.ui.panels -import org.mavlink.messages.Attitude import org.scalajs.dom.html import rx.core.Obs @@ -27,9 +26,7 @@ object Primary { Obs(socket.message, skipInitial = true) { socket.message() match { - case Attitude(roll, pitch, yaw) => - horizon.update(pitch, roll) - compass.update(yaw) + //TODO match message and update UI case _ => () } } diff --git a/vfd-index/src/main/scala/vfd/index/ActiveVehicle.scala b/vfd-index/src/main/scala/vfd/index/ActiveVehicle.scala new file mode 100644 index 0000000..0eaeea3 --- /dev/null +++ b/vfd-index/src/main/scala/vfd/index/ActiveVehicle.scala @@ -0,0 +1,44 @@ +package vfd.index + +import org.mavlink.enums.MavAutopilot +import org.mavlink.enums.MavState +import org.mavlink.enums.MavType +import org.mavlink.messages.Heartbeat + +case class ActiveVehicle(systemId: Int, vehicleType: String, autopilot: String, state: String) + +object ActiveVehicle { + + def fromHeartbeat(id: Int, hb: Heartbeat) = ActiveVehicle( + id, + vehicleType(hb.`type`), + autopilot(hb.autopilot), + state(hb.systemStatus)) + + def vehicleType(tpe: Int) = tpe match { + case MavType.MavTypeGeneric => "Generic" + case MavType.MavTypeQuadrotor => "Quadcopter" + case MavType.MavTypeFixedWing => "Fixed Wing" + case _ => "Other" + } + + def autopilot(tpe: Int) = tpe match { + case MavAutopilot.MavAutopilotGeneric => "Generic" + case MavAutopilot.MavAutopilotInvalid => "Invalid" + case MavAutopilot.MavAutopilotPixhawk => "Pixhawk" + case _ => "Other" + } + + def state(s: Int) = s match { + case MavState.MavStateActive => "Active" + case MavState.MavStateBoot => "Booting" + case MavState.MavStateCalibrating => "Calibrating" + case MavState.MavStateCritical => "Critical" + case MavState.MavStateEmergency => "Emergency" + case MavState.MavStatePoweroff => "Poweroff" + case MavState.MavStateStandby => "Standby" + case MavState.MavStateUninit => "Uninitialized" + case _ => "Unknown" + } + +} \ No newline at end of file diff --git a/vfd-index/src/main/scala/vfd/index/Main.scala b/vfd-index/src/main/scala/vfd/index/Main.scala index f2f9f0d..ce66f14 100644 --- a/vfd-index/src/main/scala/vfd/index/Main.scala +++ b/vfd-index/src/main/scala/vfd/index/Main.scala @@ -18,14 +18,12 @@ import scalatags.JsDom.all._ object Main { import Util._ - case class ActiveVehicle(id: Int) - val active = Var(Set.empty[ActiveVehicle]) val parser = new Parser( packet => Message.unpack(packet.messageId, packet.payload) match { case hb: Heartbeat => - active() += ActiveVehicle(packet.systemId) + active() += ActiveVehicle.fromHeartbeat(packet.messageId, hb) case _ => () }) @@ -48,13 +46,19 @@ object Main { thead( tr( th("System ID"), + th("Type"), + th("Autopilot"), + th("State"), th(""))), Rx { tbody( for (vehicle <- active().toSeq) yield { tr( - td(vehicle.id), - td(a(href := "/dashboard/" + vehicle.id, `class` := "btn btn-default")("Pilot"))) + td(vehicle.systemId), + td(vehicle.vehicleType), + td(vehicle.autopilot), + td(vehicle.state), + td(a(href := "/dashboard/" + vehicle.systemId, `class` := "btn btn-default")("Pilot"))) }) }).render) } diff --git a/vfd-uav/src/main/scala/vfd/uav/Connection.scala b/vfd-uav/src/main/scala/vfd/uav/Connection.scala index 38e1836..b99aadd 100644 --- a/vfd-uav/src/main/scala/vfd/uav/Connection.scala +++ b/vfd-uav/src/main/scala/vfd/uav/Connection.scala @@ -1,16 +1,12 @@ package vfd.uav import scala.collection.mutable.ArrayBuffer + import akka.actor.Actor import akka.actor.ActorRef import akka.actor.Terminated import akka.actor.actorRef2Scala import akka.util.ByteString -import org.mavlink.Assembler -import org.mavlink.messages.Message -import org.mavlink.Parser -import org.mavlink.Packet -import akka.actor.ActorLogging /** Protocol definition. */ object Connection { diff --git a/vfd-uav/src/main/scala/vfd/uav/MavlinkUtil.scala b/vfd-uav/src/main/scala/vfd/uav/MavlinkUtil.scala index edc8484..8a8c364 100644 --- a/vfd-uav/src/main/scala/vfd/uav/MavlinkUtil.scala +++ b/vfd-uav/src/main/scala/vfd/uav/MavlinkUtil.scala @@ -1,14 +1,13 @@ package vfd.uav import org.mavlink.Assembler -import akka.util.ByteString import org.mavlink.Packet -import akka.actor.Actor -import org.mavlink.messages.Ping -import org.mavlink.messages.Ack -import org.mavlink.messages.Message import org.mavlink.Parser +import org.mavlink.messages.Message + +import akka.actor.Actor import akka.actor.ActorLogging +import akka.util.ByteString /** Provides utilities for actors representing a mavlink connection. */ trait MavlinkUtil { myself: Actor with ActorLogging => @@ -31,10 +30,12 @@ trait MavlinkUtil { myself: Actor with ActorLogging => /** Parser for messages being sent to the uav. */ protected val outgoing: Parser = new Parser(packet => Message.unpack(packet.messageId, packet.payload) match { + //TODO handle ping + /* case Ping(`systemId`, `componentId`) => val message = Ack(packet.systemId, packet.componentId) val data = assemble(message) - self ! Connection.Received(data) + self ! Connection.Received(data)*/ case _ => () }) diff --git a/vfd-uav/src/main/scala/vfd/uav/MockConnection.scala b/vfd-uav/src/main/scala/vfd/uav/MockConnection.scala index 801c4ac..6c2dbc8 100644 --- a/vfd-uav/src/main/scala/vfd/uav/MockConnection.scala +++ b/vfd-uav/src/main/scala/vfd/uav/MockConnection.scala @@ -1,30 +1,43 @@ package vfd.uav import java.util.concurrent.TimeUnit.MILLISECONDS + import scala.concurrent.duration.FiniteDuration import scala.util.Random + +import org.mavlink.Packet +import org.mavlink.enums.MavAutopilot +import org.mavlink.enums.MavModeFlag +import org.mavlink.enums.MavState +import org.mavlink.enums.MavType +import org.mavlink.messages.Heartbeat + import Connection.Received import akka.actor.Actor import akka.actor.ActorLogging import akka.actor.Props import akka.util.ByteString -import org.mavlink.messages._ -import org.mavlink.Packet class MockConnection(localSystemId: Byte, localComponentId: Byte, remoteSystemId: Byte) extends Actor with ActorLogging with Connection with MavlinkUtil { import Connection._ import context._ - + override val systemId = remoteSystemId override val componentId = remoteSystemId - val MessageInterval = FiniteDuration(100, MILLISECONDS) - - def randomData: ByteString = Random.nextInt(MockPackets.Messages + 1) match { - case 0 => ByteString(MockPackets.invalid) - case i => assemble(MockPackets.message(i - 1)) - } - + val MessageInterval = FiniteDuration(1000, MILLISECONDS) + + def randomData: ByteString = + assemble( + Heartbeat( + MavType.MavTypeGeneric.toByte, + MavAutopilot.MavAutopilotGeneric.toByte, + (MavModeFlag.MavModeFlagSafetyArmed | MavModeFlag.MavModeFlagManualInputEnabled).toByte, + 0, //no custom mode + MavState.MavStateActive.toByte, + 0 //TODO properly implement read-only fields + )) + override def preStart() = context.system.scheduler.schedule(MessageInterval, MessageInterval) { sendAll(Received(randomData)) } @@ -43,19 +56,6 @@ object MockPackets { def nextByte(): Byte = r.nextInt().toByte def nextByte(max: Int): Byte = r.nextInt(max).toByte } - - def heartbeat = Heartbeat(0) - def motor = Motor(r.nextByte(101), r.nextByte(101), r.nextByte(101), r.nextByte(101)) - def attitude = Attitude((r.nextInt(160) - 80).toShort, (r.nextInt(160) - 80).toShort, r.nextInt(360).toShort) - def power = Power(Random.nextInt(12000).toShort) - - val Messages = 4 - def message(i: Int) = i match { - case 0 => heartbeat - case 1 => motor - case 2 => attitude - case 3 => power - } val invalidCrc = Array(254, 1, 123, 13, 13).map(_.toByte) val invalidOverflow = { diff --git a/vfd-uav/src/main/scala/vfd/uav/SerialConnection.scala b/vfd-uav/src/main/scala/vfd/uav/SerialConnection.scala index 4b2e71a..1756cac 100644 --- a/vfd-uav/src/main/scala/vfd/uav/SerialConnection.scala +++ b/vfd-uav/src/main/scala/vfd/uav/SerialConnection.scala @@ -1,16 +1,19 @@ package vfd.uav import java.util.concurrent.TimeUnit.MILLISECONDS + import scala.concurrent.duration.FiniteDuration -import org.mavlink.Packet -import org.mavlink.Parser -import org.mavlink.Assembler + +import org.mavlink.enums.MavAutopilot +import org.mavlink.enums.MavModeFlag +import org.mavlink.enums.MavState +import org.mavlink.enums.MavType import org.mavlink.messages.Heartbeat -import org.mavlink.messages.Ack -import org.mavlink.messages.Message + import com.github.jodersky.flow.Parity import com.github.jodersky.flow.Serial import com.github.jodersky.flow.SerialSettings + import akka.actor.Actor import akka.actor.ActorLogging import akka.actor.ActorRef @@ -18,8 +21,6 @@ import akka.actor.Props import akka.actor.Terminated import akka.actor.actorRef2Scala import akka.io.IO -import akka.util.ByteString -import org.mavlink.messages.Ping class SerialConnection( val systemId: Byte, @@ -32,7 +33,18 @@ class SerialConnection( override def preStart() = heartbeatInterval foreach { interval => context.system.scheduler.schedule(interval, interval) { - self ! Connection.Send(assemble(Heartbeat(0))) + self ! Connection.Send( + assemble( + Heartbeat( + MavType.MavTypeGeneric.toByte, + MavAutopilot.MavAutopilotGeneric.toByte, + 0, //no base mode + 0, //no custom mode + MavState.MavStateActive.toByte, + 0 //TODO properly implement read-only fields + ) + ) + ) } } -- cgit v1.2.3 From 51c998315fccb11aa56e22e66f32189a5991ba64 Mon Sep 17 00:00:00 2001 From: Misha Chernetsov Date: Thu, 26 Mar 2015 00:22:49 -0700 Subject: minor tweaks fixed system id extraction from message intellij gitignore [jodersky@gmail.com: remove trailing comma that brakes compilation] --- .gitignore | 1 + .../main/scala/vfd/dashboard/MavlinkSocket.scala | 24 +++++++++------------- .../scala/vfd/dashboard/ui/panels/Primary.scala | 8 +++++++- vfd-index/src/main/scala/vfd/index/Main.scala | 17 +++++++++------ vfd-uav/src/main/scala/vfd/uav/Connection.scala | 2 +- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index e38fe35..7a55893 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ project/plugins/project/ *.class *.log *~ +/.idea diff --git a/vfd-dashboard/src/main/scala/vfd/dashboard/MavlinkSocket.scala b/vfd-dashboard/src/main/scala/vfd/dashboard/MavlinkSocket.scala index dff3598..9476794 100644 --- a/vfd-dashboard/src/main/scala/vfd/dashboard/MavlinkSocket.scala +++ b/vfd-dashboard/src/main/scala/vfd/dashboard/MavlinkSocket.scala @@ -29,25 +29,21 @@ class MavlinkSocket(url: String, remoteSystemId: Int) { } private val parser = new Parser( - pckt => { - pckt match { - case Packet(seq, `remoteSystemId`, compId, msgId, payload) => - packet() = pckt - stats.packets() += 1 - case _ => - stats.wrongIds() += 1 - } + { + case pckt@Packet(seq, `remoteSystemId`, compId, msgId, payload) => + packet() = pckt + stats.packets() += 1 + case _ => + stats.wrongIds() += 1 }, - err => { - err match { - case CrcError => stats.crcErrors() += 1 - case OverflowError => stats.overflows() += 1 - } + { + case CrcError => stats.crcErrors() += 1 + case OverflowError => stats.overflows() += 1 }) private val connection = new dom.WebSocket(url) - connection.binaryType = "arraybuffer"; + connection.binaryType = "arraybuffer" connection.onopen = (e: dom.Event) => { stats.open() = true } diff --git a/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Primary.scala b/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Primary.scala index 47c9c97..b85e657 100644 --- a/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Primary.scala +++ b/vfd-dashboard/src/main/scala/vfd/dashboard/ui/panels/Primary.scala @@ -1,5 +1,6 @@ package vfd.dashboard.ui.panels +import org.mavlink.messages.{VfrHud, Attitude, GlobalPositionInt} import org.scalajs.dom.html import rx.core.Obs @@ -26,7 +27,12 @@ object Primary { Obs(socket.message, skipInitial = true) { socket.message() match { - //TODO match message and update UI + case a: Attitude => +// compass.update(a.yaw / Math.PI * 360) +// horizon.update(a.pitch, a.roll) + case vh: VfrHud => +// altimeter.update(vh.alt) +// compass.update(vh.heading / Math.PI * 360) case _ => () } } diff --git a/vfd-index/src/main/scala/vfd/index/Main.scala b/vfd-index/src/main/scala/vfd/index/Main.scala index ce66f14..779b682 100644 --- a/vfd-index/src/main/scala/vfd/index/Main.scala +++ b/vfd-index/src/main/scala/vfd/index/Main.scala @@ -21,18 +21,23 @@ object Main { val active = Var(Set.empty[ActiveVehicle]) val parser = new Parser( - packet => Message.unpack(packet.messageId, packet.payload) match { - case hb: Heartbeat => - active() += ActiveVehicle.fromHeartbeat(packet.messageId, hb) - case _ => () - }) + packet => { + val m: Message = Message.unpack(packet.messageId, packet.payload) + println(m) + m match { + case hb: Heartbeat => + active() += ActiveVehicle.fromHeartbeat(packet.systemId, hb) + case _ => () + } + } + ) @JSExport def main(root: html.Element, baseAssets: String, args: js.Dictionary[String]): Unit = { val connection = new dom.WebSocket(args("socketUrl")) - connection.binaryType = "arraybuffer"; + connection.binaryType = "arraybuffer" connection.onmessage = (e: dom.MessageEvent) => { val buffer = e.data.asInstanceOf[js.typedarray.ArrayBuffer] val view = new js.typedarray.DataView(buffer) diff --git a/vfd-uav/src/main/scala/vfd/uav/Connection.scala b/vfd-uav/src/main/scala/vfd/uav/Connection.scala index b99aadd..223a787 100644 --- a/vfd-uav/src/main/scala/vfd/uav/Connection.scala +++ b/vfd-uav/src/main/scala/vfd/uav/Connection.scala @@ -35,7 +35,7 @@ trait Connection { myself: Actor => /** Adds a client to the client list and acquires a deathwatch. */ protected def register(client: ActorRef) = { - _clients += client; + _clients += client myself.context.watch(client) } -- cgit v1.2.3 From fa20b967896e3332078b6e2a4b3ca7e98a0b43f0 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Fri, 27 Mar 2015 16:56:31 +0100 Subject: reimplement mock messages --- .../src/main/scala/vfd/uav/MockConnection.scala | 57 ++++++++---------- .../main/scala/vfd/uav/mock/RandomFlightPlan.scala | 69 ++++++++++++++++++++++ 2 files changed, 95 insertions(+), 31 deletions(-) create mode 100644 vfd-uav/src/main/scala/vfd/uav/mock/RandomFlightPlan.scala diff --git a/vfd-uav/src/main/scala/vfd/uav/MockConnection.scala b/vfd-uav/src/main/scala/vfd/uav/MockConnection.scala index 6c2dbc8..1051607 100644 --- a/vfd-uav/src/main/scala/vfd/uav/MockConnection.scala +++ b/vfd-uav/src/main/scala/vfd/uav/MockConnection.scala @@ -1,45 +1,51 @@ package vfd.uav import java.util.concurrent.TimeUnit.MILLISECONDS - import scala.concurrent.duration.FiniteDuration import scala.util.Random - import org.mavlink.Packet import org.mavlink.enums.MavAutopilot import org.mavlink.enums.MavModeFlag import org.mavlink.enums.MavState import org.mavlink.enums.MavType import org.mavlink.messages.Heartbeat - import Connection.Received import akka.actor.Actor import akka.actor.ActorLogging import akka.actor.Props import akka.util.ByteString +import scala.concurrent.duration._ +import org.mavlink.messages.Message +import vfd.uav.mock.RandomFlightPlan class MockConnection(localSystemId: Byte, localComponentId: Byte, remoteSystemId: Byte) extends Actor with ActorLogging with Connection with MavlinkUtil { import Connection._ - import context._ + import context._ override val systemId = remoteSystemId override val componentId = remoteSystemId + + val plan = new RandomFlightPlan + + def scheduleMessage(delay: FiniteDuration)(fct: => Message) = system.scheduler.schedule(delay, delay){ + sendAll(Received(assemble(fct))) + } + def scheduleBytes(delay: FiniteDuration)(fct: => Array[Byte]) = system.scheduler.schedule(delay, delay){ + sendAll(Received(ByteString(fct))) + } - val MessageInterval = FiniteDuration(1000, MILLISECONDS) - - def randomData: ByteString = - assemble( - Heartbeat( - MavType.MavTypeGeneric.toByte, - MavAutopilot.MavAutopilotGeneric.toByte, - (MavModeFlag.MavModeFlagSafetyArmed | MavModeFlag.MavModeFlagManualInputEnabled).toByte, - 0, //no custom mode - MavState.MavStateActive.toByte, - 0 //TODO properly implement read-only fields - )) - - override def preStart() = context.system.scheduler.schedule(MessageInterval, MessageInterval) { - sendAll(Received(randomData)) + override def preStart() = { + //increment state + system.scheduler.schedule(0.01.seconds, 0.01.seconds){plan.tick(0.01)} + + //send messages + scheduleMessage(0.1.seconds)(plan.position) + scheduleMessage(0.1.seconds)(plan.attitude) + scheduleMessage(2.seconds)(plan.heartbeat) + + //simulate noisy line + scheduleBytes(0.3.seconds)(MockPackets.invalidCrc) + scheduleBytes(1.5.seconds)(MockPackets.invalidOverflow) } def receive = registration @@ -51,23 +57,12 @@ object MockConnection { } object MockPackets { - private val r = new Random - private implicit class RichRandom(val r: Random) extends AnyVal { - def nextByte(): Byte = r.nextInt().toByte - def nextByte(max: Int): Byte = r.nextInt(max).toByte - } - val invalidCrc = Array(254, 1, 123, 13, 13).map(_.toByte) val invalidOverflow = { - val data = Array.fill[Byte](Packet.MaxPayloadLength + 10)(42) + val data = Array.fill[Byte](Packet.MaxPayloadLength + 100)(42) data(0) = -2 data(1) = 2 data(1) = -1 data } - - def invalid = r.nextInt(2) match { - case 0 => invalidCrc - case 1 => invalidOverflow - } } \ No newline at end of file diff --git a/vfd-uav/src/main/scala/vfd/uav/mock/RandomFlightPlan.scala b/vfd-uav/src/main/scala/vfd/uav/mock/RandomFlightPlan.scala new file mode 100644 index 0000000..e2c5708 --- /dev/null +++ b/vfd-uav/src/main/scala/vfd/uav/mock/RandomFlightPlan.scala @@ -0,0 +1,69 @@ +package vfd.uav.mock + +import scala.util.Random + +import org.mavlink.Mavlink +import org.mavlink.enums.MavAutopilot +import org.mavlink.enums.MavModeFlag +import org.mavlink.enums.MavState +import org.mavlink.enums.MavType +import org.mavlink.messages.Attitude +import org.mavlink.messages.GlobalPositionInt +import org.mavlink.messages.Heartbeat + +class RandomFlightPlan { + + private var time: Double = 0 + private var x: Double = 0.0 + private var y: Double = 0.0 + private var vX: Double = 0.0 + private var vY: Double = 0.0 + + def tick(delta: Double) { + val aX = Random.nextDouble() * 5 + val aY = Random.nextDouble() * 5 + + x += vX * delta + y += vY * delta + vX += aX * delta + vY += aY * delta + + time += delta + } + + private val EarthRadius = 6000000 + private val StartLat = 46.518513 //N + private val StartLon = 6.566923 //E + + def position = GlobalPositionInt( + (time * 1000).toInt, + (StartLat + x / EarthRadius).toInt, + (StartLon + y / EarthRadius).toInt, + 0, + 0, + (vX * 100).toShort, + (vY * 100).toShort, + 0, + 0 + ) + + def attitude = Attitude( + (time * 1000).toInt, + (time / 5 * math.Pi * 2).toFloat, + (time / 4 * math.Pi * 2).toFloat, + (time / 3 * math.Pi * 2).toFloat, + 0, + 0, + 0 + ) + + def heartbeat = Heartbeat( + MavType.MavTypeGeneric.toByte, + MavAutopilot.MavAutopilotGeneric.toByte, + (MavModeFlag.MavModeFlagSafetyArmed | MavModeFlag.MavModeFlagManualInputEnabled).toByte, + 0, //no custom mode + MavState.MavStateActive.toByte, + Mavlink.MavlinkVersion + ) + +} \ No newline at end of file -- cgit v1.2.3