submit the rosflight_ws package

This commit is contained in:
XunMeng2017 2019-03-06 14:38:07 +08:00
parent 42c45a6572
commit 443393476a
894 changed files with 294912 additions and 0 deletions

View File

@ -0,0 +1 @@
# This file currently only serves to mark the location of a catkin workspace for tool integration

View File

@ -0,0 +1,63 @@
# toplevel CMakeLists.txt for a catkin workspace
# catkin/cmake/toplevel.cmake
cmake_minimum_required(VERSION 2.8.3)
set(CATKIN_TOPLEVEL TRUE)
# search for catkin within the workspace
set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}")
execute_process(COMMAND ${_cmd}
RESULT_VARIABLE _res
OUTPUT_VARIABLE _out
ERROR_VARIABLE _err
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT _res EQUAL 0 AND NOT _res EQUAL 2)
# searching fot catkin resulted in an error
string(REPLACE ";" " " _cmd_str "${_cmd}")
message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}")
endif()
# include catkin from workspace or via find_package()
if(_res EQUAL 0)
set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake")
# include all.cmake without add_subdirectory to let it operate in same scope
include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE)
add_subdirectory("${_out}")
else()
# use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument
# or CMAKE_PREFIX_PATH from the environment
if(NOT DEFINED CMAKE_PREFIX_PATH)
if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
endif()
endif()
# list of catkin workspaces
set(catkin_search_path "")
foreach(path ${CMAKE_PREFIX_PATH})
if(EXISTS "${path}/.catkin")
list(FIND catkin_search_path ${path} _index)
if(_index EQUAL -1)
list(APPEND catkin_search_path ${path})
endif()
endif()
endforeach()
# search for catkin in all workspaces
set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE)
find_package(catkin QUIET
NO_POLICY_SCOPE
PATHS ${catkin_search_path}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
unset(CATKIN_TOPLEVEL_FIND_PACKAGE)
if(NOT catkin_FOUND)
message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.")
endif()
endif()
catkin_workspace()

View File

@ -0,0 +1,94 @@
# https://github.com/byu-uav-class/rosflight_ws
# rosflight_ws
A full rosplane/rosflight workspace for class demos and getting started
## Getting Started
These instructions will get you a copy of the project up and running on your local machine.
### Prerequisites
You will need to have installed Ubuntu Linux on your computer and have ROS Kinetic installed and working.
### Installing and Building
Type the following into a terminal:
```
cd ~
git clone https://github.com/byu-uav-class/rosflight_ws.git
cd rosflight_ws
git submodule update --init --recursive
sudo apt-get install python-pip
sudo pip install geographiclib
source /opt/ros/kinetic/setup.bash
catkin_make
```
### Running the ROSplane simulator
Type the following into a terminal:
```
source ~/rosflight_ws/devel/setup.bash
roslaunch rosplane_sim fixedwing.launch
```
Click the play button in the gazebo window toolbar.
The airplane should takeoff and fly a pre-defined waypoint path.
### Running the ROSflight sil simulator
Set up your Taranis QX7 transmitter with a new model. You will probably need to setup a arm switch and reverse your elevator input. Plug the transmitter into your computer with a mini-USB cable.
Type the following into a terminal:
```
source ~/rosflight_ws/devel/setup.bash
roslaunch rosplane_sim rosflight_sil.launch
```
Click the play button in the gazebo window toolbar.
Open another terminal and type:
```
source ~/rosflight_ws/devel/setup.bash
rosservice call /fixedwing/param_load_from_file ~/rosflight_ws/param.yml
rosservice call /fixedwing/calibrate_imu
rosservice call /fixedwing/param_write
```
Flip the arm switch on the transmitter.
The airplane should takeoff and fly in an orbit.
### Running and using the Groundstation GUI
**Running**
*Before running for the first time*, see **IMPORTANT NOTE**. Because the GUI receives waypoints at the same time that the plane does, it would be wise to start the ground station before starting the ROSplane simulator.
Type the following into a terminal:
```
source ~/rosflight_ws/devel/setup.bash
roslaunch ros_groundstation gs_fixedwing.launch
```
**Using**
The fixed wing system will be rendered in real time onto the current map, which can be panned by clicking and dragging. There are four different zoom levels, which can be toggled by scrolling. The *Grid Viewer Mode* checkbox toggles a superimposed grid on the map, which gives positional meter references with respect to the map's origin at all but the outermost zoom level. State values may be compared to their commanded values in the plot widget, which is activated and toggled using the drop-down menu.
ROS subscriber topics can be changed and toggled using the *OPTIONS* popup window. See both tabs to view all the topics that can be modified. By default, *GPS init Subscriber* is disabled. This means that the plane will be rendered with respect to the origin of the selected map, ignoring the actual GPS output of the estimator. If you wish to enable this subscriber, be sure to have a map downloaded whose location actually corresponds to the "location" in the simulator, otherwise the plane will not be visible.
**IMPORTANT NOTE**:
When you run the ground station for the first time, the plugin will parse through the file **map_info.xml**, located in ~/rosflight_ws/src/ros_groundstation. Using the uncommented information, it will proceed to download map tiles for each listed map into the folder ~/.local/share/mapscache. In map_info.xml, each map field must provide a name, center latitude and longitude, and a meter-radius value to tell the parser how much map to download. A normal meter-radius is 1000 meters. The default displayed map is also defined in this file.
By default, only *Brigham Young University* is uncommented as an available map. **Downloading the tiles for a single map will take upwards of 7-8 minutes, so keep this in mind when running for the first time**. After the initial download process, no subsequent access to the internet will ever be needed to use the ground station, unless new maps are uncommented or added.
Each map requires about 1000 images, or 100 MB of space, to render all four zoom levels. In order to download multiple maps in one sitting, the user must obtain an API key from https://developers.google.com/maps/documentation/staticmaps/#api (it takes about 30 seconds to obtain a key).
The key must then be pasted within the file **key.xml**, which is also located in ~/rosflight_ws/src/ros_groundstation. Doing so will allow for downloading up to 25,000 images in a single day without incurring any charge.

View File

@ -0,0 +1,100 @@
- {name: ACC_LPF_ALPHA, type: 9, value: 0.5}
- {name: ACC_X_BIAS, type: 9, value: 0}
- {name: ACC_X_TEMP_COMP, type: 9, value: 0}
- {name: ACC_Y_BIAS, type: 9, value: 0}
- {name: ACC_Y_TEMP_COMP, type: 9, value: 0}
- {name: ACC_Z_BIAS, type: 9, value: 0}
- {name: ACC_Z_TEMP_COMP, type: 9, value: 0}
- {name: AIL_REV, type: 6, value: 0}
- {name: ARM_CHANNEL, type: 6, value: 4}
- {name: ARM_SPIN_MOTORS, type: 6, value: 0}
- {name: ARM_THRESHOLD, type: 9, value: 0.1500000059604645}
- {name: BARO_BIAS, type: 9, value: 0}
- {name: BAUD_RATE, type: 6, value: 921600}
- {name: CAL_GYRO_ARM, type: 6, value: 0}
- {name: DIFF_PRESS_BIAS, type: 9, value: 0}
- {name: ELEVATOR_REV, type: 6, value: 0}
- {name: FAILSAFE_THR, type: 9, value: 0.300000011920929}
- {name: FILTER_INIT_T, type: 6, value: 3000}
- {name: FILTER_KI, type: 9, value: 0.05000000074505806}
- {name: FILTER_KP, type: 9, value: 0.5}
- {name: FILTER_MAT_EXP, type: 6, value: 1}
- {name: FILTER_QUAD_INT, type: 6, value: 1}
- {name: FILTER_USE_ACC, type: 6, value: 1}
- {name: FIXED_WING, type: 6, value: 1}
- {name: GROUND_LEVEL, type: 9, value: 1387}
- {name: GYRO_LPF_ALPHA, type: 9, value: 0.300000011920929}
- {name: GYRO_X_BIAS, type: 9, value: 0}
- {name: GYRO_Y_BIAS, type: 9, value: 0}
- {name: GYRO_Z_BIAS, type: 9, value: 0}
- {name: MAG_A11_COMP, type: 9, value: 1}
- {name: MAG_A12_COMP, type: 9, value: 0}
- {name: MAG_A13_COMP, type: 9, value: 0}
- {name: MAG_A21_COMP, type: 9, value: 0}
- {name: MAG_A22_COMP, type: 9, value: 1}
- {name: MAG_A23_COMP, type: 9, value: 0}
- {name: MAG_A31_COMP, type: 9, value: 0}
- {name: MAG_A32_COMP, type: 9, value: 0}
- {name: MAG_A33_COMP, type: 9, value: 1}
- {name: MAG_X_BIAS, type: 9, value: 0}
- {name: MAG_Y_BIAS, type: 9, value: 0}
- {name: MAG_Z_BIAS, type: 9, value: 0}
- {name: MIN_THROTTLE, type: 6, value: 0}
- {name: MIXER, type: 6, value: 10}
- {name: MOTOR_IDLE_THR, type: 9, value: 0.1000000014901161}
- {name: MOTOR_MAX_PWM, type: 6, value: 2000}
- {name: MOTOR_MIN_PWM, type: 6, value: 1000}
- {name: MOTOR_PWM_UPDATE, type: 6, value: 50}
- {name: OVRD_LAG_TIME, type: 6, value: 1000}
- {name: PARAM_MAX_CMD, type: 9, value: 1}
- {name: PID_PITCH_ANG_D, type: 9, value: 0.07000000029802322}
- {name: PID_PITCH_ANG_I, type: 9, value: 0}
- {name: PID_PITCH_ANG_P, type: 9, value: 0.1500000059604645}
- {name: PID_PITCH_RATE_D, type: 9, value: 0}
- {name: PID_PITCH_RATE_I, type: 9, value: 0}
- {name: PID_PITCH_RATE_P, type: 9, value: 0.07000000029802322}
- {name: PID_ROLL_ANG_D, type: 9, value: 0.07000000029802322}
- {name: PID_ROLL_ANG_I, type: 9, value: 0}
- {name: PID_ROLL_ANG_P, type: 9, value: 0.1500000059604645}
- {name: PID_ROLL_RATE_D, type: 9, value: 0}
- {name: PID_ROLL_RATE_I, type: 9, value: 0}
- {name: PID_ROLL_RATE_P, type: 9, value: 0.07000000029802322}
- {name: PID_TAU, type: 9, value: 0.05000000074505806}
- {name: PID_YAW_RATE_D, type: 9, value: 0}
- {name: PID_YAW_RATE_I, type: 9, value: 0}
- {name: PID_YAW_RATE_P, type: 9, value: 0.25}
- {name: RC_ATT_CTRL_CHN, type: 6, value: -1}
- {name: RC_ATT_MODE, type: 6, value: 1}
- {name: RC_ATT_OVRD_CHN, type: 6, value: 4}
- {name: RC_F_CHN, type: 6, value: 2}
- {name: RC_MAX_PITCH, type: 9, value: 0.7860000133514404}
- {name: RC_MAX_PITCHRATE, type: 9, value: 3.141590118408203}
- {name: RC_MAX_ROLL, type: 9, value: 0.7860000133514404}
- {name: RC_MAX_ROLLRATE, type: 9, value: 3.141590118408203}
- {name: RC_MAX_YAWRATE, type: 9, value: 1.506999969482422}
- {name: RC_NUM_CHN, type: 6, value: 6}
- {name: RC_OVRD_DEV, type: 9, value: 0.1000000014901161}
- {name: RC_THR_OVRD_CHN, type: 6, value: 4}
- {name: RC_TYPE, type: 6, value: 1}
- {name: RC_X_CHN, type: 6, value: 0}
- {name: RC_Y_CHN, type: 6, value: 1}
- {name: RC_Z_CHN, type: 6, value: 3}
- {name: RUDDER_REV, type: 6, value: 0}
- {name: STRM_AIRSPEED, type: 6, value: 20}
- {name: STRM_ATTITUDE, type: 6, value: 200}
- {name: STRM_BARO, type: 6, value: 50}
- {name: STRM_HRTBT, type: 6, value: 1}
- {name: STRM_IMU, type: 6, value: 500}
- {name: STRM_MAG, type: 6, value: 50}
- {name: STRM_RC, type: 6, value: 50}
- {name: STRM_SERVO, type: 6, value: 50}
- {name: STRM_SONAR, type: 6, value: 40}
- {name: STRM_STATUS, type: 6, value: 10}
- {name: SWITCH_5_DIR, type: 6, value: 1}
- {name: SWITCH_6_DIR, type: 6, value: 1}
- {name: SWITCH_7_DIR, type: 6, value: 1}
- {name: SWITCH_8_DIR, type: 6, value: 1}
- {name: SYS_ID, type: 6, value: 1}
- {name: X_EQ_TORQUE, type: 9, value: 0}
- {name: Y_EQ_TORQUE, type: 9, value: 0}
- {name: Z_EQ_TORQUE, type: 9, value: 0}

View File

@ -0,0 +1,111 @@
cmake_minimum_required(VERSION 2.8.3)
project(ros_groundstation)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
rospy
rqt_gui
rqt_gui_py
)
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
catkin_python_setup()
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES ros_groundstation
# CATKIN_DEPENDS rospy rqt_gui_py
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)
## Declare a cpp library
# add_library(ros_groundstation
# src/${PROJECT_NAME}/ros_groundstation.cpp
# )
## Declare a cpp executable
# add_executable(ros_groundstation_node src/ros_groundstation_node.cpp)
## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(ros_groundstation_node ros_groundstation_generate_messages_cpp)
## Specify libraries to link a library or executable target against
# target_link_libraries(ros_groundstation_node
# ${catkin_LIBRARIES}
# )
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
install(PROGRAMS
scripts/ros_groundstation
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
## Mark executables and/or libraries for installation
# install(TARGETS ros_groundstation ros_groundstation_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )
## Mark other files for installation (e.g. launch and bag files, etc.)
#install(DIRECTORY
# resource
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
#)
install(FILES
plugin.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_ros_groundstation.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)

View File

@ -0,0 +1,40 @@
# ros_groundstation
RQT plugin for interacting with byu-magicc ROSplane
## Installation Instructions:
1. Install pip (if you don't already have it) and the python geographiclib library.
```
sudo apt-get install python-pip
sudo pip install geographiclib
```
2. Clone this repository into the source directory of a workspace. ROSplane and ROSflight are mandatory dependencies.
3. Build and source the workspace.
**IMPORTANT NOTE**: see the following section about map_info.xml, key.xml, and default_topics.yaml **before running for the first time!**
4. Run with the command:
```
roslaunch ros_groundstation gs.launch
```
OR
```
rqt
```
- If running through rqt, the ground station will be available as a new plugin under ROSplane -> GroundStation.
## Running for the first time: map_info.xml and key.xml
When you run the ground station for the first time, the plugin will parse through the file **map_info.xml**, located in the top directory. Using the uncommented information, it will proceed to download map tiles for each map listed in ~/.local/share/mapscache.
In this file, each map field must provide a name, center latitude and longitude, and a meter-radius value to tell the parser how much map to download. A normal meter-radius is 1000 meters. The default displayed map is also defined in this file.
By default, only *Brigham Young University* is uncommented as an available map. Downloading the tiles for a single map will take upwards of 7-8 minutes, so keep this in mind when running for the first time. After the initial download process, no subsequent access to the internet will ever be needed to use the ground station.
Each map requires about 1000 images, or 100 MB of space, to render all four zoom levels. In order to download multiple maps in one sitting, the user must obtain an API key from https://developers.google.com/maps/documentation/staticmaps/#api (it takes about 30 seconds to do so).
The key must then be pasted within the file **key.xml**. Doing so will allow for downloading up to 25,000 images in a single day without incurring any charge.
To change which topics are subscribed to be default, modify the contents of **default_topics.yaml**, located in the params folder.
## In case of plugin issues:
Sometimes, rqt experiences conflicts with a new plugin if it appears to be overriding a previous one. This is only really an issue if building the ground station in multiple workspaces. To overcome this behavior, use the following command:
```
rm ~/.config/ros.org/rqt_gui.ini
```
Then, after sourcing the new workspace, the plugin should be available under ROSplane -> GroundStation in the rqt menu.

View File

@ -0,0 +1,5 @@
<!--Get a key from https://developers.google.com/maps/documentation/staticmaps/#api_key
and put it between the delimiters below-->
<key>
</key>

View File

@ -0,0 +1,6 @@
<launch>
<rosparam command="load" file="$(find ros_groundstation)/params/default_topics.yaml"/>
<node name="ground_station" pkg="ros_groundstation" type="ros_groundstation" output="screen"/>
</launch>

View File

@ -0,0 +1,6 @@
<launch>
<rosparam command="load" file="$(find ros_groundstation)/params/fixedwing_topics.yaml"/>
<node name="ground_station" pkg="ros_groundstation" type="ros_groundstation" output="screen"/>
</launch>

View File

@ -0,0 +1,12 @@
<launch>
<arg name="bag_name" default="flight"/>
<arg name="bag_path" default="/home/andrew/Research/groundstation_ws/bags"/>
<rosparam command="load" file="$(find ros_groundstation)/params/default_topics.yaml"/>
<node name="ground_station" pkg="ros_groundstation" type="ros_groundstation" output="screen"/>
<node pkg="rosbag" type="play" name="player" output="screen" args="-q --clock $(arg bag_path)/$(arg bag_name).bag"/>
</launch>

View File

@ -0,0 +1,12 @@
<launch>
<arg name="port" default="/dev/ttyUSB0"/>
<rosparam command="load" file="$(find ros_groundstation)/params/default_topics_telemetry.yaml"/>
<node name="ground_station" pkg="ros_groundstation" type="ros_groundstation" output="screen"/>
<node name="telem_io_node" pkg="telemetry" type="telemetry_io" output="screen">
<param name="port" value="$(arg port)"/>
</node>
</launch>

View File

@ -0,0 +1,45 @@
<maps default="Brigham Young University">
<!--
<map name="Map Name For Menu">
<lat>Latitude Float (N+, S-)</lat>
<lon>Longitude Float (E+, W-)</lon>
<zoom>How Much Map Zooms (int)</zoom>
</map>
-->
<map name="Brigham Young University">
<lat>40.2518</lat>
<lon>-111.6493</lon>
<zoom>18</zoom>
<radius_m>1000</radius_m>
</map>
<!--<map name="Elberta">
<lat>39.9764</lat>
<lon>-111.9582</lon>
<zoom>18</zoom>
<radius_m>1000</radius_m>
</map>
<map name="Kawasaki Field">
<lat>40.174571</lat>
<lon>-111.651641</lon>
<zoom>18</zoom>
<radius_m>1000</radius_m>
</map>
<map name="Naval Base Competition">
<lat>38.146191</lat>
<lon>-76.429454</lon>
<zoom>18</zoom>
<radius_m>1000</radius_m>
</map>
<map name="Utah County Airfield">
<lat>40.3634</lat>
<lon>-111.9019</lon>
<zoom>18</zoom>
<radius_m>1000</radius_m>
</map>
<map name="Rock Canyon Park">
<lat>40.2678966681</lat>
<lon>-111.634524573</lon>
<zoom>18</zoom>
<radius_m>1000</radius_m>
</map>-->
</maps>

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<package>
<name>ros_groundstation</name>
<version>1.0.0</version>
<description>ground_station provides a gui for interacting with BYU Magicc Lab's ros_plane.</description>
<maintainer email="andrew.torgesen@gmail.com">Andrew Torgesen</maintainer>
<license>TODO</license>
<url type="repository">(pending)</url>
<author>Andrew Torgesen</author>
<buildtool_depend>catkin</buildtool_depend>
<run_depend>geometry_msgs</run_depend>
<run_depend>nav_msgs</run_depend>
<run_depend version_gte="0.2.19">python_qt_binding</run_depend>
<run_depend>qt_gui</run_depend>
<run_depend>rospy</run_depend>
<run_depend>rqt_gui</run_depend>
<run_depend>rqt_gui_py</run_depend>
<run_depend>rqt_py_common</run_depend>
<run_depend>tf</run_depend>
<run_depend>rosplane_msgs</run_depend>
<run_depend>rosflight_msgs</run_depend>
<export>
<rqt_gui plugin="${prefix}/plugin.xml" />
</export>
</package>

View File

@ -0,0 +1,30 @@
stateSubChecked: true
stateSubTopic: /state
gpsInitSubChecked: true
gpsInitSubTopic: /state
pathSubChecked: true
pathSubTopic: /current_path
waypointSubChecked: true
waypointSubTopic: /waypoint_path
waypointPubChecked: false
waypointPubTopic: /waypoint_path
rcRawSubChecked: true
rcRawSubTopic: /rc_raw
rcRawChannel: 6
gpsDataSubChecked: true
gpsDataSubTopic: /gps/data
controllerInternalsSubChecked: true
controllerInternalsSubTopic: /controller_inners
controllerCommandsSubChecked: true
controllerCommandsSubTopic: /controller_commands
obstacleSubChecked: false
obstacleSubTopic: /obstacles

View File

@ -0,0 +1,30 @@
stateSubChecked: true
stateSubTopic: /state_out
gpsInitSubChecked: true
gpsInitSubTopic: /state_out
pathSubChecked: true
pathSubTopic: /current_path_out
waypointSubChecked: true
waypointSubTopic: /waypoint_path_out
waypointPubChecked: false
waypointPubTopic: /waypoint_path_out
rcRawSubChecked: true
rcRawSubTopic: /rc_raw_out
rcRawChannel: 6
gpsDataSubChecked: true
gpsDataSubTopic: /gps/data_out
controllerInternalsSubChecked: true
controllerInternalsSubTopic: /controller_inners_out
controllerCommandsSubChecked: true
controllerCommandsSubTopic: /controller_commands_out
obstacleSubChecked: false
obstacleSubTopic: /obstacles_out

View File

@ -0,0 +1,30 @@
stateSubChecked: true
stateSubTopic: /fixedwing/state
gpsInitSubChecked: false
gpsInitSubTopic: /fixedwing/state
pathSubChecked: true
pathSubTopic: /fixedwing/current_path
waypointSubChecked: true
waypointSubTopic: /fixedwing/waypoint_path
waypointPubChecked: false
waypointPubTopic: /fixedwing/waypoint_path
rcRawSubChecked: true
rcRawSubTopic: /fixedwing/rc_raw
rcRawChannel: 6
gpsDataSubChecked: true
gpsDataSubTopic: /fixedwing/gps
controllerInternalsSubChecked: true
controllerInternalsSubTopic: /fixedwing/controller_inners
controllerCommandsSubChecked: true
controllerCommandsSubTopic: /fixedwing/controller_commands
obstacleSubChecked: false
obstacleSubTopic: /obstacles

View File

@ -0,0 +1,17 @@
<library path="src">
<class name="GroundStation" type="ros_groundstation.gs_plugin.GroundStationPlugin" base_class_type="rqt_gui_py::Plugin">
<description>
Ground station for planes running ROSplane.
</description>
<qtgui>
<group>
<label>ROSplane</label>
<icon type="theme">folder</icon>
<statustip>Plugins related to the AUVSI competition.</statustip>
</group>
<label>Ground Station</label>
<icon type="theme">video-display</icon>
<statustip>Ground Station</statustip>
</qtgui>
</class>
</library>

View File

@ -0,0 +1,10 @@
#!/usr/bin/env python
import sys
from ros_groundstation.gs_plugin import GroundStationPlugin
from rqt_gui.main import Main
plugin = 'ros_groundstation'
main = Main(filename=plugin)
sys.exit(main.main(standalone=plugin))

View File

@ -0,0 +1,11 @@
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_distutils_setup(
packages=['ros_groundstation'],
package_dir={'': 'src'}
)
setup(**setup_args)

View File

@ -0,0 +1,178 @@
import math, urllib, os, shutil, time, sys
import xml.etree.cElementTree as ET
from map_info_parser import get_key
from PyQt5.QtGui import QImage, QPainter
from PyQt5.QtCore import QPoint
QString = type("")
_default_radius_m = 1000 # * radius of map coverage, in meters
zooms = [17,18,19,20] # 0-22
_PWD = os.path.dirname(os.path.abspath(__file__))
def pd(path):
return os.path.abspath(os.path.join(path, os.pardir))
_INFO_FILE_PATH = os.path.join(pd(pd(_PWD)), 'map_info.xml')
if get_key():
_KEY = '&key=' + get_key()
else:
_KEY = ''
TILEWIDTH = 640 # Larget tile dimension you can grab without paying
TILEHEIGHT = 615 # Effective height to cut off Google logo
_GOOGLESTRIP = 25 # Height of the Google logo, which will be cut off
_GRABRATE = 4 # Fastest rate at which we can download tiles without paying
_EARTHPIX = 268435456 # Number of pixels in half the earth's circumference at zoom = 21
_DEGREE_PRECISION = 4 # Number of decimal places for rounding coordinates
_pixrad = _EARTHPIX / math.pi
_MAPS_CACHE_PATH = os.path.expanduser('~/.local/share/mapscache')
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def startProgress(title):
global progress_x
sys.stdout.write(title + ": [" + "-" * 40 + "]" + chr(8) * 41)
sys.stdout.flush()
progress_x = 0
def progress(x):
global progress_x
x = int(x * 40 // 100)
sys.stdout.write("#" * (x - progress_x))
sys.stdout.flush()
progress_x = x
def endProgress():
sys.stdout.write("#" * (40 - progress_x) + "]\n")
sys.stdout.flush()
def clearContents(folder):
shutil.rmtree(folder)
os.makedirs(folder)
def round_to(val, digits):
return int(val * 10**digits) / 10.**digits
def pixels_to_degrees(pixels, zoom):
return pixels * 2 ** (21 - zoom)
def pix_to_lon(j, lon, ntiles, tile_size, zoom):
lonpix = _EARTHPIX + lon * math.radians(_pixrad)
return math.degrees((lonpix + pixels_to_degrees(((j)-ntiles/2)*tile_size, zoom) - _EARTHPIX) / _pixrad)
def pix_to_lat(k, lat, ntiles, tile_size, zoom):
sinlat = math.sin(math.radians(lat))
latpix = _EARTHPIX - _pixrad * math.log((1 + sinlat)/(1 - sinlat)) / 2.0
return math.degrees(math.pi/2 - 2 * math.atan(math.exp(((latpix + pixels_to_degrees((k-ntiles/2)*tile_size, zoom)) - _EARTHPIX) / _pixrad)))
# for fetching tiles from google
urlbase = 'https://maps.googleapis.com/maps/api/staticmap?center=%f,%f&zoom=%d&maptype=%s&size=%dx%d&format=jpg'
urlbase += _KEY
# extract info for each map, for comparing and compiling
print bcolors.BOLD + 'Parsing map_info.xml...' + bcolors.ENDC
map_dict = {}
try:
xmlroot = ET.parse(_INFO_FILE_PATH).getroot()
for xmlnode in xmlroot.findall('map'):
name = xmlnode.attrib['name']
map_dict[name] = {}
map_dict[name]['lat'] = float(str(xmlnode.find('lat').text))
map_dict[name]['lon'] = float(str(xmlnode.find('lon').text))
if not xmlnode.find('radius_m'):
map_dict[name]['r_m'] = _default_radius_m
else:
map_dict[name]['r_m'] = int(str(xmlnode.find('radius_m').text))
map_dict[name]['fetch'] = False
except:
print bcolors.BOLD + bcolors.FAIL + 'ERROR: Incorrectly formatted xml file!' + bcolors.ENDC
# check to see which maps need to be fetched or updated
for mapname in map_dict:
print bcolors.OKGREEN + 'Processing maps for %s...' % mapname + bcolors.ENDC
folder_path = os.path.join(_MAPS_CACHE_PATH, mapname)
log_path = os.path.join(folder_path, '_log.txt')
if os.path.exists(folder_path):
if os.path.exists(log_path):
with open(log_path, 'r') as logfile:
loginfo = logfile.read().split('\n')
try:
if not (float(loginfo[0]) == map_dict[mapname]['lat'] and \
float(loginfo[1]) == map_dict[mapname]['lon'] and \
int(loginfo[2]) == map_dict[mapname]['r_m']):
map_dict[mapname]['fetch'] = True
except:
map_dict[mapname]['fetch'] = True
else:
map_dict[mapname]['fetch'] = True
else:
os.makedirs(folder_path)
map_dict[mapname]['fetch'] = True
# fetch tiles from the internet, if needed
if map_dict[mapname]['fetch']:
clearContents(folder_path)
print 'Downloading maps for %s...' % mapname
latitude = round_to(map_dict[mapname]['lat'], _DEGREE_PRECISION)
longitude = round_to(map_dict[mapname]['lon'], _DEGREE_PRECISION)
radius_meters = map_dict[mapname]['r_m']
for zoom in zooms:
zoom_folder_path = os.path.join(folder_path, str(zoom))
os.makedirs(zoom_folder_path)
startProgress('\tAt zoom level = %d' % zoom)
# the following conversion formula comes from an employee at google:
# https://groups.google.com/forum/#!topic/google-maps-js-api-v3/hDRO4oHVSeM
pixels_per_meter = 2**zoom / (156543.03392 * math.cos(math.radians(latitude)))
# number of tiles required to go from center latitude to desired radius in meters
ntiles_x = int(round(2.0 * pixels_per_meter * radius_meters / TILEWIDTH))
ntiles_y = int(round(2.0 * pixels_per_meter * radius_meters / TILEHEIGHT))
if zoom <= 19:
bigimage = QImage(ntiles_x * TILEWIDTH, ntiles_y * TILEHEIGHT, 4) # -----------
with open(os.path.join(zoom_folder_path, 'info.txt'), 'w') as info_file:
for i in range(ntiles_x):
lon = pix_to_lon(i, longitude, ntiles_x, TILEWIDTH, zoom)
for j in range(ntiles_y):
lat = pix_to_lat(j, latitude, ntiles_y, TILEHEIGHT, zoom)
specs = lat, lon, zoom, 'satellite', TILEWIDTH, TILEWIDTH
filename = os.path.join(zoom_folder_path, ('%d_%d' % (i, j)) + '.jpg')
url = urlbase % specs
result = urllib.urlopen(url).read()
tile = QImage()
tile.loadFromData(result)
tile.save(QString(filename))
info_file.write('%d %d %f %f\n' % (i, j, lat, lon))
progress(int((1.0 * ntiles_y * i + j) / (ntiles_x * ntiles_y) * 100))
time.sleep(1.0 / _GRABRATE)
if zoom <= 19:
destPos = QPoint(i*TILEWIDTH, j*TILEHEIGHT) # ---------
painter = QPainter(bigimage) # --------------------------
painter.drawImage(destPos, tile) # ----------------------
painter.end() # -----------------------------------------
endProgress()
if zoom <= 19:
bigfilename = os.path.join(folder_path, 'ZOOM %d.jpg' % zoom) # --------------
bigimage.save(QString(bigfilename)) # ----------------------------------------
#+++++++++++++++++++++++++++++++++++++
with open(log_path, 'w') as logfile:
logfile.write(str(map_dict[mapname]['lat']) + '\n')
logfile.write(str(map_dict[mapname]['lon']) + '\n')
logfile.write(str(map_dict[mapname]['r_m']) + '\n')
else:
print 'Downloaded maps for %s already up to date.' % mapname

View File

@ -0,0 +1,77 @@
# Taylor Pool
# March 14, 2017
# AUVSI Project
# Contains a Geobase class that can be used to convert from GPS to NED and vise versa
##############################
from geographiclib.geodesic import Geodesic
import math
class Geobase:
#Initializer Function
def __init__(self, originLat, originLong, originHeight=0): #Sets base location
self.origin = [originLat, originLong, originHeight]
#Instance Base Location Modifier
def change_origin(self, originLat, originLong, originHeight=0):
self.origin = [originLat, originLong, originHeight]
#GPS to NED
#Pre: lat2 and long2 are in long decimal format or DD-MM-SS
#Post: Returns a list containing location in [north, east, down]
def gps_to_ned(self, lat2, long2, height=0):
#Conversion to Long Decimal Format from DD-MM-SS
values = [str(lat2), str(long2)]
newValues = []
for value in values:
if ("N" in value) or ("S" in value) or ("E" in value) or ("W" in value) == True:
newValues.append(decimal_degrees(value))
else:
newValues.append(float(value))
diction = Geodesic.WGS84.Inverse(self.origin[0], self.origin[1], newValues[0], newValues[1])
solution = [diction['s12']*math.cos(math.radians(diction['azi1'])), diction['s12']*math.sin(math.radians(diction['azi1'])), -height]
return solution
#NED to GPS
#Pre: north, east ,down are in meters
#Post: Returns latitude, longitude, altitude
def ned_to_gps(self, north, east, down = 0):
arc_distance = math.sqrt(north**2+east**2)
'''
if arc_distance == 0:
return self.origin[0], self.origin[1], -down
else:
azi_1 = math.degrees(math.asin(east/arc_distance))
'''
azi_1 = math.degrees(math.atan2(east, north))
diction = Geodesic.WGS84.Direct(self.origin[0], self.origin[1], azi_1, arc_distance)
#solution = [diction['lat2'], diction['lon2'], -down]
#return solution
#if diction['lat2'] < self.origin[0]:
# print 'The problem\'s not me!==========================='
#else:
# print '+++++++++++++++++++++++++'
return diction['lat2'], diction['lon2'], -down
#Function decimal_degrees
#Pre: string is in format [N/E or S/W]DD-MM-SS.SS
#Post: Returns GPS component in long decimal format
def decimal_degrees (string):
a = 0
firstLetter = string[0]
if firstLetter == 'N' or firstLetter == 'E':
a = 1
elif firstLetter == 'S' or firstLetter == 'W':
a = -1
lessString = string.strip("NSEW ")
values = lessString.split('-', 2)
d = float(values[0])
m = float(values[1])
s = float(values[2])
decimal = a*(d+(m/60.0)+(s/3600.0))
return decimal

View File

@ -0,0 +1,27 @@
from PyQt5.QtCore import QObject, pyqtSignal
class WP_Handler(QObject):
# Signal for clicked waypoint with args (float lat, float lon)
wp_clicked = pyqtSignal(float, float)
# Signal for inserted waypoint with args (float lat, float lon, float alt, int position)
# Position is inserted position in flight path list
wp_inserted = pyqtSignal(float, float, float, int)
# Signal for removing waypoint with arg (int position)
wp_removed = pyqtSignal(int)
# Signal for notifying a change in map home, with arg (string new_home)
home_changed = pyqtSignal(str)
def emit_clicked(self, lat, lon):
self.wp_clicked.emit(lat, lon)
def emit_inserted(self, lat, lon, alt, pos):
self.wp_inserted.emit(lat, lon, alt, pos)
def emit_removed(self, pos):
self.wp_removed.emit(pos)
def emit_home_change(self, new_home):
self.home_changed.emit(new_home)

View File

@ -0,0 +1,289 @@
import sys, math, rospy, random
from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QPointF,QRectF, QPoint
from PyQt5.QtGui import QColor, QBrush, QPen, QFont, QPolygon
from std_msgs.msg import Float32
from .map_subscribers import *
class ArtificialHorizon(QtWidgets.QWidget):
def __init__(self):
super(ArtificialHorizon, self).__init__()
self.initUI()
def initUI(self):
self.height = 600
self.width = 600
self.roll = 0 # degrees
self.pitch = 0 # degrees
self.speed = 0 # KIAS
self.altitude = 0 # ft MSL
self.heading = 0 # degrees
self.numSat = 0 # Number of Satellites (GPS)
self.pitchInterval = 0.013 # % of height used to display 1 degree
self.setGeometry(300, 300, self.width, self.height)
self.setWindowTitle('Artificial Horizon')
self.show()
def resizeEvent(self, newSize):
self.width = newSize.size().width()
self.height = newSize.size().height()
def paintEvent(self, event):
painter = QtGui.QPainter()
painter.begin(self)
self.drawArtificialHorizon(event, painter)
painter.end()
def drawArtificialHorizon(self, event, painter):
# extract relevant values here from subscribers
self.roll = int (math.floor(StateSub.phi*(180.0/math.pi)))
self.pitch = int (math.floor(StateSub.theta*(180.0/math.pi)))
self.speed = int (math.floor(StateSub.Va))
self.altitude = int (math.floor(StateSub.alt))
self.heading = int (math.floor(StateSub.psi*(180.0/math.pi))) % 360
self.numSat = GPSDataSub.numSat
self.drawSky(event, painter)
painter.translate(self.width/2, self.height/2)
painter.rotate(-self.roll)
painter.translate(-self.width/2, -self.height/2)
painter.translate(0,self.height*(self.pitch*self.pitchInterval))
self.drawGround(event, painter)
self.drawPitchIndicator(event, painter)
painter.translate(0,self.height*(-1*self.pitch*self.pitchInterval))
self.drawTurnIndicator(event, painter)
painter.translate(self.width/2, self.height/2)
painter.rotate(self.roll)
painter.translate(-self.width/2, -self.height/2)
self.drawAircraftSymbol(event, painter)
self.drawAirspeedIndicator(event, painter)
self.drawAltitudeIndicator(event, painter)
self.drawHeadingIndicator(event, painter)
self.drawNumSatellites(event, painter)
#self.drawWaypointAccuracy(event, painter)
def drawNumSatellites(self, event, painter):
p1 = QPoint(0,0)
p2 = QPoint(self.width*(0.25),self.height*0.1)
rect = QRectF(p1,p2)
if self.numSat < 4:
painter.setPen(QPen(QBrush(Qt.red), 2, Qt.SolidLine))
else:
painter.setPen(QPen(QBrush(Qt.green), 2, Qt.SolidLine))
painter.drawText(rect,QtCore.Qt.AlignCenter,"GPS: " + str(self.numSat) + " satellites")
#def drawWaypointAccuracy(self, event, painter):
# p1 = QPoint(self.width*(0.65),0)
# p2 = QPoint(self.width,self.height*0.1)
# rect = QRectF(p1,p2)
# painter.drawText(rect,QtCore.Qt.AlignCenter,"Wp Accuracy: " + "%.2f" % self.latestWpAccuracy + " m")
def drawSky(self, event, painter):
brush = QtGui.QBrush(QtGui.QColor(38, 89, 242), QtCore.Qt.SolidPattern)
painter.fillRect(QRectF(0,0,self.width, self.height), brush)
def drawGround(self, event, painter):
brush = QtGui.QBrush(QtGui.QColor(84, 54, 10), QtCore.Qt.SolidPattern)
painter.fillRect(QRectF(-300,self.height/2,self.width+600, self.height*(0.5+self.pitchInterval*180)), brush)
painter.setPen(QPen(QBrush(Qt.white), 2, Qt.SolidLine, Qt.RoundCap))
painter.drawLine(-300,self.height/2,self.width+600,self.height/2)
def drawHeadingIndicator(self, event, painter):
boxWidth = self.width*1.0
boxHeight = self.height*0.1
brush = QtGui.QBrush(QColor(100,100,100,200))
painter.setPen(QPen(QBrush(Qt.yellow), 2, Qt.SolidLine))
painter.fillRect(QRectF((self.width-boxWidth)/2,self.height-boxHeight,boxWidth,boxHeight),brush)
directions = {0:"N",45:"NE",90:"E",135:"SE",180:"S",215:"SW",270:"W",315:"NW"}
scale = 0.01
for i in range(self.heading-49,self.heading+49):
if i % 10 == 0:
x = self.width*0.5-((self.heading-i)*scale*self.width)
y = self.height-boxHeight
if i < 0:
i += 360
i = i % 360
text = str(i)
if i in directions:
text = directions[i]
painter.drawLine(x,y,x,y+5)
painter.drawText(QPoint(x+7-8*len(text),y+22),text)
painter.setBrush(Qt.black)
p1 = QPoint(self.width*(0.46),self.height)
p2 = QPoint(self.width*(0.46),self.height - boxHeight*0.9)
p3 = QPoint(self.width*(0.50),self.height - boxHeight)
p4 = QPoint(self.width*(0.54),self.height - boxHeight*0.9)
p5 = QPoint(self.width*(0.54),self.height)
poly = QPolygon([p1,p2,p3,p4,p5])
painter.setPen(QPen(QBrush(QColor(0,0,0,0)), 2, Qt.SolidLine, Qt.RoundCap))
painter.drawPolygon(poly)
painter.setPen(QPen(QBrush(QColor(255,255,0)), 2, Qt.SolidLine, Qt.RoundCap))
rect = QRectF(p1,p4)
painter.drawText(rect,QtCore.Qt.AlignCenter,str(self.heading) + u'\N{DEGREE SIGN}')
def drawAirspeedIndicator(self, event, painter):
boxWidth = self.width*0.13
boxHeight = self.height*0.6
brush = QtGui.QBrush(QColor(100,100,100,200))
painter.setPen(QPen(QBrush(Qt.yellow), 2, Qt.SolidLine))
painter.fillRect(QRectF(0,(self.height-boxHeight)/2,boxWidth,boxHeight),brush)
scale = 0.01
for i in range(self.speed-29,self.speed+29):
if i % 10 == 0 and i >= 0:
x = boxWidth
y = self.height*0.5+((self.speed-i)*scale*self.height)
text = str(i)
painter.drawLine(x-5,y,x,y)
painter.drawText(QPoint(x-10-8*len(text),y+5),text)
painter.setBrush(Qt.black)
p1 = QPoint(0,self.height*(0.46))
p2 = QPoint(boxWidth*0.9,self.height*(0.46))
p3 = QPoint(boxWidth,self.height*(0.5))
p4 = QPoint(boxWidth*0.9,self.height*(0.54))
p5 = QPoint(0,self.height*(0.54))
poly = QPolygon([p1,p2,p3,p4,p5])
painter.setPen(QPen(QBrush(QColor(0,0,0,0)), 2, Qt.SolidLine, Qt.RoundCap))
painter.drawPolygon(poly)
painter.setPen(QPen(QBrush(QColor(255,255,0)), 2, Qt.SolidLine, Qt.RoundCap))
rect = QRectF(p1,p4)
painter.drawText(rect,QtCore.Qt.AlignCenter,str(self.speed) + " kt")
painter.drawText(QPoint(5,(self.height-boxHeight)/2-5),"Airspeed (KIAS)")
def drawAltitudeIndicator(self, event, painter):
boxWidth = self.width*0.13
boxHeight = self.height*0.6
brush = QtGui.QBrush(QColor(100,100,100,200))
painter.setPen(QPen(QBrush(Qt.yellow), 2, Qt.SolidLine))
painter.fillRect(QRectF(self.width-boxWidth,(self.height-boxHeight)/2,boxWidth,boxHeight),brush)
scale = 0.01
for i in range(self.altitude-29,self.altitude+29):
if i % 10 == 0:
x = self.width - boxWidth
y = self.height*0.5+((self.altitude-i)*scale*self.height)
text = str(i)
painter.drawLine(x,y,x+5,y)
painter.drawText(QPoint(x+10,y+5),text)
painter.setBrush(Qt.black)
p1 = QPoint(self.width,self.height*(0.46))
p2 = QPoint(self.width-boxWidth*0.9,self.height*(0.46))
p3 = QPoint(self.width-boxWidth,self.height*(0.5))
p4 = QPoint(self.width-boxWidth*0.9,self.height*(0.54))
p5 = QPoint(self.width,self.height*(0.54))
poly = QPolygon([p1,p2,p3,p4,p5])
painter.setPen(QPen(QBrush(QColor(0,0,0,0)), 2, Qt.SolidLine))
painter.drawPolygon(poly)
painter.setPen(QPen(QBrush(QColor(255,255,0)), 2, Qt.SolidLine))
text = str(self.altitude) + " m"
rect = QRectF(p1,p4)
painter.drawText(rect,QtCore.Qt.AlignCenter,text)
painter.drawText(QPoint(self.width-boxWidth+5,(self.height-boxHeight)/2-5),"Altitude")
def drawTurnIndicator(self, event, painter):
painter.setBrush(Qt.white)
painter.setPen(QPen(QBrush(Qt.white), 2, Qt.SolidLine, Qt.RoundCap))
radius = self.width*(0.3)
yOffset = self.height*(0.10)
painter.drawArc(
QRectF(self.width*(0.5)-radius,yOffset, 2*radius, 2*radius),
16*30,16*120)
height = self.height*0.02
x = self.width/2
y = yOffset
x2 = x
y2 = y-height
x3 = x
y3 = y2-5
xCenter = self.width/2
yCenter = radius + yOffset
angles = [-60,-45,-30,-20,-10,0,10,20,30,45,60]
for angle in angles:
painter.translate(xCenter,yCenter)
painter.rotate(angle)
painter.translate(-xCenter,-yCenter)
painter.drawLine(x,y,x2,y2)
text = str(angle)
painter.drawText(QPoint(x3-4*len(text),y3),text)
painter.translate(xCenter,yCenter)
painter.rotate(-angle)
painter.translate(-xCenter,-yCenter)
# Draw the arrow
height = self.height*0.025
poly = QPolygon([
QPoint(x,y),
QPoint(x-height/2,y+height),
QPoint(x+height/2,y+height),])
painter.translate(xCenter,yCenter)
painter.rotate(self.roll)
painter.translate(-xCenter,-yCenter)
painter.drawPolygon(poly)
painter.translate(xCenter,yCenter)
painter.rotate(-self.roll)
painter.translate(-xCenter,-yCenter)
def drawAircraftSymbol(self, event, painter):
brightYellow = QtGui.QColor(255, 255, 0)
widthFraction = 0.10
heightFraction = 0.05
painter.setPen(QPen(QBrush(brightYellow), 5, Qt.SolidLine, Qt.RoundCap))
painter.setBrush(brightYellow)
poly = QPolygon([
QPoint(self.width*0.5, self.height*0.5),
QPoint(self.width*(0.5+widthFraction/2.0),self.height*(0.5+heightFraction)),
QPoint(self.width*0.5, self.height*(0.5+heightFraction/2.0)),
QPoint(self.width*(0.5-widthFraction/2.0),self.height*(0.5+heightFraction))
])
painter.drawPolygon(poly)
space = 0.25
length = 0.1
painter.drawLine(self.width*space, self.height/2, self.width*(space+length), self.height/2)
painter.drawLine(self.width*(1-space-length), self.height/2, self.width*(1-space), self.height/2)
def drawPitchIndicator(self, event, painter):
minHeight = 0.15 - self.pitch*self.pitchInterval
maxHeight = 0.85 - self.pitch*self.pitchInterval
for i in range(-9,9):
text = str(10*abs(i))
height = 0.5-self.pitchInterval*10*i
if height > minHeight and height < maxHeight:
painter.drawLine(
self.width*(0.4),self.height*(height),
self.width*(0.6),self.height*(height))
painter.drawText(QPoint(self.width*(0.6)+5,self.height*(height)+5),text)
painter.drawText(QPoint(self.width*(0.4)-22,self.height*(height)+5),text)
height = height - self.pitchInterval*5
if height > minHeight and height < maxHeight:
painter.drawLine(
self.width*(0.45),self.height*(height),
self.width*(0.55),self.height*(height))
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
ah = ArtificialHorizon()
sys.exit(app.exec_())

View File

@ -0,0 +1,489 @@
import numpy
from qt_gui_py_common.simple_settings_dialog import SimpleSettingsDialog
from python_qt_binding import QT_BINDING
from python_qt_binding.QtCore import Qt, qVersion, qWarning, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtWidgets import QWidget, QHBoxLayout
from rqt_py_common.ini_helper import pack, unpack
try:
from pyqtgraph_data_plot import PyQtGraphDataPlot
except ImportError as e:
PyQtGraphDataPlot = None
try:
from mat_data_plot import MatDataPlot
except ImportError as e:
MatDataPlot = None
try:
from qwt_data_plot import QwtDataPlot
except ImportError as e:
QwtDataPlot = None
# separate class for DataPlot exceptions, just so that users can differentiate
# errors from the DataPlot widget from exceptions generated by the underlying
# libraries
class DataPlotException(Exception):
pass
class DataPlot(QWidget):
"""A widget for displaying a plot of data
The DataPlot widget displays a plot, on one of several plotting backends,
depending on which backend(s) are available at runtime. It currently
supports PyQtGraph, MatPlot and QwtPlot backends.
The DataPlot widget manages the plot backend internally, and can save
and restore the internal state using `save_settings` and `restore_settings`
functions.
Currently, the user MUST call `restore_settings` before using the widget,
to cause the creation of the enclosed plotting widget.
"""
# plot types in order of priority
plot_types = [
{
'title': 'PyQtGraph',
'widget_class': PyQtGraphDataPlot,
'description': 'Based on PyQtGraph\n- installer: http://luke.campagnola.me/code/pyqtgraph\n',
'enabled': PyQtGraphDataPlot is not None,
},
{
'title': 'MatPlot',
'widget_class': MatDataPlot,
'description': 'Based on MatPlotLib\n- needs most CPU\n- needs matplotlib >= 1.1.0\n- if using PySide: PySide > 1.1.0\n',
'enabled': MatDataPlot is not None,
},
{
'title': 'QwtPlot',
'widget_class': QwtDataPlot,
'description': 'Based on QwtPlot\n- does not use timestamps\n- uses least CPU\n- needs Python Qwt bindings\n',
'enabled': QwtDataPlot is not None,
},
]
# pre-defined colors:
RED=(255, 0, 0)
GREEN=(0, 255, 0)
BLUE=(0, 0, 255)
SCALE_ALL=1
SCALE_VISIBLE=2
SCALE_EXTEND=4
_colors = [Qt.blue, Qt.red, Qt.cyan, Qt.magenta, Qt.green, Qt.darkYellow, Qt.black, Qt.darkCyan, Qt.darkRed, Qt.gray]
limits_changed = Signal()
_redraw = Signal()
_add_curve = Signal(str, str, 'QColor', bool)
def __init__(self, parent=None):
"""Create a new, empty DataPlot
This will raise a RuntimeError if none of the supported plotting
backends can be found
"""
super(DataPlot, self).__init__(parent)
self._plot_index = 0
self._color_index = 0
self._markers_on = False
self._autoscroll = True
self._autoscale_x = True
self._autoscale_y = DataPlot.SCALE_ALL
# the backend widget that we're trying to hide/abstract
self._data_plot_widget = None
self._curves = {}
self._vline = None
self._redraw.connect(self._do_redraw)
self._layout = QHBoxLayout()
self.setLayout(self._layout)
enabled_plot_types = [pt for pt in self.plot_types if pt['enabled']]
if not enabled_plot_types:
if qVersion().startswith('4.'):
version_info = '1.1.0'
else:
# minimum matplotlib version for Qt 5
version_info = '1.4.0'
if QT_BINDING == 'pyside':
version_info += ' and PySide %s' % \
('> 1.1.0' if qVersion().startswith('4.') else '>= 2.0.0')
raise RuntimeError('No usable plot type found. Install at least one of: PyQtGraph, MatPlotLib (at least %s) or Python-Qwt5.' % version_info)
self._switch_data_plot_widget(self._plot_index)
self.show()
def _switch_data_plot_widget(self, plot_index, markers_on=False):
"""Internal method for activating a plotting backend by index"""
# check if selected plot type is available
if not self.plot_types[plot_index]['enabled']:
# find other available plot type
for index, plot_type in enumerate(self.plot_types):
if plot_type['enabled']:
plot_index = index
break
self._plot_index = plot_index
self._markers_on = markers_on
selected_plot = self.plot_types[plot_index]
if self._data_plot_widget:
x_limits = self.get_xlim()
y_limits = self.get_ylim()
self._layout.removeWidget(self._data_plot_widget)
self._data_plot_widget.close()
self._data_plot_widget = None
else:
x_limits = [0.0, 10.0]
y_limits = [-0.001, 0.001]
self._data_plot_widget = selected_plot['widget_class'](self)
self._data_plot_widget.limits_changed.connect(self.limits_changed)
self._add_curve.connect(self._data_plot_widget.add_curve)
self._layout.addWidget(self._data_plot_widget)
# restore old data
for curve_id in self._curves:
curve = self._curves[curve_id]
self._data_plot_widget.add_curve(curve_id, curve['name'], curve['color'], markers_on)
if self._vline:
self.vline(*self._vline)
self.set_xlim(x_limits)
self.set_ylim(y_limits)
self.redraw()
def _switch_plot_markers(self, markers_on):
self._markers_on = markers_on
self._data_plot_widget._color_index = 0
for curve_id in self._curves:
self._data_plot_widget.remove_curve(curve_id)
curve = self._curves[curve_id]
self._data_plot_widget.add_curve(curve_id, curve['name'], curve['color'], markers_on)
self.redraw()
# interface out to the managing GUI component: get title, save, restore,
# etc
def getTitle(self):
"""get the title of the current plotting backend"""
return self.plot_types[self._plot_index]['title']
def save_settings(self, plugin_settings, instance_settings):
"""Save the settings associated with this widget
Currently, this is just the plot type, but may include more useful
data in the future"""
instance_settings.set_value('plot_type', self._plot_index)
xlim = self.get_xlim()
ylim = self.get_ylim()
# convert limits to normal arrays of floats; some backends return numpy
# arrays
xlim = [float(x) for x in xlim]
ylim = [float(y) for y in ylim]
instance_settings.set_value('x_limits', pack(xlim))
instance_settings.set_value('y_limits', pack(ylim))
def restore_settings(self, plugin_settings, instance_settings):
"""Restore the settings for this widget
Currently, this just restores the plot type."""
self._switch_data_plot_widget(int(instance_settings.value('plot_type', 0)))
xlim = unpack(instance_settings.value('x_limits', []))
ylim = unpack(instance_settings.value('y_limits', []))
if xlim:
# convert limits to an array of floats; they're often lists of
# strings
try:
xlim = [float(x) for x in xlim]
self.set_xlim(xlim)
except:
qWarning("Failed to restore X limits")
if ylim:
try:
ylim = [float(y) for y in ylim]
self.set_ylim(ylim)
except:
qWarning("Failed to restore Y limits")
def doSettingsDialog(self):
"""Present the user with a dialog for choosing the plot backend
This displays a SimpleSettingsDialog asking the user to choose a
plot type, gets the result, and updates the plot type as necessary
This method is blocking"""
marker_settings = [
{
'title': 'Show Plot Markers',
'description': 'Warning: Displaying markers in rqt_plot may cause\n \t high cpu load, especially using PyQtGraph\n',
'enabled': True,
}]
if self._markers_on:
selected_checkboxes = [0]
else:
selected_checkboxes = []
dialog = SimpleSettingsDialog(title='Plot Options')
dialog.add_exclusive_option_group(title='Plot Type', options=self.plot_types, selected_index=self._plot_index)
dialog.add_checkbox_group(title='Plot Markers', options=marker_settings, selected_indexes=selected_checkboxes)
[plot_type, checkboxes] = dialog.get_settings()
if plot_type is not None and plot_type['selected_index'] is not None and self._plot_index != plot_type['selected_index']:
self._switch_data_plot_widget(plot_type['selected_index'], 0 in checkboxes['selected_indexes'])
else:
if checkboxes is not None and self._markers_on != (0 in checkboxes['selected_indexes']):
self._switch_plot_markers(0 in checkboxes['selected_indexes'])
# interface out to the managing DATA component: load data, update data,
# etc
def autoscroll(self, enabled=True):
"""Enable or disable autoscrolling of the plot"""
self._autoscroll = enabled
def redraw(self):
self._redraw.emit()
def _do_redraw(self):
"""Redraw the underlying plot
This causes the underlying plot to be redrawn. This is usually used
after adding or updating the plot data"""
if self._data_plot_widget:
self._merged_autoscale()
for curve_id in self._curves:
curve = self._curves[curve_id]
self._data_plot_widget.set_values(curve_id, curve['x'], curve['y'])
self._data_plot_widget.redraw()
def _get_curve(self, curve_id):
if curve_id in self._curves:
return self._curves[curve_id]
else:
raise DataPlotException("No curve named %s in this DataPlot" %
( curve_id) )
def add_curve(self, curve_id, curve_name, data_x, data_y):
"""Add a new, named curve to this plot
Add a curve named `curve_name` to the plot, with initial data series
`data_x` and `data_y`.
Future references to this curve should use the provided `curve_id`
Note that the plot is not redraw automatically; call `redraw()` to make
any changes visible to the user.
"""
curve_color = QColor(self._colors[self._color_index % len(self._colors)])
self._color_index += 1
self._curves[curve_id] = { 'x': numpy.array(data_x),
'y': numpy.array(data_y),
'name': curve_name,
'color': curve_color}
if self._data_plot_widget:
self._add_curve.emit(curve_id, curve_name, curve_color, self._markers_on)
def remove_curve(self, curve_id):
"""Remove the specified curve from this plot"""
# TODO: do on UI thread with signals
if curve_id in self._curves:
del self._curves[curve_id]
if self._data_plot_widget:
self._data_plot_widget.remove_curve(curve_id)
def update_values(self, curve_id, values_x, values_y, sort_data=True):
"""Append new data to an existing curve
`values_x` and `values_y` will be appended to the existing data for
`curve_id`
Note that the plot is not redraw automatically; call `redraw()` to make
any changes visible to the user.
If `sort_data` is set to False, values won't be sorted by `values_x`
order.
"""
curve = self._get_curve(curve_id)
curve['x'] = numpy.append(curve['x'], values_x)
curve['y'] = numpy.append(curve['y'], values_y)
if sort_data:
# sort resulting data, so we can slice it later
sort_order = curve['x'].argsort()
curve['x'] = curve['x'][sort_order]
curve['y'] = curve['y'][sort_order]
def clear_values(self, curve_id=None):
"""Clear the values for the specified curve, or all curves
This will erase the data series associaed with `curve_id`, or all
curves if `curve_id` is not present or is None
Note that the plot is not redraw automatically; call `redraw()` to make
any changes visible to the user.
"""
# clear internal curve representation
if curve_id:
curve = self._get_curve(curve_id)
curve['x'] = numpy.array([])
curve['y'] = numpy.array([])
else:
for curve_id in self._curves:
self._curves[curve_id]['x'] = numpy.array([])
self._curves[curve_id]['y'] = numpy.array([])
def vline(self, x, color=RED):
"""Draw a vertical line on the plot
Draw a line a position X, with the given color
@param x: position of the vertical line to draw
@param color: optional parameter specifying the color, as tuple of
RGB values from 0 to 255
"""
self._vline = (x, color)
if self._data_plot_widget:
self._data_plot_widget.vline(x, color)
# autoscaling methods
def set_autoscale(self, x=None, y=None):
"""Change autoscaling of plot axes
if a parameter is not passed, the autoscaling setting for that axis is
not changed
@param x: enable or disable autoscaling for X
@param y: set autoscaling mode for Y
"""
if x is not None:
self._autoscale_x = x
if y is not None:
self._autoscale_y = y
# autoscaling: adjusting the plot bounds fit the data
# autoscrollig: move the plot X window to show the most recent data
#
# what order do we do these adjustments in?
# * assuming the various stages are enabled:
# * autoscale X to bring all data into view
# * else, autoscale X to determine which data we're looking at
# * autoscale Y to fit the data we're viewing
#
# * autoscaling of Y might have several modes:
# * scale Y to fit the entire dataset
# * scale Y to fit the current view
# * increase the Y scale to fit the current view
#
# TODO: incrmenetal autoscaling: only update the autoscaling bounds
# when new data is added
def _merged_autoscale(self):
x_limit = [numpy.inf, -numpy.inf]
if self._autoscale_x:
for curve_id in self._curves:
curve = self._curves[curve_id]
if len(curve['x']) > 0:
x_limit[0] = min(x_limit[0], curve['x'].min())
x_limit[1] = max(x_limit[1], curve['x'].max())
elif self._autoscroll:
# get current width of plot
x_limit = self.get_xlim()
x_width = x_limit[1] - x_limit[0]
# reset the upper x_limit so that we ignore the previous position
x_limit[1] = -numpy.inf
# get largest X value
for curve_id in self._curves:
curve = self._curves[curve_id]
if len(curve['x']) > 0:
x_limit[1] = max(x_limit[1], curve['x'].max())
# set lower limit based on width
x_limit[0] = x_limit[1] - x_width
else:
# don't modify limit, or get it from plot
x_limit = self.get_xlim()
# set sane limits if our limits are infinite
if numpy.isinf(x_limit[0]):
x_limit[0] = 0.0
if numpy.isinf(x_limit[1]):
x_limit[1] = 1.0
y_limit = [numpy.inf, -numpy.inf]
if self._autoscale_y:
# if we're extending the y limits, initialize them with the
# current limits
if self._autoscale_y & DataPlot.SCALE_EXTEND:
y_limit = self.get_ylim()
for curve_id in self._curves:
curve = self._curves[curve_id]
start_index = 0
end_index = len(curve['x'])
# if we're scaling based on the visible window, find the
# start and end indicies of our window
if self._autoscale_y & DataPlot.SCALE_VISIBLE:
# indexof x_limit[0] in curves['x']
start_index = curve['x'].searchsorted(x_limit[0])
# indexof x_limit[1] in curves['x']
end_index = curve['x'].searchsorted(x_limit[1])
# region here is cheap because it is a numpy view and not a
# copy of the underlying data
region = curve['y'][start_index:end_index]
if len(region) > 0:
y_limit[0] = min(y_limit[0], region.min())
y_limit[1] = max(y_limit[1], region.max())
# TODO: compute padding around new min and max values
# ONLY consider data for new values; not
# existing limits, or we'll add padding on top of old
# padding in SCALE_EXTEND mode
#
# pad the min/max
# TODO: invert this padding in get_ylim
#ymin = limits[0]
#ymax = limits[1]
#delta = ymax - ymin if ymax != ymin else 0.1
#ymin -= .05 * delta
#ymax += .05 * delta
else:
y_limit = self.get_ylim()
# set sane limits if our limits are infinite
if numpy.isinf(y_limit[0]):
y_limit[0] = 0.0
if numpy.isinf(y_limit[1]):
y_limit[1] = 1.0
self.set_xlim(x_limit)
self.set_ylim(y_limit)
def get_xlim(self):
"""get X limits"""
if self._data_plot_widget:
return self._data_plot_widget.get_xlim()
else:
qWarning("No plot widget; returning default X limits")
return [0.0, 1.0]
def set_xlim(self, limits):
"""set X limits"""
if self._data_plot_widget:
self._data_plot_widget.set_xlim(limits)
else:
qWarning("No plot widget; can't set X limits")
def get_ylim(self):
"""get Y limits"""
if self._data_plot_widget:
return self._data_plot_widget.get_ylim()
else:
qWarning("No plot widget; returning default Y limits")
return [0.0, 10.0]
def set_ylim(self, limits):
"""set Y limits"""
if self._data_plot_widget:
self._data_plot_widget.set_ylim(limits)
else:
qWarning("No plot widget; can't set Y limits")
# signal on y limit changed?

View File

@ -0,0 +1,149 @@
from python_qt_binding import QT_BINDING, QT_BINDING_VERSION
try:
from pkg_resources import parse_version
except:
import re
def parse_version(s):
return [int(x) for x in re.sub(r'(\.0+)*$', '', s).split('.')]
if QT_BINDING == 'pyside':
qt_binding_version = QT_BINDING_VERSION.replace('~', '-')
if parse_version(qt_binding_version) <= parse_version('1.1.2'):
raise ImportError('A PySide version newer than 1.1.0 is required.')
from python_qt_binding.QtCore import Slot, Qt, qVersion, qWarning, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtWidgets import QWidget, QVBoxLayout, QSizePolicy
import operator
import matplotlib
if qVersion().startswith('5.'):
if QT_BINDING == 'pyside':
if parse_version(matplotlib.__version__) < parse_version('2.1.0'):
raise ImportError('A newer matplotlib is required (at least 2.1.0 for PySide 2)')
if parse_version(matplotlib.__version__) < parse_version('1.4.0'):
raise ImportError('A newer matplotlib is required (at least 1.4.0 for Qt 5)')
try:
matplotlib.use('Qt5Agg')
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
except ImportError:
# work around bug in dateutil
import sys
import thread
sys.modules['_thread'] = thread
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
elif qVersion().startswith('4.'):
if parse_version(matplotlib.__version__) < parse_version('1.1.0'):
raise ImportError('A newer matplotlib is required (at least 1.1.0 for Qt 4)')
try:
matplotlib.use('Qt4Agg')
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
except ImportError:
# work around bug in dateutil
import sys
import thread
sys.modules['_thread'] = thread
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
try:
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
except ImportError:
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
else:
raise NotImplementedError('Unsupport Qt version: %s' % qVersion())
from matplotlib.figure import Figure
import numpy
class MatDataPlot(QWidget):
class Canvas(FigureCanvas):
"""Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
def __init__(self, parent=None):
super(MatDataPlot.Canvas, self).__init__(Figure())
self.axes = self.figure.add_subplot(111)
self.axes.grid(True, color='gray')
self.figure.tight_layout()
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.updateGeometry()
def resizeEvent(self, event):
super(MatDataPlot.Canvas, self).resizeEvent(event)
self.figure.tight_layout()
limits_changed = Signal()
def __init__(self, parent=None):
super(MatDataPlot, self).__init__(parent)
self._canvas = MatDataPlot.Canvas()
self._toolbar = NavigationToolbar(self._canvas, self._canvas)
vbox = QVBoxLayout()
vbox.addWidget(self._toolbar)
vbox.addWidget(self._canvas)
self.setLayout(vbox)
self._curves = {}
self._current_vline = None
self._canvas.mpl_connect('button_release_event', self._limits_changed)
def _limits_changed(self, event):
self.limits_changed.emit()
def add_curve(self, curve_id, curve_name, curve_color=QColor(Qt.blue), markers_on=False):
# adding an empty curve and change the limits, so save and restore them
x_limits = self.get_xlim()
y_limits = self.get_ylim()
if markers_on:
marker_size = 3
else:
marker_size = 0
line = self._canvas.axes.plot([], [], 'o-', markersize=marker_size, label=curve_name, linewidth=1, picker=5, color=curve_color.name())[0]
self._curves[curve_id] = line
self._update_legend()
self.set_xlim(x_limits)
self.set_ylim(y_limits)
def remove_curve(self, curve_id):
curve_id = str(curve_id)
if curve_id in self._curves:
self._curves[curve_id].remove()
del self._curves[curve_id]
self._update_legend()
def _update_legend(self):
handles, labels = self._canvas.axes.get_legend_handles_labels()
if handles:
hl = sorted(zip(handles, labels), key=operator.itemgetter(1))
handles, labels = zip(*hl)
self._canvas.axes.legend(handles, labels, loc='upper left')
def set_values(self, curve, data_x, data_y):
line = self._curves[curve]
line.set_data(data_x, data_y)
def redraw(self):
self._canvas.axes.grid(True, color='gray')
self._canvas.draw()
def vline(self, x, color):
# convert color range from (0,255) to (0,1.0)
matcolor=(color[0]/255.0, color[1]/255.0, color[2]/255.0)
if self._current_vline:
self._current_vline.remove()
self._current_vline = self._canvas.axes.axvline(x=x, color=matcolor)
def set_xlim(self, limits):
self._canvas.axes.set_xbound(lower=limits[0], upper=limits[1])
def set_ylim(self, limits):
self._canvas.axes.set_ybound(lower=limits[0], upper=limits[1])
def get_xlim(self):
return list(self._canvas.axes.get_xbound())
def get_ylim(self):
return list(self._canvas.axes.get_ybound())

View File

@ -0,0 +1,97 @@
from python_qt_binding.QtCore import Slot, Qt, qVersion, qWarning, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtWidgets import QVBoxLayout, QWidget
if qVersion().startswith('5.'):
try:
from pkg_resources import parse_version
except:
import re
def parse_version(s):
return [int(x) for x in re.sub(r'(\.0+)*$', '', s).split('.')]
from pyqtgraph import __version__ as pyqtgraph_version
if parse_version(pyqtgraph_version) < parse_version('0.10.0'):
raise ImportError('A newer PyQtGraph version is required (at least 0.10 for Qt 5)')
from pyqtgraph import PlotWidget, mkPen, mkBrush
import numpy
class PyQtGraphDataPlot(QWidget):
limits_changed = Signal()
def __init__(self, parent=None):
super(PyQtGraphDataPlot, self).__init__(parent)
self._plot_widget = PlotWidget()
self._plot_widget.getPlotItem().addLegend()
self._plot_widget.setBackground((255, 255, 255))
self._plot_widget.setXRange(0, 10, padding=0)
vbox = QVBoxLayout()
vbox.addWidget(self._plot_widget)
self.setLayout(vbox)
self._plot_widget.getPlotItem().sigRangeChanged.connect(self.limits_changed)
self._curves = {}
self._current_vline = None
def add_curve(self, curve_id, curve_name, curve_color=QColor(Qt.blue), markers_on=False):
#print 'activated.' # ---------------------------------------------
pen = mkPen(curve_color, width=1)
symbol = "o"
symbolPen = mkPen(QColor(Qt.black))
symbolBrush = mkBrush(curve_color)
# this adds the item to the plot and legend
if markers_on:
plot = self._plot_widget.plot(name=curve_name, pen=pen, symbol=symbol, symbolPen=symbolPen, symbolBrush=symbolBrush, symbolSize=4)
else:
plot = self._plot_widget.plot(name=curve_name, pen=pen)
self._curves[curve_id] = plot
#self._update_legend()# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#print self._curves # ----------------------------------------
def remove_curve(self, curve_id):
curve_id = str(curve_id)
if curve_id in self._curves:
self._plot_widget.removeItem(self._curves[curve_id])
del self._curves[curve_id]
self._update_legend()
def _update_legend(self):
# clear and rebuild legend (there is no remove item method for the legend...)
self._plot_widget.clear()
self._plot_widget.getPlotItem().legend.items = []
for curve in self._curves.values():
#print 'added curve'
self._plot_widget.addItem(curve)
if self._current_vline:
self._plot_widget.addItem(self._current_vline)
def redraw(self):
pass
def set_values(self, curve_id, data_x, data_y):
curve = self._curves[curve_id]
curve.setData(data_x, data_y)
def vline(self, x, color):
if self._current_vline:
self._plot_widget.removeItem(self._current_vline)
self._current_vline = self._plot_widget.addLine(x=x, pen=color)
def set_xlim(self, limits):
# TODO: this doesn't seem to handle fast updates well
self._plot_widget.setXRange(limits[0], limits[1], padding=0)
def set_ylim(self, limits):
self._plot_widget.setYRange(limits[0], limits[1], padding=0)
def get_xlim(self):
x_range, _ = self._plot_widget.viewRange()
return x_range
def get_ylim(self):
_, y_range = self._plot_widget.viewRange()
return y_range

View File

@ -0,0 +1,228 @@
# -*- coding: utf-8 -*-
from __future__ import division
import math
import sys
from python_qt_binding.QtCore import QEvent, QSize, QPointF, Qt, Signal, Slot, qWarning
from python_qt_binding.QtGui import QColor, QPen, QBrush, QVector2D
import Qwt
from numpy import arange, zeros, concatenate
# create real QwtDataPlot class
class QwtDataPlot(Qwt.QwtPlot):
mouseCoordinatesChanged = Signal(QPointF)
_num_value_saved = 1000
_num_values_ploted = 1000
limits_changed = Signal()
def __init__(self, *args):
super(QwtDataPlot, self).__init__(*args)
self.setCanvasBackground(Qt.white)
self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)
self._curves = {}
# TODO: rejigger these internal data structures so that they're easier
# to work with, and easier to use with set_xlim and set_ylim
# this may also entail rejiggering the _time_axis so that it's
# actually time axis data, or just isn't required any more
# new data structure
self._x_limits = [0.0, 10.0]
self._y_limits = [0.0, 10.0]
# old data structures
self._last_canvas_x = 0
self._last_canvas_y = 0
self._pressed_canvas_y = 0
self._pressed_canvas_x = 0
self._last_click_coordinates = None
marker_axis_y = Qwt.QwtPlotMarker()
marker_axis_y.setLabelAlignment(Qt.AlignRight | Qt.AlignTop)
marker_axis_y.setLineStyle(Qwt.QwtPlotMarker.HLine)
marker_axis_y.setYValue(0.0)
marker_axis_y.attach(self)
self._picker = Qwt.QwtPlotPicker(
Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PolygonSelection,
Qwt.QwtPlotPicker.PolygonRubberBand, Qwt.QwtPicker.AlwaysOn, self.canvas()
)
self._picker.setRubberBandPen(QPen(Qt.blue))
self._picker.setTrackerPen(QPen(Qt.blue))
# Initialize data
self.rescale()
#self.move_canvas(0, 0)
self.canvas().setMouseTracking(True)
self.canvas().installEventFilter(self)
def eventFilter(self, _, event):
if event.type() == QEvent.MouseButtonRelease:
x = self.invTransform(Qwt.QwtPlot.xBottom, event.pos().x())
y = self.invTransform(Qwt.QwtPlot.yLeft, event.pos().y())
self._last_click_coordinates = QPointF(x, y)
self.limits_changed.emit()
elif event.type() == QEvent.MouseMove:
x = self.invTransform(Qwt.QwtPlot.xBottom, event.pos().x())
y = self.invTransform(Qwt.QwtPlot.yLeft, event.pos().y())
coords = QPointF(x, y)
if self._picker.isActive() and self._last_click_coordinates is not None:
toolTip = 'origin x: %.5f, y: %.5f' % (self._last_click_coordinates.x(), self._last_click_coordinates.y())
delta = coords - self._last_click_coordinates
toolTip += '\ndelta x: %.5f, y: %.5f\nlength: %.5f' % (delta.x(), delta.y(), QVector2D(delta).length())
else:
toolTip = 'buttons\nleft: measure\nmiddle: move\nright: zoom x/y\nwheel: zoom y'
self.setToolTip(toolTip)
self.mouseCoordinatesChanged.emit(coords)
return False
def log(self, level, message):
# self.emit(SIGNAL('logMessage'), level, message)
pass
def resizeEvent(self, event):
Qwt.QwtPlot.resizeEvent(self, event)
self.rescale()
def add_curve(self, curve_id, curve_name, curve_color=QColor(Qt.blue), markers_on=False):
curve_id = str(curve_id)
if curve_id in self._curves:
return
curve_object = Qwt.QwtPlotCurve(curve_name)
curve_object.attach(self)
curve_object.setPen(curve_color)
if markers_on:
curve_object.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, QBrush(curve_color), QPen(Qt.black), QSize(4,4)))
self._curves[curve_id] = curve_object
def remove_curve(self, curve_id):
curve_id = str(curve_id)
if curve_id in self._curves:
self._curves[curve_id].hide()
self._curves[curve_id].attach(None)
del self._curves[curve_id]
def set_values(self, curve_id, data_x, data_y):
curve = self._curves[curve_id]
curve.setData(data_x, data_y)
def redraw(self):
self.replot()
# ----------------------------------------------
# begin qwtplot internal methods
# ----------------------------------------------
def rescale(self):
self.setAxisScale(Qwt.QwtPlot.yLeft,
self._y_limits[0],
self._y_limits[1])
self.setAxisScale(Qwt.QwtPlot.xBottom,
self._x_limits[0],
self._x_limits[1])
self._canvas_display_height = self._y_limits[1] - self._y_limits[0]
self._canvas_display_width = self._x_limits[1] - self._x_limits[0]
self.redraw()
def rescale_axis_x(self, delta__x):
"""
add delta_x to the length of the x axis
"""
x_width = self._x_limits[1] - self._x_limits[0]
x_width += delta__x
self._x_limits[1] = x_width + self._x_limits[0]
self.rescale()
def scale_axis_y(self, max_value):
"""
set the y axis height to max_value, about the current center
"""
canvas_display_height = max_value
canvas_offset_y = (self._y_limits[1] + self._y_limits[0])/2.0
y_lower_limit = canvas_offset_y - (canvas_display_height / 2)
y_upper_limit = canvas_offset_y + (canvas_display_height / 2)
self._y_limits = [y_lower_limit, y_upper_limit]
self.rescale()
def move_canvas(self, delta_x, delta_y):
"""
move the canvas by delta_x and delta_y in SCREEN COORDINATES
"""
canvas_offset_x = delta_x * self._canvas_display_width / self.canvas().width()
canvas_offset_y = delta_y * self._canvas_display_height / self.canvas().height()
self._x_limits = [ l + canvas_offset_x for l in self._x_limits]
self._y_limits = [ l + canvas_offset_y for l in self._y_limits]
self.rescale()
def mousePressEvent(self, event):
self._last_canvas_x = event.x() - self.canvas().x()
self._last_canvas_y = event.y() - self.canvas().y()
self._pressed_canvas_y = event.y() - self.canvas().y()
def mouseMoveEvent(self, event):
canvas_x = event.x() - self.canvas().x()
canvas_y = event.y() - self.canvas().y()
if event.buttons() & Qt.MiddleButton: # middle button moves the canvas
delta_x = self._last_canvas_x - canvas_x
delta_y = canvas_y - self._last_canvas_y
self.move_canvas(delta_x, delta_y)
elif event.buttons() & Qt.RightButton: # right button zooms
zoom_factor = max(-0.6, min(0.6, (self._last_canvas_y - canvas_y) / 20.0 / 2.0))
delta_y = (self.canvas().height() / 2.0) - self._pressed_canvas_y
self.move_canvas(0, zoom_factor * delta_y * 1.0225)
self.scale_axis_y(max(0.005, self._canvas_display_height - (zoom_factor * self._canvas_display_height)))
self.rescale_axis_x(self._last_canvas_x - canvas_x)
self._last_canvas_x = canvas_x
self._last_canvas_y = canvas_y
def wheelEvent(self, event): # mouse wheel zooms the y-axis
# y position of pointer in graph coordinates
canvas_y = event.y() - self.canvas().y()
try:
delta = event.angleDelta().y()
except AttributeError:
delta = event.delta()
zoom_factor = max(-0.6, min(0.6, (delta / 120) / 6.0))
delta_y = (self.canvas().height() / 2.0) - canvas_y
self.move_canvas(0, zoom_factor * delta_y * 1.0225)
self.scale_axis_y(max(0.0005, self._canvas_display_height - zoom_factor * self._canvas_display_height))
self.limits_changed.emit()
def vline(self, x, color):
qWarning("QwtDataPlot.vline is not implemented yet")
def set_xlim(self, limits):
self.setAxisScale(Qwt.QwtPlot.xBottom, limits[0], limits[1])
self._x_limits = limits
def set_ylim(self, limits):
self.setAxisScale(Qwt.QwtPlot.yLeft, limits[0], limits[1])
self._y_limits = limits
def get_xlim(self):
return self._x_limits
def get_ylim(self):
return self._y_limits
if __name__ == '__main__':
from python_qt_binding.QtGui import QApplication
app = QApplication(sys.argv)
plot = QwtDataPlot()
plot.resize(700, 500)
plot.show()
plot.add_curve(0, '(x/500)^2')
plot.add_curve(1, 'sin(x / 20) * 500')
for i in range(plot._num_value_saved):
plot.update_value(0, (i / 500.0) * (i / 5.0))
plot.update_value(1, math.sin(i / 20.0) * 500)
sys.exit(app.exec_())

View File

@ -0,0 +1,220 @@
from FETCH_MAPS import *
from collections import defaultdict
from PyQt5.QtCore import QRect, Qt
TILEWIDTH = 640 # Larget tile dimension you can grab without paying
TILEHEIGHT = 615 # Effective height to cut off Google logo
_EARTHPIX = 268435456 # Number of pixels in half the earth's circumference at zoom = 21
_pixrad = _EARTHPIX / math.pi
_MAPS_CACHE_PATH = os.path.expanduser('~/.local/share/mapscache')
class LatLon():
def __init__(self, lat = 0.0, lon = 0.0):
self.lat = lat
self.lon = lon
class MapZoomObj():
def __init__(self, mapname, zoom):
filename = os.path.join(_MAPS_CACHE_PATH, mapname, str(zoom), 'info.txt')
self.tiles = defaultdict(dict)
with open(filename, 'r') as info_file:
for line in info_file:
items = line.split(' ')
self.tiles[int(items[0])][int(items[1])] = LatLon(float(items[2]), float(items[3].strip()))
self.cols = len(self.tiles)
self.rows = len(self.tiles[0])
# calculate min and max latlon of MapZoomObj
min_latlon_center = self.tiles[0][self.rows-1]
max_latlon_center = self.tiles[self.cols-1][0]
min_lon = GoogleMapPlotter.pix_to_rel_lon(min_latlon_center.lon, int(-TILEWIDTH/2.0), zoom)
max_lon = GoogleMapPlotter.pix_to_rel_lon(max_latlon_center.lon, int(TILEWIDTH/2.0), zoom)
min_lat = GoogleMapPlotter.pix_to_rel_lat(min_latlon_center.lat, -int(TILEWIDTH/2.0 - TILEHEIGHT), zoom)
max_lat = GoogleMapPlotter.pix_to_rel_lat(max_latlon_center.lat, -int(TILEWIDTH/2.0), zoom)
self.min_latlon = LatLon(min_lat, min_lon)
self.max_latlon = LatLon(max_lat, max_lon)
class GoogleMapPlotter():
def __init__(self, mapdict, width, height, mapname, blankname):
# grab all info objects, all at once
self.mapname = mapname
self.blankname = blankname
self.mapdict = mapdict
self.mz_objs = defaultdict(dict)
for mapname in list(self.mapdict.keys()):
if not mapname == self.blankname:
for zoom in zooms:
self.mz_objs[mapname][zoom] = MapZoomObj(mapname, zoom)
# grab objects for rendering
self.width = width
self.height = height
self.center = LatLon(self.mapdict[self.mapname][0][0], self.mapdict[self.mapname][0][1])
self.zoom = self.mapdict[self.mapname][1]
if self.zoom > max(zooms):
self.zoom = max(zooms)
elif self.zoom < min(zooms):
self.zoom = min(zooms)
self.zoom_index = zooms.index(self.zoom)
self.mz_obj = self.mz_objs[self.mapname][self.zoom]
# kickoff fetching and updating
self.x_offset = 0.0
self.y_offset = 0.0
self.window_img = self.new_image(self.width, self.height)
self.fetch_and_update()
def GetImage(self):
return self.window_img
def UpdateSize(self, new_width, new_height):
self.width = new_width
self.height = new_height
self.window_img = self.new_image(self.width, self.height)
self.fetch_and_update()
def UpdateView(self, new_lat, new_lon):
self.center.lat = new_lat
self.center.lon = new_lon
self.fetch_and_update()
def UpdateZoom(self, zoom_increment):
self.zoom_index = self.sat(self.zoom_index + zoom_increment, 0, len(zooms) - 1)
self.zoom = zooms[self.zoom_index]
self.fetch_and_update()
def UpdateMap(self, mapname):
self.mapname = mapname
self.center.lat = self.mapdict[self.mapname][0][0]
self.center.lon = self.mapdict[self.mapname][0][1]
self.zoom = self.mapdict[self.mapname][1]
self.fetch_and_update()
def fetch_and_update(self):
self.compute_region()
if self.mapname == self.blankname:
self.blank_update()
else:
self.mz_obj = self.mz_objs[self.mapname][self.zoom]
self.fetch()
self.update()
@staticmethod
def pix_to_rel_lon(centerlon, pix, zoom): # positive pix = right
centerlonpix = _EARTHPIX + centerlon * math.radians(_pixrad)
return math.degrees((centerlonpix + pixels_to_degrees(pix, zoom) - _EARTHPIX) / _pixrad)
@staticmethod
def rel_lon_to_rel_pix(centerlon, delta_lon, zoom):
centerlonpix = _EARTHPIX + centerlon * math.radians(_pixrad)
zoom_factor = 2**(21-zoom)
return (math.pi/180.0*_pixrad*delta_lon + _EARTHPIX - centerlonpix)/zoom_factor
@staticmethod
def pix_to_rel_lat(centerlat, pix, zoom): # positive pix = down (!)
sinlat = math.sin(math.radians(centerlat))
centerlatpix = _EARTHPIX - _pixrad * math.log((1 + sinlat)/(1 - sinlat)) / 2.0
return math.degrees(math.pi/2 - 2 * math.atan(math.exp(((centerlatpix + pixels_to_degrees(pix, zoom)) - _EARTHPIX) / _pixrad)))
# you need a lat point (with a known y pix position) and the lat of the target point
@staticmethod
def rel_lat_to_rel_pix(centerlat, delta_lat, zoom):
sinlat = math.sin(math.radians(centerlat))
centerlatpix = _EARTHPIX - _pixrad * math.log((1 + sinlat)/(1 - sinlat)) / 2.0
A = math.log(math.tan(math.pi/4 - math.pi/360.0*delta_lat))
zoom_factor = 2**(21-zoom)
return (_pixrad*A + _EARTHPIX - centerlatpix)/zoom_factor
def fetch(self):
self.img = self.fetch_tiles()
def update(self):
painter = QPainter()
painter.begin(self.window_img)
painter.fillRect(QRect(0, 0, self.width, self.height), Qt.black)
painter.end()
self.paste(self.window_img, self.img, -self.x_offset, -self.y_offset)
def blank_update(self):
painter = QPainter()
painter.begin(self.window_img)
painter.fillRect(QRect(0, 0, self.width, self.height), Qt.lightGray)
painter.end()
def new_image(self, width, height):
# Format Value 4 corresponds to QImage.Format_RGB32
# see http://pyqt.sourceforge.net/Docs/PyQt4/qimage.html#QImage-3
# see http://pyqt.sourceforge.net/Docs/PyQt4/qimage.html#Format-enum
return QImage(width, height, 4)
def paste(self, big_image, small_image, upper_left_x, upper_left_y):
destPos = QPoint(upper_left_x, upper_left_y)
painter = QPainter(big_image)
painter.drawImage(destPos, small_image)
def grab_tile(self, i, j):
filename = os.path.join(_MAPS_CACHE_PATH, self.mapname, str(self.zoom), '%d_%d.jpg' % (i, j))
tile = None
if os.path.isfile(filename):
tile = QImage(QString(filename))
return tile
def localize_point(self, latlon, min_latlon, max_latlon):
# which column?
i = int((latlon.lon - min_latlon.lon) / (max_latlon.lon - min_latlon.lon) * self.mz_obj.cols)
i = self.sat(i, 0, self.mz_obj.cols - 1)
# which row? (calculated up-positive, but will be retrieved down-positive)
j = self.mz_obj.rows - 1 - int((latlon.lat - min_latlon.lat) / (max_latlon.lat - min_latlon.lat) * self.mz_obj.rows)
j = self.sat(j, 0, self.mz_obj.rows - 1)
return i, j
def sat(self, val, minval, maxval):
if val < minval:
return minval
elif val > maxval:
return maxval
else:
return val
def compute_region(self):
self.west = GoogleMapPlotter.pix_to_rel_lon(self.center.lon, -self.width/2, self.zoom)
self.east = GoogleMapPlotter.pix_to_rel_lon(self.center.lon, self.width/2, self.zoom)
self.north = GoogleMapPlotter.pix_to_rel_lat(self.center.lat, -self.height/2, self.zoom)
self.south = GoogleMapPlotter.pix_to_rel_lat(self.center.lat, self.height/2, self.zoom)
self.northeast = LatLon(self.north, self.east)
self.southwest = LatLon(self.south, self.west)
def fetch_tiles(self):
# find out which i, j values correspond to each corner
min_i, max_j = self.localize_point(self.southwest, self.mz_obj.min_latlon, self.mz_obj.max_latlon)
max_i, min_j = self.localize_point(self.northeast, self.mz_obj.min_latlon, self.mz_obj.max_latlon)
# fetch and paste images onto a big canvas
bigsize_x = (max_i - min_i + 1) * TILEWIDTH
bigsize_y = (max_j - min_j + 1) * TILEHEIGHT
bigimage = self.new_image(bigsize_x, bigsize_y)
for i in range(min_i, max_i + 1):
for j in range(min_j, max_j + 1):
tile = self.grab_tile(i, j)
self.paste(bigimage, tile, (i-min_i)*TILEWIDTH, (j-min_j)*TILEHEIGHT)
upper_left_center = self.mz_obj.tiles[min_i][min_j]
upper_left_lon = GoogleMapPlotter.pix_to_rel_lon(upper_left_center.lon, int(-TILEWIDTH/2), self.zoom)
upper_left_lat = GoogleMapPlotter.pix_to_rel_lat(upper_left_center.lat, int(-TILEWIDTH/2), self.zoom)
self.x_offset = GoogleMapPlotter.rel_lon_to_rel_pix(upper_left_lon, self.west, self.zoom)
self.y_offset = GoogleMapPlotter.rel_lat_to_rel_pix(upper_left_lat, self.north, self.zoom)
return bigimage

View File

@ -0,0 +1,59 @@
import argparse
from python_qt_binding import QT_BINDING
from python_qt_binding.QtCore import qDebug, QTimer
from python_qt_binding.QtWidgets import QWidget, QBoxLayout, QVBoxLayout, QHBoxLayout, QPushButton
# Custom Widgets
from .map_widget import MapWindow
from .plot_widget import PlotWidget
from .data_plot import DataPlot
from .artificial_horizon import ArtificialHorizon
class GroundStationWidget(QWidget):
def __init__(self):
super(GroundStationWidget, self).__init__()
self._principle_layout = QBoxLayout(0) # main layout is horizontal (0)
self._map_layout = QVBoxLayout()
self._principle_layout.addLayout(self._map_layout, 4)
self._control_layout = QVBoxLayout()
self._principle_layout.addLayout(self._control_layout, 3)
self.setAcceptDrops(False) # Dragging and Dropping not permitted
self.setWindowTitle('ROSplane Ground Station')
#=============================
self._mw = MapWindow()
self._map_layout.addWidget(self._mw)
self._tv = PlotWidget()
self._data_plot = DataPlot(self._tv)
self._data_plot.set_autoscale(x=False)
self._data_plot.set_autoscale(y=DataPlot.SCALE_EXTEND|DataPlot.SCALE_VISIBLE)
self._data_plot.set_xlim([0, 10.0])
self._tv.switch_data_plot_widget(self._data_plot)
self._control_layout.addWidget(self._tv, 1) # ratio of these numbers determines window proportions
self._ah = ArtificialHorizon()
self._control_layout.addWidget(self._ah, 1)
#=============================
print 'fake init'
self.setLayout(self._principle_layout)
# Global timer for marble_map and artificial_horizon
self.interval = 100 # in milliseconds, period of regular update
self.timer = QTimer(self)
self.timer.setInterval(self.interval)
self.timer.timeout.connect(self._mw._marble_map.update)
self.timer.timeout.connect(self._ah.update)
self.timer.start()
def closeEvent(self, event):
self.timer.stop()
def save_settings(self, plugin_settings, instance_settings): # have a file to read and write from
print 'fake save' # < prints to terminal
def restore_settings(self, plugin_settings, instance_settings):
print 'fake restore'

View File

@ -0,0 +1,24 @@
from .ground_station import GroundStationWidget
from qt_gui.plugin import Plugin
class GroundStationPlugin(Plugin):
def __init__(self, context):
super(GroundStationPlugin, self).__init__(context)
if context.serial_number() > 1:
raise RuntimeError("Due to a limitation of tf_frames you may not run more than one instance of ground_station.")
self._widget = GroundStationWidget()
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
context.add_widget(self._widget)
self.setObjectName('ros_groundstation')
def save_settings(self, plugin_settings, instance_settings):
self._widget.save_settings(plugin_settings, instance_settings)
def restore_settings(self, plugin_settings, instance_settings):
self._widget.restore_settings(plugin_settings, instance_settings)

View File

@ -0,0 +1,44 @@
import xml.etree.cElementTree as ET
import os, errno
PWD = os.path.dirname(os.path.abspath(__file__))
def pd(path):
return os.path.abspath(os.path.join(path, os.pardir))
KEY_FILE_PATH = os.path.join(pd(pd(PWD)), 'key.xml')
INFO_FILE_PATH = os.path.join(pd(pd(PWD)), 'map_info.xml')
def get_key():
xmlroot = ET.parse(KEY_FILE_PATH).getroot()
return xmlroot.text.strip()
def get_default():
xmlroot = ET.parse(INFO_FILE_PATH).getroot()
return xmlroot.attrib['default']
def get_gps_dict():
gps_dict = {}
xmlroot = ET.parse(INFO_FILE_PATH).getroot()
for xmlnode in xmlroot.findall('map'):
name = xmlnode.attrib['name']
lat = float(str(xmlnode.find('lat').text))
lon = float(str(xmlnode.find('lon').text))
zoom = int(str(xmlnode.find('zoom').text))
gps_dict[name] = [[lat, lon], zoom]
return gps_dict
def get_typed_waypoints(map_name, folder_name):
wp_file_path = os.path.join(PWD,'resources','wp_data',folder_name,'%s_%s.txt' % (map_name, folder_name))
return get_waypoints(wp_file_path)
def get_windspeed_components():
ws_file_path = os.path.join(PWD, 'resources', 'wp_data', 'drop_wps', '_WINDSPEED_.txt')
try:
with open(ws_file_path, 'r') as ws_file:
ws_t = ws_file.read().split()
Vwind_n = float(ws_t[0])
Vwind_e = float(ws_t[1])
return [Vwind_n, Vwind_e]
except:
return [0.0, 0.0]

View File

@ -0,0 +1,441 @@
import rospy
from std_msgs.msg import String
import json, re
from .Geo import Geobase
from math import fmod, pi
# custom messages
from rosflight_msgs.msg import GPS, RCRaw
from rosplane_msgs.msg import Current_Path, Waypoint, State, Controller_Internals, Controller_Commands
class InitSub(): # could end up being taken from rosplane_msgs.msg: State ++++
init_latlonalt = [0.0, 0.0, 0.0]
with_init = False
enabled = False
GB = None
gps_init_topic = None
gi_sub = None
@staticmethod
def updateInitLatLonAlt(new_init_latlonalt):
print 'taking latlonalt from marble'
InitSub.reset()
InitSub.with_init = False
InitSub.init_latlonalt = new_init_latlonalt
InitSub.GB = Geobase(InitSub.init_latlonalt[0], InitSub.init_latlonalt[1])
InitSub.enabled = True
@staticmethod
def state_callback(state):
InitSub.init_latlonalt[0] = state.initial_lat
InitSub.init_latlonalt[1] = state.initial_lon
InitSub.init_latlonalt[2] = state.initial_alt
InitSub.GB = Geobase(InitSub.init_latlonalt[0], InitSub.init_latlonalt[1])
InitSub.enabled = True # only perform the calculations if GPS init received
InitSub.gi_sub.unregister()
@staticmethod
def updateGPSInitTopic(new_topic):
print 'subscribing to', new_topic
InitSub.reset()
InitSub.with_init = True
InitSub.gps_init_topic = new_topic
InitSub.gi_sub = rospy.Subscriber(InitSub.gps_init_topic, State, InitSub.state_callback)
@staticmethod
def getGPSInitTopic():
return InitSub.gps_init_topic
@staticmethod
def closeSubscriber():
InitSub.reset()
@staticmethod
def reset():
InitSub.init_latlonalt = [0.0, 0.0, 0.0]
InitSub.enabled = False
InitSub.GB = None
if not InitSub.gi_sub is None:
InitSub.gi_sub.unregister()
InitSub.gi_sub = None
class StateSub():
state_sub = None
state_topic = None
lat = 0.0
lon = 0.0
alt = 0.0
Va = 0.0
phi = 0.0
theta = 0.0
psi = 0.0
chi = 0.0
enabled = False
@staticmethod
def updateStateTopic(new_state_topic):
print 'subscribing to', new_state_topic
StateSub.reset()
StateSub.state_topic = new_state_topic
if not StateSub.state_topic is None:
StateSub.state_sub = rospy.Subscriber(StateSub.state_topic, State, StateSub.state_callback)
@staticmethod
def getStateTopic():
return StateSub.state_topic
@staticmethod
def state_callback(state):
if InitSub.enabled:
n = state.position[0]
e = state.position[1]
d = state.position[2]
StateSub.lat, StateSub.lon, StateSub.alt = InitSub.GB.ned_to_gps(n, e, d)
#StateSub.alt -= InitSub.init_latlonalt[2]
StateSub.chi = fmod(state.chi, 2*pi)
StateSub.Va = state.Va
StateSub.phi = state.phi
StateSub.theta = state.theta
StateSub.psi = state.psi
StateSub.enabled = True
@staticmethod
def closeSubscriber():
print 'closing subscriber'
StateSub.reset()
@staticmethod
def reset():
StateSub.enabled = False
StateSub.lat = 0.0
StateSub.lon = 0.0
StateSub.alt = 0.0
StateSub.Va = 0.0
StateSub.phi = 0.0
StateSub.theta = 0.0
StateSub.psi = 0.0
StateSub.chi = 0.0
if not StateSub.state_sub is None:
StateSub.state_sub.unregister()
StateSub.state_sub = None
class RCSub():
rc_sub = None
rc_raw_topic = None
autopilotEnabled = True
channel = 5
@staticmethod
def updateRCRawTopic(new_rc_raw_topic):
print 'subscribing to', new_rc_raw_topic
RCSub.reset()
RCSub.rc_raw_topic = new_rc_raw_topic
if not RCSub.rc_raw_topic is None:
RCSub.rc_sub = rospy.Subscriber(RCSub.rc_raw_topic, RCRaw, RCSub.rc_callback)
@staticmethod
def getRCRawTopic():
return RCSub.rc_raw_topic
@staticmethod
def updateRCChannel(new_rc_channel):
print 'updating RC channel to', new_rc_channel
RCSub.channel = new_rc_channel
@staticmethod
def rc_callback(rcRaw):
RCSub.autopilotEnabled = (rcRaw.values[RCSub.channel-1] < 1700)
@staticmethod
def closeSubscriber():
print 'closing subscriber'
RCSub.reset()
@staticmethod
def reset():
RCSub.autopilotEnabled = True
if not RCSub.rc_sub is None:
RCSub.rc_sub.unregister()
RCSub.rc_sub = None
RCSub.channel = 5
class PathSub():
path_sub = None
path_topic = None
path_type = 0
r = [0.0, 0.0, 0.0]
q = [0.0, 0.0, 0.0]
c = [0.0, 0.0, 0.0]
rho = 0.0
enabled = False
@staticmethod
def updatePathTopic(new_path_topic):
print 'subscribing to', new_path_topic
PathSub.reset()
PathSub.path_topic = new_path_topic
if not PathSub.path_topic is None:
PathSub.path_sub = rospy.Subscriber(PathSub.path_topic, Current_Path, PathSub.path_callback)
@staticmethod
def getPathTopic():
return PathSub.path_topic
@staticmethod
def path_callback(path):
if InitSub.enabled:
PathSub.path_type = path.path_type
r_lat, r_lon, r_alt = InitSub.GB.ned_to_gps(path.r[0], path.r[1], path.r[2])
PathSub.r = [r_lat, r_lon, r_alt]
PathSub.q = [path.q[0], path.q[1], path.q[2]]
c_lat, c_lon, c_alt = InitSub.GB.ned_to_gps(path.c[0], path.c[1], path.c[2])
PathSub.c = [c_lat, c_lon, c_alt]
PathSub.rho = path.rho
PathSub.enabled = True
@staticmethod
def closeSubscriber():
print 'closing subscriber'
PathSub.reset()
@staticmethod
def reset():
PathSub.enabled = False
PathSub.path_type = 0
PathSub.r = [0.0, 0.0, 0.0]
PathSub.q = [0.0, 0.0, 0.0]
PathSub.c = [0.0, 0.0, 0.0]
PathSub.rho = 0.0
if not PathSub.path_sub is None:
PathSub.path_sub.unregister()
PathSub.path_sub = None
class renderable_wp():
def __init__(self, lat, lon, alt, chi_d, chi_valid, Va_d, converted=True):
self.lat = lat
self.lon = lon
self.alt = alt
self.chi_d = chi_d # radians
self.chi_valid = chi_valid
self.Va_d = Va_d
self.converted = converted
class WaypointSub():
wp_sub = None
waypoint_topic = None
waypoints = []
enabled = False
@staticmethod
def updateWaypointTopic(new_waypoint_topic):
print 'subscribing to', new_waypoint_topic
WaypointSub.reset()
WaypointSub.waypoint_topic = new_waypoint_topic
if not WaypointSub.waypoint_topic is None:
WaypointSub.wp_sub = rospy.Subscriber(WaypointSub.waypoint_topic, Waypoint, WaypointSub.waypoint_callback)
@staticmethod
def getWaypointTopic():
return WaypointSub.waypoint_topic
@staticmethod
def waypoint_callback(wp):
if InitSub.enabled:
lat, lon, alt = InitSub.GB.ned_to_gps(wp.w[0], wp.w[1], wp.w[2])
WaypointSub.waypoints.append(renderable_wp(lat, lon, alt, wp.chi_d, wp.chi_valid, wp.Va_d))
for rwp in WaypointSub.waypoints:
if not rwp.converted:
rwp.lat, rwp.lon, rwp.alt = InitSub.GB.ned_to_gps(rwp.lat, rwp.lon, rwp.alt)
rwp.converted = True
WaypointSub.enabled = True
else:
WaypointSub.waypoints.append(renderable_wp(wp.w[0], wp.w[1], wp.w[2], wp.chi_d, wp.chi_valid, wp.Va_d, False))
WaypointSub.enabled = False
@staticmethod
def closeSubscriber():
print 'closing subscriber'
WaypointSub.reset()
@staticmethod
def reset():
WaypointSub.enabled = False
WaypointSub.waypoints = []
if not WaypointSub.wp_sub is None:
WaypointSub.wp_sub.unregister()
WaypointSub.wp_sub = None
class ObstacleSub():
obs_sub = None
obstacle_topic = None
stationaryObstacles = []
movingObstacles = []
enabled = False
@staticmethod
def updateObstacleTopic(new_obstacle_topic):
print 'subscribing to', new_obstacle_topic
ObstacleSub.reset()
ObstacleSub.obstacle_topic = new_obstacle_topic
if not ObstacleSub.obstacle_topic is None:
ObstacleSub.obs_sub = rospy.Subscriber(ObstacleSub.obstacle_topic, String, ObstacleSub.json_callback)
@staticmethod
def getObstacleTopic():
return ObstacleSub.obstacle_topic
@staticmethod
def json_callback(obstacles_json):
json_data = str(obstacles_json.data)
json_data = re.sub(r"u'",r'"',json_data)
json_data = re.sub(r"'",r'"',json_data)
data = json.loads(json_data)
moving_obstacles = data["moving_obstacles"]
stationary_obstacles = data["stationary_obstacles"]
ObstacleSub.movingObstacles = []
for obstacle in moving_obstacles:
lat = float(obstacle["latitude"])
lon = float(obstacle["longitude"])
radius = float(obstacle["sphere_radius"])
height = float(obstacle["altitude_msl"])
ObstacleSub.movingObstacles.append((lat, lon, radius, height))
ObstacleSub.stationaryObstacles = []
for obstacle in stationary_obstacles:
lat = float(obstacle["latitude"])
lon = float(obstacle["longitude"])
radius = float(obstacle["cylinder_radius"])
height = float(obstacle["cylinder_height"])
ObstacleSub.stationaryObstacles.append((lat, lon, radius, height))
ObstacleSub.enabled = True
@staticmethod
def closeSubscriber():
print 'closing subscriber'
ObstacleSub.reset()
@staticmethod
def reset():
ObstacleSub.enabled = False
ObstacleSub.stationaryObstacles = []
ObstacleSub.movingObstacles = []
if not ObstacleSub.obs_sub is None:
ObstacleSub.obs_sub.unregister()
ObstacleSub.obs_sub = None
class GPSDataSub():
gps_sub = None
gps_data_topic = None
numSat = 0
enabled = False
@staticmethod
def updateGPSDataTopic(new_gps_data_topic):
print 'subscribing to', new_gps_data_topic
GPSDataSub.reset()
GPSDataSub.gps_data_topic = new_gps_data_topic
if not GPSDataSub.gps_data_topic is None:
GPSDataSub.gps_sub = rospy.Subscriber(GPSDataSub.gps_data_topic, GPS, GPSDataSub.callback_GPS)
@staticmethod
def getGPSDataTopic():
return GPSDataSub.gps_data_topic
@staticmethod
def callback_GPS(gps_data):
GPSDataSub.numSat = gps_data.NumSat
GPSDataSub.enabled = True
@staticmethod
def closeSubscriber():
print 'closing subscriber'
GPSDataSub.reset()
@staticmethod
def reset():
GPSDataSub.enabled = False
GPSDataSub.numSat = 0
if not GPSDataSub.gps_sub is None:
GPSDataSub.gps_sub.unregister()
GPSDataSub.gps_sub = None
class ConInSub():
con_in_sub = None
controller_inners_topic = None
theta_c = 0.0
phi_c = 0.0
enabled = False
@staticmethod
def updateConInTopic(new_controller_inners_topic):
print 'subscribing to', new_controller_inners_topic
ConInSub.reset()
ConInSub.controller_inners_topic = new_controller_inners_topic
if not ConInSub.controller_inners_topic is None:
ConInSub.con_in_sub = rospy.Subscriber(ConInSub.controller_inners_topic, Controller_Internals, ConInSub.callback_ConIn)
@staticmethod
def getConInTopic():
return ConInSub.controller_inners_topic
@staticmethod
def callback_ConIn(controller_internals):
ConInSub.theta_c = controller_internals.theta_c
ConInSub.phi_c = controller_internals.phi_c
ConInSub.enabled = True
@staticmethod
def closeSubscriber():
print 'closing subscriber'
ConInSub.reset()
@staticmethod
def reset():
ConInSub.enabled = False
ConInSub.theta_c = 0.0
ConInSub.phi_c = 0.0
if not ConInSub.con_in_sub is None:
ConInSub.con_in_sub.unregister()
ConInSub.con_in_sub = None
class ConComSub():
con_com_sub = None
controller_commands_topic = None
Va_c = 0.0
h_c = 0.0
chi_c = 0.0
enabled = False
@staticmethod
def updateConComTopic(new_controller_commands_topic):
print 'subscribing to', new_controller_commands_topic
ConComSub.reset()
ConComSub.controller_commands_topic = new_controller_commands_topic
if not ConComSub.controller_commands_topic is None:
ConComSub.con_com_sub = rospy.Subscriber(ConComSub.controller_commands_topic, Controller_Commands, ConComSub.callback_ConCom)
@staticmethod
def getConComTopic():
return ConComSub.controller_commands_topic
@staticmethod
def callback_ConCom(controller_commands):
ConComSub.Va_c = controller_commands.Va_c
ConComSub.h_c = controller_commands.h_c
ConComSub.chi_c = controller_commands.chi_c
ConComSub.enabled = True
@staticmethod
def closeSubscriber():
print 'closing subscriber'
ConComSub.reset()
@staticmethod
def reset():
ConComSub.enabled = False
ConComSub.Va_c = 0.0
ConComSub.h_c = 0.0
ConComSub.chi_c = 0.0
if not ConComSub.con_com_sub is None:
ConComSub.con_com_sub.unregister()
ConComSub.con_com_sub = None

View File

@ -0,0 +1,59 @@
from python_qt_binding import loadUi
from python_qt_binding.QtWidgets import QWidget
from .marble_map import MarbleMap
from .op_window import OpWindow
import map_info_parser
import os
from PyQt5.QtGui import *
from PyQt5.QtCore import *
PWD = os.path.dirname(os.path.abspath(__file__))
class MapWindow(QWidget):
def __init__(self, uifname = 'map_widget.ui'):
super(MapWindow, self).__init__()
button_icon_file = os.path.join(PWD, 'resources', 'airplane.png')
ui_file = os.path.join(PWD, 'resources', uifname)
loadUi(ui_file, self)
self.setObjectName(uifname)
self.gps_dict = map_info_parser.get_gps_dict()
self.blankname = '-- BLANK MAP --'
self.gps_dict[self.blankname] = [[0.0, 0.0], 18]
self._marble_map = MarbleMap(self.gps_dict, self.blankname)
self.verticalLayout.addWidget(self._marble_map)
self._home_opts.clear()
keylist = sorted(self.gps_dict, key=self.gps_dict.get)
self._home_opts.addItems(keylist)
self._home_opts.setCurrentIndex(keylist.index(map_info_parser.get_default()))
self._home_opts.currentIndexChanged[str].connect(self._update_home)
self._gridview_toggle.stateChanged[int].connect(self._marble_map.grid_viewer_toggle)
self.init_op_window()
self._recenter.clicked.connect(self._marble_map.recenter)
def init_op_window(self):
self.opWindow = OpWindow(self._marble_map)
self._map_options.clicked.connect(self.open_op_window)
def open_op_window(self):
self.opWindow.show()
def _update_home(self):
self._marble_map.change_home(self._home_opts.currentText())
def closeEvent(self, event): # ++++++++++++++
self.opWindow.close()
self.wpWindow.close()
self.cmWindow.close()
super(MapWindow, self).close()
def save_settings(self, plugin_settings, instance_settings):
pass
def restore_settings(self, plugin_settings, instance_settings):
pass

View File

@ -0,0 +1,264 @@
from .gm_plotter import GoogleMapPlotter
from python_qt_binding import loadUi
from python_qt_binding.QtWidgets import QWidget
from PyQt5.QtCore import *
from PyQt5.QtGui import *
QString = type("")
import os.path
from math import sin, cos, radians
import map_info_parser
from Signals import WP_Handler
from .Geo import Geobase
from .map_subscribers import *
class MarbleMap(QWidget):
def __init__(self, gps_dict, blankname, parent=None):
super(MarbleMap, self).__init__() # QWidget constructor
self.WPH = WP_Handler()
self._gps_dict = gps_dict
self.blankname = blankname
self.get_size()
self.GMP = None
self.change_home(map_info_parser.get_default())
self.GB = Geobase(self.latlon[0], self.latlon[1]) # For full current path drawer
self._mouse_attentive = False
self.movement_offset = QPoint(0,0)
self.mouse_event_counter = 0
self.counter_limit = 4
self.lon_multiplier = -0.25
self.lat_multiplier = -0.25
self.wheel_angle = 0
self.wheel_angle_thresh = 1*120
# geometric items for drawing
self.plane_h = 30 # pixels
self.plane_w = 25 # pixels
self.draw_gridlines = False
self.grid_dist = 20 # meters
def change_home(self, map_name):
self._home_map = map_name
self.latlon = self._gps_dict[self._home_map][0]
self.latlonalt = [self.latlon[0], self.latlon[1], 0.0] # FOR INTERFACING WITH SUBSCRIBERS
if not InitSub.with_init:
InitSub.updateInitLatLonAlt(self.latlonalt)
self.zoom = self._gps_dict[self._home_map][1]
self.GB = Geobase(self.latlon[0], self.latlon[1])
if self.GMP is None:
self.GMP = GoogleMapPlotter(self._gps_dict, self.w_width, self.w_height, self._home_map, self.blankname)
else:
self.GMP.UpdateMap(map_name)
self.update()
self.WPH.emit_home_change(self._home_map)
def get_size(self):
frame_size = self.frameSize()
self.w_width = frame_size.width()
self.w_height = frame_size.height()
def resizeEvent(self, QResizeEvent):
self.get_size()
self.GMP.UpdateSize(self.w_width, self.w_height)
def wheelEvent(self, QWheelEvent):
self.wheel_angle += QWheelEvent.angleDelta().y()
if self.wheel_angle >= self.wheel_angle_thresh:
self.GMP.UpdateZoom(1)
self.wheel_angle = 0
if self.wheel_angle <= -self.wheel_angle_thresh:
self.GMP.UpdateZoom(-1)
self.wheel_angle = 0
def mouseMoveEvent(self, QMouseEvent):
if not self._mouse_attentive: # we won't do anything with movement in point-and-click mode
if QMouseEvent.buttons(): # in act of dragging
self.mouse_event_counter += 1
if self.mouse_event_counter > self.counter_limit:
qpoint_delta = QMouseEvent.pos() - self.movement_offset
delta_x = self.lon_multiplier * qpoint_delta.x()
lon_incremented = GoogleMapPlotter.pix_to_rel_lon(self.GMP.center.lon, delta_x, self.GMP.zoom)
delta_y = self.lat_multiplier * qpoint_delta.y()
lat_incremented = GoogleMapPlotter.pix_to_rel_lat(self.GMP.center.lat, delta_y, self.GMP.zoom)
self.GMP.UpdateView(lat_incremented, lon_incremented)
self.mouse_event_counter = 0
def recenter(self):
self.GMP.UpdateView(self.latlon[0], self.latlon[1])
def enterEvent(self, QEvent):
if self._mouse_attentive:
self.setCursor(QCursor(Qt.CrossCursor))
else:
self.setCursor(QCursor(Qt.OpenHandCursor))
def leaveEvent(self, QEvent):
self.setCursor(QCursor(Qt.ArrowCursor))
def mousePressEvent(self, QMouseEvent):
if self._mouse_attentive:
print 'OUCH'
#self.WPH.emit_clicked(clicked_lat, clicked_lon)
else:
self.movement_offset = QMouseEvent.pos()
self.setCursor(QCursor(Qt.ClosedHandCursor))
def mouseReleaseEvent(self, QMouseEvent):
if not self._mouse_attentive:
self.setCursor(QCursor(Qt.OpenHandCursor))
def grid_viewer_toggle(self, state_integer):
if state_integer == 2:
self.draw_gridlines = True
else:
self.draw_gridlines = False
# =====================================================
# ==================== FOR DRAWING ====================
# =====================================================
def paintEvent(self, QPaintEvent):
painter = QPainter()
painter.begin(self)
painter.setRenderHint(QPainter.Antialiasing, True)
upper_left = QPoint(0, 0)
painter.drawImage(upper_left, self.GMP.GetImage())
if self.draw_gridlines:
self.draw_grid(painter)
# Draw center crosshairs (probably temporary until smartzoom feature is implemented)
painter.setPen(QPen(QBrush(Qt.blue), 2, Qt.SolidLine, Qt.RoundCap))
painter.drawLine(self.GMP.width/2, self.GMP.height/2-8, self.GMP.width/2, self.GMP.height/2+8)
painter.drawLine(self.GMP.width/2-8, self.GMP.height/2, self.GMP.width/2+8, self.GMP.height/2)
if WaypointSub.enabled:
self.draw_waypoints(painter)
if ObstacleSub.enabled:
self.draw_obstacles(painter)
if PathSub.enabled:
self.draw_currentpath(painter)
if StateSub.enabled:
self.draw_plane(painter)
painter.end()
# draws gridlines at 10-meter increments
def draw_grid(self, painter): # ++++++++++++++++++++++++++++++++++++
painter.fillRect(QRect(0, self.GMP.height - 20, self.GMP.width, self.GMP.height), Qt.white)
painter.fillRect(QRect(0, 0, 50, self.GMP.height - 20), Qt.white)
painter.setPen(QPen(QBrush(Qt.black), 1.5, Qt.SolidLine, Qt.RoundCap))
pixels_per_dist = self.grid_dist * 2**self.GMP.zoom / (156543.03392 * cos(radians(InitSub.init_latlonalt[0])))
x_min, x_offset = divmod(GoogleMapPlotter.rel_lon_to_rel_pix(InitSub.init_latlonalt[1], self.GMP.west, self.GMP.zoom), pixels_per_dist)
x_offset = pixels_per_dist - x_offset
x_min = int(x_min)
x_max = x_min + int(self.GMP.width / pixels_per_dist) + 1
x_min += 1
y_min, y_offset = divmod(GoogleMapPlotter.rel_lat_to_rel_pix(self.GMP.south, InitSub.init_latlonalt[0], self.GMP.zoom), pixels_per_dist)
y_offset = pixels_per_dist - y_offset
y_min = int(y_min)
y_max = y_min + int(self.GMP.height / pixels_per_dist) + 1
y_min += 1
#print y_min, y_max
for i, x_line in enumerate(range(x_min, x_max + 1)):
x_coord = x_offset + i * pixels_per_dist
painter.drawLine(x_coord, 0, x_coord, self.GMP.height)
if self.GMP.zoom > 17:
text_point = QPoint(x_coord + 2, self.GMP.height - 5)
painter.drawText(text_point, QString('%d m' % (x_line * self.grid_dist)))
for i, y_line in enumerate(range(y_min, y_max + 1)):
y_coord = self.GMP.height - (y_offset + i * pixels_per_dist)
painter.drawLine(0, y_coord, self.GMP.width, y_coord)
if self.GMP.zoom > 17:
text_point = QPoint(5, y_coord - 7)
painter.drawText(text_point, QString('%d m' % (y_line * self.grid_dist)))
def draw_waypoints(self, painter):
painter.setPen(QPen(QBrush(Qt.darkRed), 2.5, Qt.SolidLine, Qt.RoundCap))
# it can be assumed that all waypoints are converted to latlon if the sub is enabled
for waypoint in WaypointSub.waypoints:
x = self.lon_to_pix(waypoint.lon)
y = self.lat_to_pix(waypoint.lat)
if x >=0 and x <= self.GMP.width and y >= 0 and y <= self.GMP.height:
rad = 5
painter.drawEllipse(x-rad, y-rad, 2*rad, 2*rad)
if waypoint.chi_valid:
painter.drawLine(x, y, x+2*rad*sin(waypoint.chi_d), y-2*rad*cos(waypoint.chi_d))
def draw_obstacles(self, painter):
pass # ++++++++++++++++++++++++++++++++++++++++++
def draw_currentpath(self, painter):
painter.setPen(QPen(QBrush(Qt.red), 3.5, Qt.SolidLine, Qt.RoundCap))
if PathSub.path_type == 1: # line path
r = PathSub.r # [lat, lon]
q = PathSub.q # unit length, NED
scale = 200 # pixels
pt_1 = [self.lon_to_pix(r[1]), self.lat_to_pix(r[0])]
if pt_1[0] >=0 and pt_1[0] <= self.GMP.width and pt_1[1] >= 0 and pt_1[1] <= self.GMP.height:
pt_2 = [pt_1[0]+scale*q[1],pt_1[1]-scale*q[0]]
painter.drawLine(pt_1[0], pt_1[1], pt_2[0], pt_2[1])
else:
c = PathSub.c # [lat, lon]
R = PathSub.rho # meters
pt_c = [self.lon_to_pix(c[1]), self.lat_to_pix(c[0])]
if pt_c[0] >=0 and pt_c[0] <= self.GMP.width and pt_c[1] >= 0 and pt_c[1] <= self.GMP.height:
R_pix = R * 2**self.GMP.zoom / (156543.03392 * cos(radians(c[0])))
painter.drawEllipse(pt_c[0]-R_pix, pt_c[1]-R_pix, 2*R_pix, 2*R_pix)
def draw_plane(self, painter):
if RCSub.autopilotEnabled:
painter.setPen(QPen(QBrush(Qt.red), 5, Qt.SolidLine, Qt.RoundCap))
else:
painter.setPen(QPen(QBrush(Qt.cyan), 5, Qt.SolidLine, Qt.RoundCap))
x = self.lon_to_pix(StateSub.lon)
y = self.lat_to_pix(StateSub.lat)
if x >=0 and x <= self.GMP.width and y >= 0 and y <= self.GMP.height:
#print 'plane at', x, y
chi = StateSub.chi
pt_1_x = x + self.rotate_x(0, self.plane_h/2, chi)
pt_1_y = y - self.rotate_y(0, self.plane_h/2, chi)
pt_2_x = x + self.rotate_x(0, -self.plane_h/2, chi)
pt_2_y = y - self.rotate_y(0, -self.plane_h/2, chi)
pt_3_x = x
pt_3_y = y
pt_4_x = x + self.rotate_x(-self.plane_w/2, -self.plane_h/4, chi)
pt_4_y = y - self.rotate_y(-self.plane_w/2, -self.plane_h/4, chi)
pt_5_x = x + self.rotate_x(self.plane_w/2, -self.plane_h/4, chi)
pt_5_y = y - self.rotate_y(self.plane_w/2, -self.plane_h/4, chi)
pt_6_x = x + self.rotate_x(-self.plane_w/4, -2*self.plane_h/5, chi)
pt_6_y = y - self.rotate_y(-self.plane_w/4, -2*self.plane_h/5, chi)
pt_7_x = x + self.rotate_x(self.plane_w/4, -2*self.plane_h/5, chi)
pt_7_y = y - self.rotate_y(self.plane_w/4, -2*self.plane_h/5, chi)
painter.drawLine(pt_1_x, pt_1_y, pt_2_x, pt_2_y)
painter.drawLine(pt_3_x, pt_3_y, pt_4_x, pt_4_y)
painter.drawLine(pt_3_x, pt_3_y, pt_5_x, pt_5_y)
painter.drawLine(pt_6_x, pt_6_y, pt_7_x, pt_7_y)
painter.setPen(QPen(QBrush(Qt.black), 2.5, Qt.SolidLine, Qt.RoundCap))
painter.drawLine(pt_1_x, pt_1_y, pt_2_x, pt_2_y)
painter.drawLine(pt_3_x, pt_3_y, pt_4_x, pt_4_y)
painter.drawLine(pt_3_x, pt_3_y, pt_5_x, pt_5_y)
painter.drawLine(pt_6_x, pt_6_y, pt_7_x, pt_7_y)
def lon_to_pix(self, lon): # assuming origin at upper left
return GoogleMapPlotter.rel_lon_to_rel_pix(self.GMP.west, lon, self.GMP.zoom)
def lat_to_pix(self, lat): # assuming origin at upper left
return GoogleMapPlotter.rel_lat_to_rel_pix(self.GMP.north, lat, self.GMP.zoom)
def rotate_x(self, x, y, a):
return x * cos(a) + y * sin(a)
def rotate_y(self, x, y, a):
return -1 * x * sin(a) + y * cos(a)

View File

@ -0,0 +1,263 @@
from python_qt_binding import loadUi
from PyQt5.Qt import *
from PyQt5.QtGui import *
QString = type("")
import os, rospy
from .map_subscribers import *
PWD = os.path.dirname(os.path.abspath(__file__))
class OpWindow(QWidget):
def __init__(self, marble, uifname = 'op_window.ui'):
super(OpWindow, self).__init__()
self.marble = marble
ui_file = os.path.join(PWD, 'resources', uifname)
loadUi(ui_file, self)
self.setObjectName(uifname)
# Parse NED_with_GPS_defaults ==================================================
self.NEDwGPS_tab = QWidget()
self.tab_widget.addTab(self.NEDwGPS_tab, QString('Principle Subscibers and Publishers'))
description = 'All ROS information is exchanged with the plane in NED format, and the plane\n' + \
'may provide an initial GPS position for accurate latlong rendering.'
layout = QVBoxLayout()
layout.addWidget(QLabel(QString(description)))
label = 'GPS init Subscriber'
checked = rospy.get_param('gpsInitSubChecked', True)
topic = rospy.get_param('gpsInitSubTopic', '/state')
pubsub_layout = QBoxLayout(0) # for combining the checkbox and text field
self.NEDwGPS_gisub_checkbox = QCheckBox(QString(label))
self.NEDwGPS_gisub_checkbox.setChecked(checked)
self.NEDwGPS_gisub_checkbox.stateChanged[int].connect(self.handle_gisub_checkbox)
pubsub_layout.addWidget(self.NEDwGPS_gisub_checkbox)
self.NEDwGPS_gisub_textedit = QTextEdit(QString(topic))
self.handle_gisub_checkbox(checked)
pubsub_layout.addWidget(self.NEDwGPS_gisub_textedit)
layout.addLayout(pubsub_layout)
label = 'State Subscriber'
checked = rospy.get_param('stateSubChecked', True)
topic = rospy.get_param('stateSubTopic', '/state')
pubsub_layout = QBoxLayout(0) # for combining the checkbox and text field
self.NEDwGPS_statesub_checkbox = QCheckBox(QString(label))
self.NEDwGPS_statesub_checkbox.setChecked(checked)
self.NEDwGPS_statesub_checkbox.stateChanged[int].connect(self.handle_statesub_checkbox)
pubsub_layout.addWidget(self.NEDwGPS_statesub_checkbox)
self.NEDwGPS_statesub_textedit = QTextEdit(QString(topic))
self.handle_statesub_checkbox(checked)
pubsub_layout.addWidget(self.NEDwGPS_statesub_textedit)
layout.addLayout(pubsub_layout)
label = 'Path Subscriber'
checked = rospy.get_param('pathSubChecked', True)
topic = rospy.get_param('pathSubTopic', '/current_path')
pubsub_layout = QBoxLayout(0) # for combining the checkbox and text field
self.NEDwGPS_pathsub_checkbox = QCheckBox(QString(label))
self.NEDwGPS_pathsub_checkbox.setChecked(checked)
self.NEDwGPS_pathsub_checkbox.stateChanged[int].connect(self.handle_pathsub_checkbox)
pubsub_layout.addWidget(self.NEDwGPS_pathsub_checkbox)
self.NEDwGPS_pathsub_textedit = QTextEdit(QString(topic))
self.handle_pathsub_checkbox(checked)
pubsub_layout.addWidget(self.NEDwGPS_pathsub_textedit)
layout.addLayout(pubsub_layout)
label = 'Waypoint Subscriber'
checked = rospy.get_param('waypointSubChecked', True)
topic = rospy.get_param('waypointSubTopic', '/waypoint_path')
pubsub_layout = QBoxLayout(0) # for combining the checkbox and text field
self.NEDwGPS_wpsub_checkbox = QCheckBox(QString(label))
self.NEDwGPS_wpsub_checkbox.setChecked(checked)
self.NEDwGPS_wpsub_checkbox.stateChanged[int].connect(self.handle_wpsub_checkbox)
pubsub_layout.addWidget(self.NEDwGPS_wpsub_checkbox)
self.NEDwGPS_wpsub_textedit = QTextEdit(QString(topic))
self.handle_wpsub_checkbox(checked)
pubsub_layout.addWidget(self.NEDwGPS_wpsub_textedit)
layout.addLayout(pubsub_layout)
label = 'Waypoint Publisher'
checked = rospy.get_param('waypointPubChecked', False)
topic = rospy.get_param('waypointPubTopic', '/waypoint_path')
pubsub_layout = QBoxLayout(0) # for combining the checkbox and text field
self.NEDwGPS_wppub_checkbox = QCheckBox(QString(label))
self.NEDwGPS_wppub_checkbox.setChecked(checked)
self.NEDwGPS_wppub_checkbox.stateChanged[int].connect(self.handle_wppub_checkbox)
pubsub_layout.addWidget(self.NEDwGPS_wppub_checkbox)
self.NEDwGPS_wppub_textedit = QTextEdit(QString(topic))
self.handle_wppub_checkbox(checked)
pubsub_layout.addWidget(self.NEDwGPS_wppub_textedit)
layout.addLayout(pubsub_layout)
self.NEDwGPS_tab.setLayout(layout)
# Parse misc_defaults ====================================================================
self.MD_tab = QWidget()
self.tab_widget.addTab(self.MD_tab, QString('Miscellaneous'))
layout = QVBoxLayout()
label = 'RC Raw Subscriber'
checked = rospy.get_param('rcRawSubChecked', True)
topic = rospy.get_param('rcRawSubTopic', '/rc_raw')
pubsub_layout = QBoxLayout(0)
self.MD_rcsub_checkbox = QCheckBox(QString(label))
self.MD_rcsub_checkbox.setChecked(checked)
self.MD_rcsub_checkbox.stateChanged[int].connect(self.handle_rcsub_checkbox)
pubsub_layout.addWidget(self.MD_rcsub_checkbox)
self.MD_rcsub_textedit = QTextEdit(QString(topic))
self.handle_rcsub_checkbox(checked)
pubsub_layout.addWidget(self.MD_rcsub_textedit)
channel_layout = QVBoxLayout()
channel_layout.addWidget(QLabel(QString("Autopilot Toggle Channel:")))
self.MD_rcsub_channel = QComboBox()
self.MD_rcsub_channel.clear()
channel_list = ['5', '6', '7', '8']
channel = rospy.get_param('rcRawChannel', '6')
self.MD_rcsub_channel.addItems(channel_list)
try:
index = channel_list.index(str(channel))
except:
index = 0
self.MD_rcsub_channel.setCurrentIndex(index)
self.MD_rcsub_channel.currentIndexChanged[str].connect(self.update_rc_channel)
channel_layout.addWidget(self.MD_rcsub_channel)
pubsub_layout.addLayout(channel_layout)
layout.addLayout(pubsub_layout)
label = 'GPS Data Subscriber'
checked = rospy.get_param('gpsDataSubChecked', True)
topic = rospy.get_param('gpsDataSubTopic', '/gps/data')
pubsub_layout = QBoxLayout(0)
self.MD_gpssub_checkbox = QCheckBox(QString(label))
self.MD_gpssub_checkbox.setChecked(checked)
self.MD_gpssub_checkbox.stateChanged[int].connect(self.handle_gpssub_checkbox)
pubsub_layout.addWidget(self.MD_gpssub_checkbox)
self.MD_gpssub_textedit = QTextEdit(QString(topic))
self.handle_gpssub_checkbox(checked)
pubsub_layout.addWidget(self.MD_gpssub_textedit)
layout.addLayout(pubsub_layout)
label = 'Controller Internals Subscriber'
checked = rospy.get_param('controllerInternalsSubChecked', True)
topic = rospy.get_param('controllerInternalsSubTopic', '/controller_inners')
pubsub_layout = QBoxLayout(0)
self.MD_cisub_checkbox = QCheckBox(QString(label))
self.MD_cisub_checkbox.setChecked(checked)
self.MD_cisub_checkbox.stateChanged[int].connect(self.handle_cisub_checkbox)
pubsub_layout.addWidget(self.MD_cisub_checkbox)
self.MD_cisub_textedit = QTextEdit(QString(topic))
self.handle_cisub_checkbox(checked)
pubsub_layout.addWidget(self.MD_cisub_textedit)
layout.addLayout(pubsub_layout)
label = 'Controller Commands Subscriber'
checked = rospy.get_param('controllerCommandsSubChecked', True)
topic = rospy.get_param('controllerCommandsSubTopic', '/controller_commands')
pubsub_layout = QBoxLayout(0)
self.MD_ccsub_checkbox = QCheckBox(QString(label))
self.MD_ccsub_checkbox.setChecked(checked)
self.MD_ccsub_checkbox.stateChanged[int].connect(self.handle_ccsub_checkbox)
pubsub_layout.addWidget(self.MD_ccsub_checkbox)
self.MD_ccsub_textedit = QTextEdit(QString(topic))
self.handle_ccsub_checkbox(checked)
pubsub_layout.addWidget(self.MD_ccsub_textedit)
layout.addLayout(pubsub_layout)
label = 'Obstacle Subscriber'
checked = rospy.get_param('obstacleSubChecked', False)
topic = rospy.get_param('obstacleSubTopic', '/obstacles')
pubsub_layout = QBoxLayout(0)
self.MD_obssub_checkbox = QCheckBox(QString(label))
self.MD_obssub_checkbox.setChecked(checked)
self.MD_obssub_checkbox.stateChanged[int].connect(self.handle_obssub_checkbox)
pubsub_layout.addWidget(self.MD_obssub_checkbox)
self.MD_obssub_textedit = QTextEdit(QString(topic))
self.handle_obssub_checkbox(checked)
pubsub_layout.addWidget(self.MD_obssub_textedit)
layout.addLayout(pubsub_layout)
self.MD_tab.setLayout(layout)
def handle_statesub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.NEDwGPS_statesub_textedit.toPlainText())
if checked:
StateSub.updateStateTopic(topic_name)
else:
StateSub.closeSubscriber()
def handle_gisub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.NEDwGPS_gisub_textedit.toPlainText())
if checked:
InitSub.updateGPSInitTopic(topic_name)
else:
InitSub.updateInitLatLonAlt(self.marble.latlonalt)
def handle_pathsub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.NEDwGPS_pathsub_textedit.toPlainText())
if checked:
PathSub.updatePathTopic(topic_name)
else:
PathSub.closeSubscriber()
def handle_wpsub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.NEDwGPS_wpsub_textedit.toPlainText())
if checked:
WaypointSub.updateWaypointTopic(topic_name)
else:
WaypointSub.closeSubscriber()
def handle_wppub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.NEDwGPS_wppub_textedit.toPlainText())
if checked:
print 'functionality pending'
else:
print 'functionality pending'
def handle_gpssub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.MD_gpssub_textedit.toPlainText())
if checked:
GPSDataSub.updateGPSDataTopic(topic_name)
else:
GPSDataSub.closeSubscriber()
def handle_obssub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.MD_obssub_textedit.toPlainText())
if checked:
ObstacleSub.updateObstacleTopic(topic_name)
else:
ObstacleSub.closeSubscriber()
def handle_rcsub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.MD_rcsub_textedit.toPlainText())
if checked:
RCSub.updateRCRawTopic(topic_name)
else:
RCSub.closeSubscriber()
def handle_cisub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.MD_cisub_textedit.toPlainText())
if checked:
ConInSub.updateConInTopic(topic_name)
else:
ConInSub.closeSubscriber()
def handle_ccsub_checkbox(self, state_integer):
checked = state_integer
topic_name = str(self.MD_ccsub_textedit.toPlainText())
if checked:
ConComSub.updateConComTopic(topic_name)
else:
ConComSub.closeSubscriber()
def update_rc_channel(self, new_index):
RCSub.updateRCChannel(int(new_index))

View File

@ -0,0 +1,309 @@
import os
import rospkg
import roslib
from python_qt_binding import loadUi
from python_qt_binding.QtCore import Qt, QTimer, qWarning, Slot
from python_qt_binding.QtGui import QIcon
from python_qt_binding.QtWidgets import QAction, QMenu, QWidget, QMessageBox
import rospy
from rqt_py_common import topic_helpers
from .rosplot import ROSData, RosPlotException
from .map_subscribers import *
PWD = os.path.dirname(os.path.abspath(__file__))
def get_plot_fields(topic_name):
topic_type, real_topic, _ = topic_helpers.get_topic_type(topic_name)
if topic_type is None:
message = "topic %s does not exist" % ( topic_name )
return [], message
field_name = topic_name[len(real_topic)+1:]
slot_type, is_array, array_size = roslib.msgs.parse_type(topic_type)
field_class = roslib.message.get_message_class(slot_type)
fields = [f for f in field_name.split('/') if f]
for field in fields:
# parse the field name for an array index
try:
field, _, field_index = roslib.msgs.parse_type(field)
except roslib.msgs.MsgSpecException:
message = "invalid field %s in topic %s" % ( field, real_topic )
return [], message
if field not in getattr(field_class, '__slots__', []):
message = "no field %s in topic %s" % ( field_name, real_topic )
return [], message
slot_type = field_class._slot_types[field_class.__slots__.index(field)]
slot_type, slot_is_array, array_size = roslib.msgs.parse_type(slot_type)
is_array = slot_is_array and field_index is None
field_class = topic_helpers.get_type_class(slot_type)
if field_class in (int, float):
if is_array:
if array_size is not None:
message = "topic %s is fixed-size numeric array" % ( topic_name )
return [ "%s[%d]" % (topic_name, i) for i in range(array_size) ], message
else:
message = "topic %s is variable-size numeric array" % ( topic_name )
return [], message
else:
message = "topic %s is numeric" % ( topic_name )
return [ topic_name ], message
else:
if not roslib.msgs.is_valid_constant_type(slot_type):
numeric_fields = []
for i, slot in enumerate(field_class.__slots__):
slot_type = field_class._slot_types[i]
slot_type, is_array, array_size = roslib.msgs.parse_type(slot_type)
slot_class = topic_helpers.get_type_class(slot_type)
if slot_class in (int, float) and not is_array:
numeric_fields.append(slot)
message = ""
if len(numeric_fields) > 0:
message = "%d plottable fields in %s" % ( len(numeric_fields), topic_name )
else:
message = "No plottable fields in %s" % ( topic_name )
return [ "%s/%s" % (topic_name, f) for f in numeric_fields ], message
else:
message = "Topic %s is not numeric" % ( topic_name )
return [], message
def is_plottable(topic_names): # returns plottable, message
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fields, message = get_plot_fields(topic_names)
return len(fields) > 0, message
def get_topic(topic_tuple):
key = topic_tuple[0]
maintopic = ''
subtopic = topic_tuple[1]
#if key == 'i':
# maintopic = InitSub.getGPSInitTopic()
if key == 's':
maintopic = StateSub.getStateTopic()
#if key == 'r':
# maintopic = RCSub.
if key == 'ci':
maintopic = ConInSub.getConInTopic()
if key == 'cc':
maintopic = ConComSub.getConComTopic()
if maintopic is None:
return None
else:
return '%s/%s' % (maintopic, subtopic)
class PlotWidget(QWidget):
_redraw_interval = 40
def __init__(self, initial_topics=None, start_paused=False):
super(PlotWidget, self).__init__()
self.setObjectName('PlotWidget')
# Available ros topics for plotting
# keys are i=InitSub, s=StateSub, r=RCSub, p=PathSub, w=WaypointSub,
# o=ObstacleSub, g=GPSDataSub, ci=ConInSub, cc=ConComSub
self.message_dict = {
'Course angle vs. Commanded':[('cc','chi_c'),('s','chi')],
'Roll angle vs. Commanded':[('ci','phi_c'),('s','phi')],
'Pitch angle vs. Commanded':[('s','theta'),('ci','theta_c')],
'Airspeed vs. Commanded':[('s','Va'),('cc','Va_c')]
}
# # Available ros topics for plotting
# self.message_dict = {
# 'Course angle (rad)':'/state/chi',
# 'Course angle commanded (rad)':'/controller_commands/chi_c',
# 'Airspeed (m/s)':'/state/Va',
# 'Angle of attack (rad)':'/state/alpha',
# 'Slide slip angle (rad)':'/state/beta',
# 'Roll angle (rad)':'/state/phi',
# 'Pitch angle (rad)':'/state/theta',
# 'Yaw angle (rad)':'/state/psi',
# 'Body frame rollrate (rad/s)':'/state/p',
# 'Body frame pitchrate (rad/s)':'/state/q',
# 'Body frame yawrate (rad/s)':'/state/r',
# 'Groundspeed (m/s)':'/state/Vg'
# }
#self._initial_topics = initial_topics
rp = rospkg.RosPack()
ui_file = os.path.join(PWD, 'resources', 'plot.ui')
loadUi(ui_file, self)
self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))
self.clear_button.setIcon(QIcon.fromTheme('edit-clear'))
self.data_plot = None
if start_paused:
self.pause_button.setChecked(True)
self._start_time = rospy.get_time()
self._rosdata = {}
self._current_key = ''
self._current_topics = []
self._remove_topic_menu = QMenu()
self._msgs.clear()
self._msgs.addItems(self.message_dict.keys())
self._msgs.currentIndexChanged[str].connect(self._draw_graph) # <<<<<<< start here (also modify the dict)
# init and start update timer for plot
self._update_plot_timer = QTimer(self)
self._update_plot_timer.timeout.connect(self.update_plot)
def switch_data_plot_widget(self, data_plot):
self.enable_timer(enabled=False)
self.data_plot_layout.removeWidget(self.data_plot)
if self.data_plot is not None:
self.data_plot.close()
self.data_plot = data_plot
self.data_plot_layout.addWidget(self.data_plot)
self.data_plot.autoscroll(True)
# setup drag 'n drop
self.data_plot.dropEvent = self.dropEvent
self.data_plot.dragEnterEvent = self.dragEnterEvent
'''
if self._initial_topics:
for topic_name in self._initial_topics:
self.add_topic(topic_name)
self._initial_topics = None
else:
for topic_name, rosdata in self._rosdata.items():
data_x, data_y = rosdata.next()
self.data_plot.add_curve(topic_name, topic_name, data_x, data_y)
self._subscribed_topics_changed()
'''
def _draw_graph(self):
#print 'entering _draw_graph'
# NOT GONNA WORRY ABOUT THIS!
# plottable, message = is_plottable(self.message_dict[self._msgs.currentText()]) # <<<<<< will feed this a list
if self._current_key and not (self._msgs.currentText() == self._current_key):
for topic_tuple in self._current_topics:
#print 'removing %s from plot' % topic # ------------------------
self.remove_topic(topic_tuple[0], topic_tuple[1])
self._current_topics = []
self._current_topics = []
self._current_key = self._msgs.currentText()
#print 'current key:', self._current_key
for topic_tuple in self.message_dict[self._current_key]:
#topic = get_topic(topic_tuple)
#print 'topic:', topic
#if not (topic is None):
self._current_topics.append(topic_tuple)
#print 'adding %s to plot' % topic # --------------------------
self.add_topic(topic_tuple[0], topic_tuple[1])
self._subscribed_topics_changed()
@Slot(bool)
def on_pause_button_clicked(self, checked):
self.enable_timer(not checked)
@Slot()
def on_clear_button_clicked(self):
self.clear_plot()
def update_plot(self):
if self.data_plot is not None:
needs_redraw = False
for topic_name, rosdata in self._rosdata.items():
try:
data_x, data_y = rosdata.next()
if data_x or data_y:
self.data_plot.update_values(topic_name, data_x, data_y)
needs_redraw = True
except RosPlotException as e:
qWarning('PlotWidget.update_plot(): error in rosplot: %s' % e)
if needs_redraw:
self.data_plot.redraw()
def _subscribed_topics_changed(self):
#self._update_remove_topic_menu() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if not self.pause_button.isChecked():
# if pause button is not pressed, enable timer based on subscribed topics
self.enable_timer(self._rosdata)
self.data_plot.redraw()
def _update_remove_topic_menu(self):
def make_remove_topic_function(x):
return lambda: self.remove_topic(x)
self._remove_topic_menu.clear()
for topic_name in sorted(self._rosdata.keys()):
action = QAction(topic_name, self._remove_topic_menu)
action.triggered.connect(make_remove_topic_function(topic_name))
self._remove_topic_menu.addAction(action)
if len(self._rosdata) > 1:
all_action = QAction('All', self._remove_topic_menu)
all_action.triggered.connect(self.clean_up_subscribers)
self._remove_topic_menu.addAction(all_action)
def add_topic(self, topic_code, topic_item):
topics_changed = False
topic_name = topic_code + '/' + topic_item
#for topic_name in get_plot_fields(topic_name)[0]: # <<<<<<<< this is what allows for multiple topics
if topic_name in self._rosdata:
qWarning('PlotWidget.add_topic(): topic already subscribed: %s' % topic_name)
#continue
return
self._rosdata[topic_name] = ROSData(topic_code, topic_item, self._start_time)
if self._rosdata[topic_name].error is not None:
qWarning(str(self._rosdata[topic_name].error))
del self._rosdata[topic_name]
else:
data_x, data_y = self._rosdata[topic_name].next()
self.data_plot.add_curve(topic_name, topic_name, data_x, data_y)
#print self._rosdata.items() # ------------------------------------------
topics_changed = True
#if topics_changed:
# self._subscribed_topics_changed()
def remove_topic(self, topic_code, topic_item):
topic_name = topic_code + '/' + topic_item
self._rosdata[topic_name].close()
del self._rosdata[topic_name]
self.data_plot.remove_curve(topic_name)
self._subscribed_topics_changed()
def clear_plot(self):
for topic_name, _ in self._rosdata.items():
self.data_plot.clear_values(topic_name)
self.data_plot.redraw()
def clean_up_subscribers(self):
for topic_name, rosdata in self._rosdata.items():
rosdata.close()
self.data_plot.remove_curve(topic_name)
self._rosdata = {}
self._subscribed_topics_changed()
def enable_timer(self, enabled=True):
if enabled:
self._update_plot_timer.start(self._redraw_interval)
else:
self._update_plot_timer.stop()

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -0,0 +1,321 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CmWindow</class>
<widget class="QWidget" name="CmWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>507</width>
<height>406</height>
</rect>
</property>
<property name="windowTitle">
<string>Send Special Commands</string>
</property>
<widget class="QWidget" name="centralWidget" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>501</width>
<height>421</height>
</rect>
</property>
<widget class="QTabWidget" name="special_command_tabs">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>481</width>
<height>291</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Zero Sensors</string>
</attribute>
<widget class="QPushButton" name="zero_sensor_button">
<property name="geometry">
<rect>
<x>189</x>
<y>40</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Zero Sensors</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Takeoff</string>
</attribute>
<widget class="QPushButton" name="takeoff_button">
<property name="geometry">
<rect>
<x>200</x>
<y>40</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Takeoff</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Land</string><!--+++++++++++++++++++++++++++++++++++++-->
</attribute>
<widget class="QTextEdit" name="land_lat_field">
<property name="geometry">
<rect>
<x>260</x>
<y>50</y>
<width>131</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QTextEdit" name="land_lon_field">
<property name="geometry">
<rect>
<x>260</x>
<y>100</y>
<width>131</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QTextEdit" name="land_chi_field">
<property name="geometry">
<rect>
<x>260</x>
<y>150</y>
<width>131</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QTextEdit" name="land_direction_field">
<property name="geometry">
<rect>
<x>260</x>
<y>200</y>
<width>131</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>290</x>
<y>20</y>
<width>101</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Landing Point</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>400</x>
<y>60</y>
<width>57</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>degrees</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>400</x>
<y>110</y>
<width>57</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>degrees</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>400</x>
<y>160</y>
<width>57</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>degrees</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>200</x>
<y>60</y>
<width>57</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>latitude:</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>190</x>
<y>110</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>longitude:</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>200</x>
<y>160</y>
<width>57</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>chi:</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>190</x>
<y>207</y>
<width>71</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>direction:</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>400</x>
<y>207</y>
<width>71</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>-1 or 1</string>
</property>
</widget>
<widget class="QPushButton" name="land_button">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>131</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Land at point</string><!--++++++++++++++++++++++++++++++++++-->
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Return Home</string>
</attribute>
<widget class="QPushButton" name="rth_button">
<property name="geometry">
<rect>
<x>200</x>
<y>40</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>RTH</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>Loiter</string>
</attribute>
<widget class="QPushButton" name="loiter_button">
<property name="geometry">
<rect>
<x>200</x>
<y>40</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Loiter</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>Bottle Drop</string>
</attribute>
<widget class="QPushButton" name="drop_button">
<property name="geometry">
<rect>
<x>200</x>
<y>40</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Drop!</string>
</property>
</widget>
</widget>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>170</x>
<y>10</y>
<width>201</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Choose a special command:</string>
</property>
</widget>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ControlWidget</class>
<widget class="QWidget" name="ControlWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>916</width>
<height>561</height>
</rect>
</property>
<property name="windowTitle">
<string>Control Window</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="toplayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="type_label">
<property name="text">
<string>Controls:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QPushButton" name="_add_button">
<property name="toolTip">
<string>Add Currently Selected Message</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_add_button">
<property name="toolTip">
<string>Add Currently Selected Message</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_add_button">
<property name="toolTip">
<string>Add Currently Selected Message</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="_add_button">
<property name="toolTip">
<string>Add Currently Selected Message</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="_add_button">
<property name="toolTip">
<string>Add Currently Selected Message</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>manageKmlDialog</class>
<widget class="QDialog" name="manageKmlDialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>711</width>
<height>473</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>KML Management</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>691</width>
<height>451</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QPushButton" name="addButton">
<property name="text">
<string>add KML</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>remove KML</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QTreeWidget" name="kml_treeWidget">
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="headerHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>20</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>KML File</string>
</property>
<property name="font">
<font>
<kerning>true</kerning>
</font>
</property>
</column>
<column>
<property name="text">
<string>Visible</string>
</property>
</column>
</widget>
</item>
<item row="1" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MapWindow</class>
<widget class="QWidget" name="MapWindow">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="_home_opts">
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Where the map will be centered.</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="_gridview_toggle">
<property name="maximumSize">
<size>
<width>30</width>
<height>10000</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="_toggle_label">
<property name="text">
<string>Grid Viewer Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_map_options">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>OPTIONS</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_recenter">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Recenter Map</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpWindow</class>
<widget class="QWidget" name="OpWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>ROS options</string>
</property>
<widget class="QWidget" name="centralWidget" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>500</height>
</rect>
</property>
<widget class="QTabWidget" name="tab_widget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>780</width>
<height>480</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
</widget>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DataPlotWidget</class>
<widget class="QWidget" name="DataPlotWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>61</height>
</rect>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="windowTitle">
<string>Plot</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="dataPlotControls">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Topic: </string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="_msgs">
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Message Name</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pause_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>pause plot</string>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clear_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>clear plot</string>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="data_plot_layout">
<property name="spacing">
<number>0</number>
</property>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MessagesWidget</class>
<widget class="QWidget" name="MessagesWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>916</width>
<height>561</height>
</rect>
</property>
<property name="windowTitle">
<string>Message Type Browser</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="toplayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="type_label">
<property name="text">
<string>Message:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="_msgs">
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Message Name</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="MessagesTreeView" name="_messages_tree">
<property name="toolTip">
<string>Select a message above and click add to see it in this viewing area.</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MessagesTreeView</class>
<extends>QTreeView</extends>
<header>rqt_msg.messages_widget</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WpWindow</class>
<widget class="QWidget" name="WpWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>703</width>
<height>427</height>
</rect>
</property>
<property name="windowTitle">
<string>Handle Waypoints</string>
</property>
<widget class="QPushButton" name="send_to_plane_button">
<property name="geometry">
<rect>
<x>530</x>
<y>250</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Send to Plane</string>
</property>
</widget>
<widget class="QListWidget" name="listWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>351</width>
<height>331</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="waypoint_label">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>320</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string></string>
</property>
</widget>
<widget class="QComboBox" name="mode_comboBox">
<property name="geometry">
<rect>
<x>530</x>
<y>290</y>
<width>151</width>
<height>25</height>
</rect>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,184 @@
import string
import sys, os
import threading
import time
import rosgraph
import roslib.message
import roslib.names
import rospy
from .map_subscribers import *
from python_qt_binding.QtCore import QTimer
class RosPlotException(Exception):
pass
def _get_topic_type(topic):
"""
subroutine for getting the topic type
(nearly identical to rostopic._get_topic_type, except it returns rest of name instead of fn)
:returns: topic type, real topic name, and rest of name referenced
if the topic points to a field within a topic, e.g. /rosout/msg, ``str, str, str``
"""
try:
master = rosgraph.Master('/rosplot')
val = master.getTopicTypes()
except:
raise RosPlotException("unable to get list of topics from master")
matches = [(t, t_type) for t, t_type in val if t == topic or topic.startswith(t + '/')]
if matches:
t, t_type = matches[0]
if t_type == roslib.names.ANYTYPE:
return None, None, None
if t_type == topic:
return t_type, None
return t_type, t, topic[len(t):]
else:
return None, None, None
def get_topic_type(topic):
"""
Get the topic type (nearly identical to rostopic.get_topic_type, except it doesn't return a fn)
:returns: topic type, real topic name, and rest of name referenced
if the \a topic points to a field within a topic, e.g. /rosout/msg, ``str, str, str``
"""
topic_type, real_topic, rest = _get_topic_type(topic)
if topic_type:
return topic_type, real_topic, rest
else:
return None, None, None
class ROSData(object):
"""
Subscriber to ROS topic that buffers incoming data
"""
def __init__(self, topic_code, topic_item, start_time):
self.name = topic_code + '/' + topic_item
self.start_time = start_time
self.error = None
self.lock = threading.Lock()
self.buff_x = []
self.buff_y = []
self.interval = 100 # in milliseconds, period of regular update
self.timer = QTimer()
self.timer.setInterval(self.interval)
self.code = topic_code
self.item = topic_item
# go through options and decide what your self.data will be, given the ros subscribers
if topic_code == 's':
if topic_item == 'chi':
self.timer.timeout.connect(self.state_chi_cb)
elif topic_item == 'phi':
self.timer.timeout.connect(self.state_phi_cb)
elif topic_item == 'theta':
self.timer.timeout.connect(self.state_theta_cb)
elif topic_item == 'Va':
self.timer.timeout.connect(self.state_Va_cb)
elif topic_code == 'ci':
if topic_item == 'phi_c':
self.timer.timeout.connect(self.conin_phi_c_cb)
elif topic_item == 'theta_c':
self.timer.timeout.connect(self.conin_theta_c_cb)
elif topic_code == 'cc':
if topic_item == 'chi_c':
self.timer.timeout.connect(self.concom_chi_c_cb)
elif topic_item == 'Va_c':
self.timer.timeout.connect(self.concom_Va_c_cb)
self.timer.start()
def close(self):
self.timer.stop()
def state_chi_cb(self):
self.buff_x.append(rospy.get_time() - self.start_time)
self.buff_y.append(StateSub.chi)
def state_phi_cb(self):
self.buff_x.append(rospy.get_time() - self.start_time)
self.buff_y.append(StateSub.phi)
def state_theta_cb(self):
self.buff_x.append(rospy.get_time() - self.start_time)
self.buff_y.append(StateSub.theta)
def state_Va_cb(self):
self.buff_x.append(rospy.get_time() - self.start_time)
self.buff_y.append(StateSub.Va)
def conin_phi_c_cb(self):
self.buff_x.append(rospy.get_time() - self.start_time)
self.buff_y.append(ConInSub.phi_c)
def conin_theta_c_cb(self):
self.buff_x.append(rospy.get_time() - self.start_time)
self.buff_y.append(ConInSub.theta_c)
def concom_chi_c_cb(self):
self.buff_x.append(rospy.get_time() - self.start_time)
self.buff_y.append(ConComSub.chi_c)
def concom_Va_c_cb(self):
self.buff_x.append(rospy.get_time() - self.start_time)
self.buff_y.append(ConComSub.Va_c)
def next(self):
"""
Get the next data in the series
:returns: [xdata], [ydata]
"""
if self.error:
raise self.error
try:
self.lock.acquire()
buff_x = self.buff_x
buff_y = self.buff_y
self.buff_x = []
self.buff_y = []
finally:
self.lock.release()
return buff_x, buff_y
def _array_eval(field_name, slot_num):
"""
:param field_name: name of field to index into, ``str``
:param slot_num: index of slot to return, ``str``
:returns: fn(msg_field)->msg_field[slot_num]
"""
def fn(f):
return getattr(f, field_name).__getitem__(slot_num)
return fn
def _field_eval(field_name):
"""
:param field_name: name of field to return, ``str``
:returns: fn(msg_field)->msg_field.field_name
"""
def fn(f):
return getattr(f, field_name)
return fn
def generate_field_evals(fields):
try:
evals = []
fields = [f for f in fields.split('/') if f]
for f in fields:
if '[' in f:
field_name, rest = f.split('[')
slot_num = string.atoi(rest[:rest.find(']')])
evals.append(_array_eval(field_name, slot_num))
else:
evals.append(_field_eval(f))
return evals
except Exception, e:
raise RosPlotException("cannot parse field reference [%s]: %s" % (fields, str(e)))

View File

@ -0,0 +1,16 @@
*~
*.swp
*.bak
*.user
.DS_Store
.cproject
.project
.settings
*.pyc
*.gch
*.cbp
*.cmake
*CMakeFiles*
*catkin_generated*
*Makefile
*cmake*

View File

@ -0,0 +1,6 @@
[submodule "rosflight/include/mavlink/v1.0"]
path = rosflight/include/rosflight/mavlink/v1.0
url = https://github.com/rosflight/mavlink_c_library.git
[submodule "rosflight_firmware/firmware"]
path = rosflight_firmware/firmware
url = https://github.com/rosflight/firmware

View File

@ -0,0 +1,30 @@
BSD 3-Clause License
Copyright (c) 2017 Daniel Koch and James Jackson, BYU MAGICC Lab.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,21 @@
# ROSflight
This repository contains the ROS stack for interfacing with an autopilot running the ROSflight firmware. For more information on the ROSflight autopilot firmware stack, visit http://rosflight.org.
The following sections describe each of the packages contained in this stack.
## rosflight_pkgs
This is a metapackage for grouping the other packages into a ROS stack.
## rosflight_msgs
This package contains the ROSflight message and service definitions.
## rosflight
This package contains the `rosflight_io` node, which provides the core functionality for interfacing an onboard computer with the autopilot. This node streams autopilot sensor and status data to the onboard computer, streams control setpoints to the autopilot, and provides an interface for configuring the autopilot.
## rosflight_utils
This package contains additional supporting scripts and libraries that are not part of the core ROSflight package functionality. This package also helps support the [ros_plane](https://github.com/byu-magicc/ros_plane) and [ros_copter](https://github.com/byu-magicc/ros_copter) projects.

View File

@ -0,0 +1,40 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package rosflight
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.1.3 (2017-06-02)
------------------
* Temporarily removed magnetometer calibration
* Updated package.xml files
* Renamed sonar/data topic to sonar
* Changed yaml-cpp dependency to a PkgConfig module
* Contributors: Daniel Koch
0.1.2 (2017-05-24)
------------------
* Removed OpenMP compile flag for now
* Added missing tf dependency
* Contributors: Daniel Koch
0.1.1 (2017-05-24)
------------------
* Added missing dependencies
* Contributors: Daniel Koch
0.1.0 (2017-05-22)
------------------
* Added BSD license statements to source files
Closes `#1 <https://github.com/rosflight/rosflight/issues/1>`_
* Added git as build dependency for rosflight
* Fixed system dependencies. Closes `#10 <https://github.com/rosflight/rosflight/issues/10>`_.
* cleanup of CMakeLists.txt
* cleanup of CMakeLists.txt
* automatic git submodule cloning
* Replaced outdated package README files with simpler top-level README
The information that used to be in the package README files is now on the ROS wiki (http://wiki.ros.org/rosflight_pkgs, http://wiki.ros.org/rosflight, etc.)
Closes `#7 <https://github.com/rosflight/rosflight/issues/7>`_
* Fixed rosflight_io runtime name
* Created the rosflight_msgs package and updated dependencies
* Restructured rosflight package include structure
* Renamed rosflight_io package to rosflight
* Contributors: Daniel Koch, James Jackson

View File

@ -0,0 +1,114 @@
cmake_minimum_required(VERSION 2.8.3)
project(rosflight)
set(CMAKE_BUILD_TYPE Release)
message("CMAKE_C_FLAGS_RELEASE is ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS "-std=c++0x")
find_package(catkin REQUIRED COMPONENTS
roscpp
geometry_msgs
rosflight_msgs
sensor_msgs
std_msgs
std_srvs
tf
eigen_stl_containers
)
find_package(Boost REQUIRED COMPONENTS system thread)
find_package(Eigen3 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
## Look for and clone MAVLINK if it is missing
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/rosflight/mavlink/v1.0/.git")
message(STATUS "MAVLink submodule not found at ${CMAKE_CURRENT_SOURCE_DIR}/include/rosflight/mavlink/v1.0")
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
###################################
## catkin specific configuration ##
###################################
catkin_package(
INCLUDE_DIRS include
LIBRARIES mavrosflight
CATKIN_DEPENDS roscpp geometry_msgs rosflight_msgs sensor_msgs std_msgs tf
DEPENDS Boost EIGEN3 YAML_CPP tf
)
###########
## Build ##
###########
include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${YAML_CPP_INCLUDEDIR}
)
# mavrosflight library
add_library(mavrosflight
src/mavrosflight/mavrosflight.cpp
src/mavrosflight/mavlink_comm.cpp
src/mavrosflight/mavlink_serial.cpp
src/mavrosflight/mavlink_udp.cpp
src/mavrosflight/param_manager.cpp
src/mavrosflight/param.cpp
src/mavrosflight/time_manager.cpp
)
add_dependencies(mavrosflight ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(mavrosflight
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${YAML_CPP_LIBRARIES}
)
# rosflight_io_node
add_executable(rosflight_io
src/rosflight_io_node.cpp
src/rosflight_io.cpp
)
add_dependencies(rosflight_io ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(rosflight_io
mavrosflight
${catkin_LIBRARIES}
${Boost_LIBRARES}
)
add_executable(calibrate_mag
src/mag_cal_node.cpp
src/mag_cal.cpp
)
add_dependencies(calibrate_mag ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(calibrate_mag
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
#############
## Install ##
#############
# Mark executables and libraries for installation
install(TARGETS mavrosflight rosflight_io
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# Mark cpp header files for installation
install(DIRECTORY include/rosflight/mavrosflight/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)

View File

@ -0,0 +1,160 @@
/*
* Copyright (c) 2017 Daniel Koch and James Jackson, BYU MAGICC Lab.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file mag_cal.h
* \author Jerel Nielsen <jerel.nielsen@gmail.com>
* \author Devon Morris <devonmorris1992@gmail.com>
*/
#ifndef ROSFLIGHT_SENSORS_CALBRATE_MAG_H
#define ROSFLIGHT_SENSORS_CALBRATE_MAG_H
#include <ros/ros.h>
#include <message_filters/subscriber.h>
#include <rosflight_msgs/ParamSet.h>
#include <sensor_msgs/MagneticField.h>
#include <eigen3/Eigen/Eigen>
#include <math.h>
#include <random>
#include <boost/bind.hpp>
#include <eigen_stl_containers/eigen_stl_vector_container.h>
#include <vector>
namespace rosflight
{
/**
* \brief CalibrateMag sensor class
*/
class CalibrateMag
{
public:
CalibrateMag();
void run();
/**
* \brief Begin the magnetometer calibration routine
*/
void start_mag_calibration();
void do_mag_calibration();
/**
* @brief set_refence_magnetic_field_strength
* @param reference_magnetic_field
*/
bool mag_callback(const sensor_msgs::MagneticField::ConstPtr& mag);
void set_reference_magnetic_field_strength(double reference_magnetic_field);
/**
* \brief Check if a calibration is in progress
* \return True if a calibration is currently in progress
*/
bool is_calibrating() { return calibrating_; }
/// The const stuff is to make it read-only
const double a11() const { return A_(0, 0); }
const double a12() const { return A_(0, 1); }
const double a13() const { return A_(0, 2); }
const double a21() const { return A_(1, 0); }
const double a22() const { return A_(1, 1); }
const double a23() const { return A_(1, 2); }
const double a31() const { return A_(2, 0); }
const double a32() const { return A_(2, 1); }
const double a33() const { return A_(2, 2); }
const double bx() const { return b_(0, 0); }
const double by() const { return b_(1, 0); }
const double bz() const { return b_(2, 0); }
private:
bool set_param(std::string name, double value);
ros::NodeHandle nh_;
ros::NodeHandle nh_private_;
message_filters::Subscriber<sensor_msgs::MagneticField> mag_subscriber_;
ros::ServiceServer mag_cal_srv_;
ros::ServiceClient param_set_client_;
Eigen::MatrixXd A_, b_;
double reference_field_strength_; //!< the strength of earth's magnetic field at your location
bool calibrating_; //!< whether a temperature calibration is in progress
bool first_time_; //!< waiting for first measurement for calibration
double calibration_time_; //!< seconds to record data for temperature compensation
double start_time_; //!< timestamp of first calibration measurement
int ransac_iters_; //!< number of ransac iterations to fit ellipsoid to mag measurements
int measurement_skip_;
int measurement_throttle_;
double inlier_thresh_; //!< threshold to consider measurement an inlier in ellipsoidRANSAC
Eigen::Vector3d measurement_prev_;
EigenSTL::vector_Vector3d measurements_;
// function to perform RANSAC on ellipsoid data
Eigen::MatrixXd ellipsoidRANSAC(EigenSTL::vector_Vector3d meas, int iters, double inlier_thresh);
// function to vector from ellipsoid center to surface along input vector
Eigen::Vector3d intersect(Eigen::Vector3d r_m, Eigen::Vector3d r_e, Eigen::MatrixXd Q, Eigen::MatrixXd ub, double k);
/*
sort eigenvalues and eigenvectors output from Eigen library
*/
void eigSort(Eigen::MatrixXd &w, Eigen::MatrixXd &v);
/*
This function gets ellipsoid parameters via least squares on ellipsoidal data
according to the paper: Li, Qingde, and John G. Griffiths. "Least squares ellipsoid
specific fitting." Geometric modeling and processing, 2004. proceedings. IEEE, 2004.
*/
Eigen::MatrixXd ellipsoidLS(EigenSTL::vector_Vector3d meas);
/*
This function compute magnetometer calibration parameters according to Section 5.3 of the
paper: Renaudin, Valérie, Muhammad Haris Afzal, and Gérard Lachapelle. "Complete triaxis
magnetometer calibration in the magnetic domain." Journal of sensors 2010 (2010).
*/
void magCal(Eigen::MatrixXd u, Eigen::MatrixXd &A, Eigen::MatrixXd &bb);
};
} // namespace mag_cal
#endif // MAVROSFLIGHT_SENSORS_MAG_H

View File

@ -0,0 +1,96 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _CHECKSUM_H_
#define _CHECKSUM_H_
// Visual Studio versions before 2010 don't have stdint.h, so we just error out.
#if (defined _MSC_VER) && (_MSC_VER < 1600)
#error "The C-MAVLink implementation requires Visual Studio 2010 or greater"
#endif
#include <stdint.h>
/**
*
* CALCULATE THE CHECKSUM
*
*/
#define X25_INIT_CRC 0xffff
#define X25_VALIDATE_CRC 0xf0b8
#ifndef HAVE_CRC_ACCUMULATE
/**
* @brief Accumulate the X.25 CRC by adding one char at a time.
*
* The checksum function adds the hash of one char at a time to the
* 16 bit checksum (uint16_t).
*
* @param data new char to hash
* @param crcAccum the already accumulated checksum
**/
static inline void crc_accumulate(uint8_t data, uint16_t *crcAccum)
{
/*Accumulate one byte of data into the CRC*/
uint8_t tmp;
tmp = data ^ (uint8_t)(*crcAccum &0xff);
tmp ^= (tmp<<4);
*crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
}
#endif
/**
* @brief Initiliaze the buffer for the X.25 CRC
*
* @param crcAccum the 16 bit X.25 CRC
*/
static inline void crc_init(uint16_t* crcAccum)
{
*crcAccum = X25_INIT_CRC;
}
/**
* @brief Calculates the X.25 checksum on a byte buffer
*
* @param pBuffer buffer containing the byte array to hash
* @param length length of the byte array
* @return the checksum over the buffer bytes
**/
static inline uint16_t crc_calculate(const uint8_t* pBuffer, uint16_t length)
{
uint16_t crcTmp;
crc_init(&crcTmp);
while (length--) {
crc_accumulate(*pBuffer++, &crcTmp);
}
return crcTmp;
}
/**
* @brief Accumulate the X.25 CRC by adding an array of bytes
*
* The checksum function adds the hash of one char at a time to the
* 16 bit checksum (uint16_t).
*
* @param data new bytes to hash
* @param crcAccum the already accumulated checksum
**/
static inline void crc_accumulate_buffer(uint16_t *crcAccum, const char *pBuffer, uint16_t length)
{
const uint8_t *p = (const uint8_t *)pBuffer;
while (length--) {
crc_accumulate(*p++, crcAccum);
}
}
#endif /* _CHECKSUM_H_ */
#ifdef __cplusplus
}
#endif

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,27 @@
/** @file
* @brief MAVLink comm protocol built from common.xml
* @see http://mavlink.org
*/
#ifndef MAVLINK_H
#define MAVLINK_H
#ifndef MAVLINK_STX
#define MAVLINK_STX 254
#endif
#ifndef MAVLINK_ENDIAN
#define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN
#endif
#ifndef MAVLINK_ALIGNED_FIELDS
#define MAVLINK_ALIGNED_FIELDS 1
#endif
#ifndef MAVLINK_CRC_EXTRA
#define MAVLINK_CRC_EXTRA 1
#endif
#include "version.h"
#include "common.h"
#endif // MAVLINK_H

View File

@ -0,0 +1,249 @@
// MESSAGE ACTUATOR_CONTROL_TARGET PACKING
#define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET 140
typedef struct __mavlink_actuator_control_target_t
{
uint64_t time_usec; /*< Timestamp (micros since boot or Unix epoch)*/
float controls[8]; /*< 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.*/
uint8_t group_mlx; /*< Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.*/
} mavlink_actuator_control_target_t;
#define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN 41
#define MAVLINK_MSG_ID_140_LEN 41
#define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC 181
#define MAVLINK_MSG_ID_140_CRC 181
#define MAVLINK_MSG_ACTUATOR_CONTROL_TARGET_FIELD_CONTROLS_LEN 8
#define MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET { \
"ACTUATOR_CONTROL_TARGET", \
3, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_actuator_control_target_t, time_usec) }, \
{ "controls", NULL, MAVLINK_TYPE_FLOAT, 8, 8, offsetof(mavlink_actuator_control_target_t, controls) }, \
{ "group_mlx", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_actuator_control_target_t, group_mlx) }, \
} \
}
/**
* @brief Pack a actuator_control_target message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param group_mlx Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
* @param controls 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.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_actuator_control_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, uint8_t group_mlx, const float *controls)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint8_t(buf, 40, group_mlx);
_mav_put_float_array(buf, 8, controls, 8);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#else
mavlink_actuator_control_target_t packet;
packet.time_usec = time_usec;
packet.group_mlx = group_mlx;
mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
}
/**
* @brief Pack a actuator_control_target message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param group_mlx Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
* @param controls 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.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_actuator_control_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,uint8_t group_mlx,const float *controls)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint8_t(buf, 40, group_mlx);
_mav_put_float_array(buf, 8, controls, 8);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#else
mavlink_actuator_control_target_t packet;
packet.time_usec = time_usec;
packet.group_mlx = group_mlx;
mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
}
/**
* @brief Encode a actuator_control_target struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param actuator_control_target C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_actuator_control_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_actuator_control_target_t* actuator_control_target)
{
return mavlink_msg_actuator_control_target_pack(system_id, component_id, msg, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls);
}
/**
* @brief Encode a actuator_control_target struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param actuator_control_target C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_actuator_control_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_actuator_control_target_t* actuator_control_target)
{
return mavlink_msg_actuator_control_target_pack_chan(system_id, component_id, chan, msg, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls);
}
/**
* @brief Send a actuator_control_target message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param group_mlx Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
* @param controls 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.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_actuator_control_target_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t group_mlx, const float *controls)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint8_t(buf, 40, group_mlx);
_mav_put_float_array(buf, 8, controls, 8);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
#else
mavlink_actuator_control_target_t packet;
packet.time_usec = time_usec;
packet.group_mlx = group_mlx;
mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_actuator_control_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t group_mlx, const float *controls)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint8_t(buf, 40, group_mlx);
_mav_put_float_array(buf, 8, controls, 8);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
#else
mavlink_actuator_control_target_t *packet = (mavlink_actuator_control_target_t *)msgbuf;
packet->time_usec = time_usec;
packet->group_mlx = group_mlx;
mav_array_memcpy(packet->controls, controls, sizeof(float)*8);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ACTUATOR_CONTROL_TARGET UNPACKING
/**
* @brief Get field time_usec from actuator_control_target message
*
* @return Timestamp (micros since boot or Unix epoch)
*/
static inline uint64_t mavlink_msg_actuator_control_target_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field group_mlx from actuator_control_target message
*
* @return Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
*/
static inline uint8_t mavlink_msg_actuator_control_target_get_group_mlx(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 40);
}
/**
* @brief Get field controls from actuator_control_target message
*
* @return 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.
*/
static inline uint16_t mavlink_msg_actuator_control_target_get_controls(const mavlink_message_t* msg, float *controls)
{
return _MAV_RETURN_float_array(msg, controls, 8, 8);
}
/**
* @brief Decode a actuator_control_target message into a struct
*
* @param msg The message to decode
* @param actuator_control_target C-struct to decode the message contents into
*/
static inline void mavlink_msg_actuator_control_target_decode(const mavlink_message_t* msg, mavlink_actuator_control_target_t* actuator_control_target)
{
#if MAVLINK_NEED_BYTE_SWAP
actuator_control_target->time_usec = mavlink_msg_actuator_control_target_get_time_usec(msg);
mavlink_msg_actuator_control_target_get_controls(msg, actuator_control_target->controls);
actuator_control_target->group_mlx = mavlink_msg_actuator_control_target_get_group_mlx(msg);
#else
memcpy(actuator_control_target, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
#endif
}

View File

@ -0,0 +1,489 @@
// MESSAGE ADSB_VEHICLE PACKING
#define MAVLINK_MSG_ID_ADSB_VEHICLE 246
typedef struct __mavlink_adsb_vehicle_t
{
uint32_t ICAO_address; /*< ICAO address*/
int32_t lat; /*< Latitude, expressed as degrees * 1E7*/
int32_t lon; /*< Longitude, expressed as degrees * 1E7*/
int32_t altitude; /*< Altitude(ASL) in millimeters*/
uint16_t heading; /*< Course over ground in centidegrees*/
uint16_t hor_velocity; /*< The horizontal velocity in centimeters/second*/
int16_t ver_velocity; /*< The vertical velocity in centimeters/second, positive is up*/
uint16_t flags; /*< Flags to indicate various statuses including valid data fields*/
uint16_t squawk; /*< Squawk code*/
uint8_t altitude_type; /*< Type from ADSB_ALTITUDE_TYPE enum*/
char callsign[9]; /*< The callsign, 8+null*/
uint8_t emitter_type; /*< Type from ADSB_EMITTER_TYPE enum*/
uint8_t tslc; /*< Time since last communication in seconds*/
} mavlink_adsb_vehicle_t;
#define MAVLINK_MSG_ID_ADSB_VEHICLE_LEN 38
#define MAVLINK_MSG_ID_246_LEN 38
#define MAVLINK_MSG_ID_ADSB_VEHICLE_CRC 184
#define MAVLINK_MSG_ID_246_CRC 184
#define MAVLINK_MSG_ADSB_VEHICLE_FIELD_CALLSIGN_LEN 9
#define MAVLINK_MESSAGE_INFO_ADSB_VEHICLE { \
"ADSB_VEHICLE", \
13, \
{ { "ICAO_address", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_adsb_vehicle_t, ICAO_address) }, \
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_adsb_vehicle_t, lat) }, \
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_adsb_vehicle_t, lon) }, \
{ "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_adsb_vehicle_t, altitude) }, \
{ "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_adsb_vehicle_t, heading) }, \
{ "hor_velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_adsb_vehicle_t, hor_velocity) }, \
{ "ver_velocity", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_adsb_vehicle_t, ver_velocity) }, \
{ "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_adsb_vehicle_t, flags) }, \
{ "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_adsb_vehicle_t, squawk) }, \
{ "altitude_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_adsb_vehicle_t, altitude_type) }, \
{ "callsign", NULL, MAVLINK_TYPE_CHAR, 9, 27, offsetof(mavlink_adsb_vehicle_t, callsign) }, \
{ "emitter_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_adsb_vehicle_t, emitter_type) }, \
{ "tslc", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_adsb_vehicle_t, tslc) }, \
} \
}
/**
* @brief Pack a adsb_vehicle message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param ICAO_address ICAO address
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param altitude_type Type from ADSB_ALTITUDE_TYPE enum
* @param altitude Altitude(ASL) in millimeters
* @param heading Course over ground in centidegrees
* @param hor_velocity The horizontal velocity in centimeters/second
* @param ver_velocity The vertical velocity in centimeters/second, positive is up
* @param callsign The callsign, 8+null
* @param emitter_type Type from ADSB_EMITTER_TYPE enum
* @param tslc Time since last communication in seconds
* @param flags Flags to indicate various statuses including valid data fields
* @param squawk Squawk code
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_adsb_vehicle_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
_mav_put_uint32_t(buf, 0, ICAO_address);
_mav_put_int32_t(buf, 4, lat);
_mav_put_int32_t(buf, 8, lon);
_mav_put_int32_t(buf, 12, altitude);
_mav_put_uint16_t(buf, 16, heading);
_mav_put_uint16_t(buf, 18, hor_velocity);
_mav_put_int16_t(buf, 20, ver_velocity);
_mav_put_uint16_t(buf, 22, flags);
_mav_put_uint16_t(buf, 24, squawk);
_mav_put_uint8_t(buf, 26, altitude_type);
_mav_put_uint8_t(buf, 36, emitter_type);
_mav_put_uint8_t(buf, 37, tslc);
_mav_put_char_array(buf, 27, callsign, 9);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#else
mavlink_adsb_vehicle_t packet;
packet.ICAO_address = ICAO_address;
packet.lat = lat;
packet.lon = lon;
packet.altitude = altitude;
packet.heading = heading;
packet.hor_velocity = hor_velocity;
packet.ver_velocity = ver_velocity;
packet.flags = flags;
packet.squawk = squawk;
packet.altitude_type = altitude_type;
packet.emitter_type = emitter_type;
packet.tslc = tslc;
mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
}
/**
* @brief Pack a adsb_vehicle message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param ICAO_address ICAO address
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param altitude_type Type from ADSB_ALTITUDE_TYPE enum
* @param altitude Altitude(ASL) in millimeters
* @param heading Course over ground in centidegrees
* @param hor_velocity The horizontal velocity in centimeters/second
* @param ver_velocity The vertical velocity in centimeters/second, positive is up
* @param callsign The callsign, 8+null
* @param emitter_type Type from ADSB_EMITTER_TYPE enum
* @param tslc Time since last communication in seconds
* @param flags Flags to indicate various statuses including valid data fields
* @param squawk Squawk code
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_adsb_vehicle_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t ICAO_address,int32_t lat,int32_t lon,uint8_t altitude_type,int32_t altitude,uint16_t heading,uint16_t hor_velocity,int16_t ver_velocity,const char *callsign,uint8_t emitter_type,uint8_t tslc,uint16_t flags,uint16_t squawk)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
_mav_put_uint32_t(buf, 0, ICAO_address);
_mav_put_int32_t(buf, 4, lat);
_mav_put_int32_t(buf, 8, lon);
_mav_put_int32_t(buf, 12, altitude);
_mav_put_uint16_t(buf, 16, heading);
_mav_put_uint16_t(buf, 18, hor_velocity);
_mav_put_int16_t(buf, 20, ver_velocity);
_mav_put_uint16_t(buf, 22, flags);
_mav_put_uint16_t(buf, 24, squawk);
_mav_put_uint8_t(buf, 26, altitude_type);
_mav_put_uint8_t(buf, 36, emitter_type);
_mav_put_uint8_t(buf, 37, tslc);
_mav_put_char_array(buf, 27, callsign, 9);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#else
mavlink_adsb_vehicle_t packet;
packet.ICAO_address = ICAO_address;
packet.lat = lat;
packet.lon = lon;
packet.altitude = altitude;
packet.heading = heading;
packet.hor_velocity = hor_velocity;
packet.ver_velocity = ver_velocity;
packet.flags = flags;
packet.squawk = squawk;
packet.altitude_type = altitude_type;
packet.emitter_type = emitter_type;
packet.tslc = tslc;
mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
}
/**
* @brief Encode a adsb_vehicle struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param adsb_vehicle C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_adsb_vehicle_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_adsb_vehicle_t* adsb_vehicle)
{
return mavlink_msg_adsb_vehicle_pack(system_id, component_id, msg, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk);
}
/**
* @brief Encode a adsb_vehicle struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param adsb_vehicle C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_adsb_vehicle_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_adsb_vehicle_t* adsb_vehicle)
{
return mavlink_msg_adsb_vehicle_pack_chan(system_id, component_id, chan, msg, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk);
}
/**
* @brief Send a adsb_vehicle message
* @param chan MAVLink channel to send the message
*
* @param ICAO_address ICAO address
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param altitude_type Type from ADSB_ALTITUDE_TYPE enum
* @param altitude Altitude(ASL) in millimeters
* @param heading Course over ground in centidegrees
* @param hor_velocity The horizontal velocity in centimeters/second
* @param ver_velocity The vertical velocity in centimeters/second, positive is up
* @param callsign The callsign, 8+null
* @param emitter_type Type from ADSB_EMITTER_TYPE enum
* @param tslc Time since last communication in seconds
* @param flags Flags to indicate various statuses including valid data fields
* @param squawk Squawk code
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_adsb_vehicle_send(mavlink_channel_t chan, uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
_mav_put_uint32_t(buf, 0, ICAO_address);
_mav_put_int32_t(buf, 4, lat);
_mav_put_int32_t(buf, 8, lon);
_mav_put_int32_t(buf, 12, altitude);
_mav_put_uint16_t(buf, 16, heading);
_mav_put_uint16_t(buf, 18, hor_velocity);
_mav_put_int16_t(buf, 20, ver_velocity);
_mav_put_uint16_t(buf, 22, flags);
_mav_put_uint16_t(buf, 24, squawk);
_mav_put_uint8_t(buf, 26, altitude_type);
_mav_put_uint8_t(buf, 36, emitter_type);
_mav_put_uint8_t(buf, 37, tslc);
_mav_put_char_array(buf, 27, callsign, 9);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
#else
mavlink_adsb_vehicle_t packet;
packet.ICAO_address = ICAO_address;
packet.lat = lat;
packet.lon = lon;
packet.altitude = altitude;
packet.heading = heading;
packet.hor_velocity = hor_velocity;
packet.ver_velocity = ver_velocity;
packet.flags = flags;
packet.squawk = squawk;
packet.altitude_type = altitude_type;
packet.emitter_type = emitter_type;
packet.tslc = tslc;
mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)&packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)&packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ADSB_VEHICLE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_adsb_vehicle_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, ICAO_address);
_mav_put_int32_t(buf, 4, lat);
_mav_put_int32_t(buf, 8, lon);
_mav_put_int32_t(buf, 12, altitude);
_mav_put_uint16_t(buf, 16, heading);
_mav_put_uint16_t(buf, 18, hor_velocity);
_mav_put_int16_t(buf, 20, ver_velocity);
_mav_put_uint16_t(buf, 22, flags);
_mav_put_uint16_t(buf, 24, squawk);
_mav_put_uint8_t(buf, 26, altitude_type);
_mav_put_uint8_t(buf, 36, emitter_type);
_mav_put_uint8_t(buf, 37, tslc);
_mav_put_char_array(buf, 27, callsign, 9);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
#else
mavlink_adsb_vehicle_t *packet = (mavlink_adsb_vehicle_t *)msgbuf;
packet->ICAO_address = ICAO_address;
packet->lat = lat;
packet->lon = lon;
packet->altitude = altitude;
packet->heading = heading;
packet->hor_velocity = hor_velocity;
packet->ver_velocity = ver_velocity;
packet->flags = flags;
packet->squawk = squawk;
packet->altitude_type = altitude_type;
packet->emitter_type = emitter_type;
packet->tslc = tslc;
mav_array_memcpy(packet->callsign, callsign, sizeof(char)*9);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ADSB_VEHICLE UNPACKING
/**
* @brief Get field ICAO_address from adsb_vehicle message
*
* @return ICAO address
*/
static inline uint32_t mavlink_msg_adsb_vehicle_get_ICAO_address(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field lat from adsb_vehicle message
*
* @return Latitude, expressed as degrees * 1E7
*/
static inline int32_t mavlink_msg_adsb_vehicle_get_lat(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 4);
}
/**
* @brief Get field lon from adsb_vehicle message
*
* @return Longitude, expressed as degrees * 1E7
*/
static inline int32_t mavlink_msg_adsb_vehicle_get_lon(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Get field altitude_type from adsb_vehicle message
*
* @return Type from ADSB_ALTITUDE_TYPE enum
*/
static inline uint8_t mavlink_msg_adsb_vehicle_get_altitude_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 26);
}
/**
* @brief Get field altitude from adsb_vehicle message
*
* @return Altitude(ASL) in millimeters
*/
static inline int32_t mavlink_msg_adsb_vehicle_get_altitude(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 12);
}
/**
* @brief Get field heading from adsb_vehicle message
*
* @return Course over ground in centidegrees
*/
static inline uint16_t mavlink_msg_adsb_vehicle_get_heading(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 16);
}
/**
* @brief Get field hor_velocity from adsb_vehicle message
*
* @return The horizontal velocity in centimeters/second
*/
static inline uint16_t mavlink_msg_adsb_vehicle_get_hor_velocity(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 18);
}
/**
* @brief Get field ver_velocity from adsb_vehicle message
*
* @return The vertical velocity in centimeters/second, positive is up
*/
static inline int16_t mavlink_msg_adsb_vehicle_get_ver_velocity(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 20);
}
/**
* @brief Get field callsign from adsb_vehicle message
*
* @return The callsign, 8+null
*/
static inline uint16_t mavlink_msg_adsb_vehicle_get_callsign(const mavlink_message_t* msg, char *callsign)
{
return _MAV_RETURN_char_array(msg, callsign, 9, 27);
}
/**
* @brief Get field emitter_type from adsb_vehicle message
*
* @return Type from ADSB_EMITTER_TYPE enum
*/
static inline uint8_t mavlink_msg_adsb_vehicle_get_emitter_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 36);
}
/**
* @brief Get field tslc from adsb_vehicle message
*
* @return Time since last communication in seconds
*/
static inline uint8_t mavlink_msg_adsb_vehicle_get_tslc(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 37);
}
/**
* @brief Get field flags from adsb_vehicle message
*
* @return Flags to indicate various statuses including valid data fields
*/
static inline uint16_t mavlink_msg_adsb_vehicle_get_flags(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 22);
}
/**
* @brief Get field squawk from adsb_vehicle message
*
* @return Squawk code
*/
static inline uint16_t mavlink_msg_adsb_vehicle_get_squawk(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 24);
}
/**
* @brief Decode a adsb_vehicle message into a struct
*
* @param msg The message to decode
* @param adsb_vehicle C-struct to decode the message contents into
*/
static inline void mavlink_msg_adsb_vehicle_decode(const mavlink_message_t* msg, mavlink_adsb_vehicle_t* adsb_vehicle)
{
#if MAVLINK_NEED_BYTE_SWAP
adsb_vehicle->ICAO_address = mavlink_msg_adsb_vehicle_get_ICAO_address(msg);
adsb_vehicle->lat = mavlink_msg_adsb_vehicle_get_lat(msg);
adsb_vehicle->lon = mavlink_msg_adsb_vehicle_get_lon(msg);
adsb_vehicle->altitude = mavlink_msg_adsb_vehicle_get_altitude(msg);
adsb_vehicle->heading = mavlink_msg_adsb_vehicle_get_heading(msg);
adsb_vehicle->hor_velocity = mavlink_msg_adsb_vehicle_get_hor_velocity(msg);
adsb_vehicle->ver_velocity = mavlink_msg_adsb_vehicle_get_ver_velocity(msg);
adsb_vehicle->flags = mavlink_msg_adsb_vehicle_get_flags(msg);
adsb_vehicle->squawk = mavlink_msg_adsb_vehicle_get_squawk(msg);
adsb_vehicle->altitude_type = mavlink_msg_adsb_vehicle_get_altitude_type(msg);
mavlink_msg_adsb_vehicle_get_callsign(msg, adsb_vehicle->callsign);
adsb_vehicle->emitter_type = mavlink_msg_adsb_vehicle_get_emitter_type(msg);
adsb_vehicle->tslc = mavlink_msg_adsb_vehicle_get_tslc(msg);
#else
memcpy(adsb_vehicle, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
#endif
}

View File

@ -0,0 +1,353 @@
// MESSAGE ALTITUDE PACKING
#define MAVLINK_MSG_ID_ALTITUDE 141
typedef struct __mavlink_altitude_t
{
uint64_t time_usec; /*< Timestamp (milliseconds since system boot)*/
float altitude_monotonic; /*< This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights.*/
float altitude_amsl; /*< This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output AMSL by default and not the WGS84 altitude.*/
float altitude_local; /*< This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive.*/
float altitude_relative; /*< This is the altitude above the home position. It resets on each change of the current home position.*/
float altitude_terrain; /*< This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown.*/
float bottom_clearance; /*< This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available.*/
} mavlink_altitude_t;
#define MAVLINK_MSG_ID_ALTITUDE_LEN 32
#define MAVLINK_MSG_ID_141_LEN 32
#define MAVLINK_MSG_ID_ALTITUDE_CRC 47
#define MAVLINK_MSG_ID_141_CRC 47
#define MAVLINK_MESSAGE_INFO_ALTITUDE { \
"ALTITUDE", \
7, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_altitude_t, time_usec) }, \
{ "altitude_monotonic", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_altitude_t, altitude_monotonic) }, \
{ "altitude_amsl", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_altitude_t, altitude_amsl) }, \
{ "altitude_local", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_altitude_t, altitude_local) }, \
{ "altitude_relative", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_altitude_t, altitude_relative) }, \
{ "altitude_terrain", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_altitude_t, altitude_terrain) }, \
{ "bottom_clearance", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_altitude_t, bottom_clearance) }, \
} \
}
/**
* @brief Pack a altitude message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (milliseconds since system boot)
* @param altitude_monotonic This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights.
* @param altitude_amsl This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output AMSL by default and not the WGS84 altitude.
* @param altitude_local This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive.
* @param altitude_relative This is the altitude above the home position. It resets on each change of the current home position.
* @param altitude_terrain This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown.
* @param bottom_clearance This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_altitude_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, float altitude_monotonic, float altitude_amsl, float altitude_local, float altitude_relative, float altitude_terrain, float bottom_clearance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ALTITUDE_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, altitude_monotonic);
_mav_put_float(buf, 12, altitude_amsl);
_mav_put_float(buf, 16, altitude_local);
_mav_put_float(buf, 20, altitude_relative);
_mav_put_float(buf, 24, altitude_terrain);
_mav_put_float(buf, 28, bottom_clearance);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ALTITUDE_LEN);
#else
mavlink_altitude_t packet;
packet.time_usec = time_usec;
packet.altitude_monotonic = altitude_monotonic;
packet.altitude_amsl = altitude_amsl;
packet.altitude_local = altitude_local;
packet.altitude_relative = altitude_relative;
packet.altitude_terrain = altitude_terrain;
packet.bottom_clearance = bottom_clearance;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ALTITUDE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ALTITUDE_LEN, MAVLINK_MSG_ID_ALTITUDE_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
}
/**
* @brief Pack a altitude message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (milliseconds since system boot)
* @param altitude_monotonic This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights.
* @param altitude_amsl This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output AMSL by default and not the WGS84 altitude.
* @param altitude_local This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive.
* @param altitude_relative This is the altitude above the home position. It resets on each change of the current home position.
* @param altitude_terrain This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown.
* @param bottom_clearance This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_altitude_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,float altitude_monotonic,float altitude_amsl,float altitude_local,float altitude_relative,float altitude_terrain,float bottom_clearance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ALTITUDE_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, altitude_monotonic);
_mav_put_float(buf, 12, altitude_amsl);
_mav_put_float(buf, 16, altitude_local);
_mav_put_float(buf, 20, altitude_relative);
_mav_put_float(buf, 24, altitude_terrain);
_mav_put_float(buf, 28, bottom_clearance);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ALTITUDE_LEN);
#else
mavlink_altitude_t packet;
packet.time_usec = time_usec;
packet.altitude_monotonic = altitude_monotonic;
packet.altitude_amsl = altitude_amsl;
packet.altitude_local = altitude_local;
packet.altitude_relative = altitude_relative;
packet.altitude_terrain = altitude_terrain;
packet.bottom_clearance = bottom_clearance;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ALTITUDE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ALTITUDE_LEN, MAVLINK_MSG_ID_ALTITUDE_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
}
/**
* @brief Encode a altitude struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param altitude C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_altitude_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_altitude_t* altitude)
{
return mavlink_msg_altitude_pack(system_id, component_id, msg, altitude->time_usec, altitude->altitude_monotonic, altitude->altitude_amsl, altitude->altitude_local, altitude->altitude_relative, altitude->altitude_terrain, altitude->bottom_clearance);
}
/**
* @brief Encode a altitude struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param altitude C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_altitude_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_altitude_t* altitude)
{
return mavlink_msg_altitude_pack_chan(system_id, component_id, chan, msg, altitude->time_usec, altitude->altitude_monotonic, altitude->altitude_amsl, altitude->altitude_local, altitude->altitude_relative, altitude->altitude_terrain, altitude->bottom_clearance);
}
/**
* @brief Send a altitude message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (milliseconds since system boot)
* @param altitude_monotonic This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights.
* @param altitude_amsl This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output AMSL by default and not the WGS84 altitude.
* @param altitude_local This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive.
* @param altitude_relative This is the altitude above the home position. It resets on each change of the current home position.
* @param altitude_terrain This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown.
* @param bottom_clearance This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_altitude_send(mavlink_channel_t chan, uint64_t time_usec, float altitude_monotonic, float altitude_amsl, float altitude_local, float altitude_relative, float altitude_terrain, float bottom_clearance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ALTITUDE_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, altitude_monotonic);
_mav_put_float(buf, 12, altitude_amsl);
_mav_put_float(buf, 16, altitude_local);
_mav_put_float(buf, 20, altitude_relative);
_mav_put_float(buf, 24, altitude_terrain);
_mav_put_float(buf, 28, bottom_clearance);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDE, buf, MAVLINK_MSG_ID_ALTITUDE_LEN, MAVLINK_MSG_ID_ALTITUDE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDE, buf, MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
#else
mavlink_altitude_t packet;
packet.time_usec = time_usec;
packet.altitude_monotonic = altitude_monotonic;
packet.altitude_amsl = altitude_amsl;
packet.altitude_local = altitude_local;
packet.altitude_relative = altitude_relative;
packet.altitude_terrain = altitude_terrain;
packet.bottom_clearance = bottom_clearance;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDE, (const char *)&packet, MAVLINK_MSG_ID_ALTITUDE_LEN, MAVLINK_MSG_ID_ALTITUDE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDE, (const char *)&packet, MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ALTITUDE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_altitude_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float altitude_monotonic, float altitude_amsl, float altitude_local, float altitude_relative, float altitude_terrain, float bottom_clearance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, altitude_monotonic);
_mav_put_float(buf, 12, altitude_amsl);
_mav_put_float(buf, 16, altitude_local);
_mav_put_float(buf, 20, altitude_relative);
_mav_put_float(buf, 24, altitude_terrain);
_mav_put_float(buf, 28, bottom_clearance);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDE, buf, MAVLINK_MSG_ID_ALTITUDE_LEN, MAVLINK_MSG_ID_ALTITUDE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDE, buf, MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
#else
mavlink_altitude_t *packet = (mavlink_altitude_t *)msgbuf;
packet->time_usec = time_usec;
packet->altitude_monotonic = altitude_monotonic;
packet->altitude_amsl = altitude_amsl;
packet->altitude_local = altitude_local;
packet->altitude_relative = altitude_relative;
packet->altitude_terrain = altitude_terrain;
packet->bottom_clearance = bottom_clearance;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDE, (const char *)packet, MAVLINK_MSG_ID_ALTITUDE_LEN, MAVLINK_MSG_ID_ALTITUDE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ALTITUDE, (const char *)packet, MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ALTITUDE UNPACKING
/**
* @brief Get field time_usec from altitude message
*
* @return Timestamp (milliseconds since system boot)
*/
static inline uint64_t mavlink_msg_altitude_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field altitude_monotonic from altitude message
*
* @return This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights.
*/
static inline float mavlink_msg_altitude_get_altitude_monotonic(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field altitude_amsl from altitude message
*
* @return This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output AMSL by default and not the WGS84 altitude.
*/
static inline float mavlink_msg_altitude_get_altitude_amsl(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field altitude_local from altitude message
*
* @return This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive.
*/
static inline float mavlink_msg_altitude_get_altitude_local(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field altitude_relative from altitude message
*
* @return This is the altitude above the home position. It resets on each change of the current home position.
*/
static inline float mavlink_msg_altitude_get_altitude_relative(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field altitude_terrain from altitude message
*
* @return This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown.
*/
static inline float mavlink_msg_altitude_get_altitude_terrain(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field bottom_clearance from altitude message
*
* @return This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available.
*/
static inline float mavlink_msg_altitude_get_bottom_clearance(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Decode a altitude message into a struct
*
* @param msg The message to decode
* @param altitude C-struct to decode the message contents into
*/
static inline void mavlink_msg_altitude_decode(const mavlink_message_t* msg, mavlink_altitude_t* altitude)
{
#if MAVLINK_NEED_BYTE_SWAP
altitude->time_usec = mavlink_msg_altitude_get_time_usec(msg);
altitude->altitude_monotonic = mavlink_msg_altitude_get_altitude_monotonic(msg);
altitude->altitude_amsl = mavlink_msg_altitude_get_altitude_amsl(msg);
altitude->altitude_local = mavlink_msg_altitude_get_altitude_local(msg);
altitude->altitude_relative = mavlink_msg_altitude_get_altitude_relative(msg);
altitude->altitude_terrain = mavlink_msg_altitude_get_altitude_terrain(msg);
altitude->bottom_clearance = mavlink_msg_altitude_get_bottom_clearance(msg);
#else
memcpy(altitude, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ALTITUDE_LEN);
#endif
}

View File

@ -0,0 +1,297 @@
// MESSAGE ATT_POS_MOCAP PACKING
#define MAVLINK_MSG_ID_ATT_POS_MOCAP 138
typedef struct __mavlink_att_pos_mocap_t
{
uint64_t time_usec; /*< Timestamp (micros since boot or Unix epoch)*/
float q[4]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/
float x; /*< X position in meters (NED)*/
float y; /*< Y position in meters (NED)*/
float z; /*< Z position in meters (NED)*/
} mavlink_att_pos_mocap_t;
#define MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN 36
#define MAVLINK_MSG_ID_138_LEN 36
#define MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC 109
#define MAVLINK_MSG_ID_138_CRC 109
#define MAVLINK_MSG_ATT_POS_MOCAP_FIELD_Q_LEN 4
#define MAVLINK_MESSAGE_INFO_ATT_POS_MOCAP { \
"ATT_POS_MOCAP", \
5, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_att_pos_mocap_t, time_usec) }, \
{ "q", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_att_pos_mocap_t, q) }, \
{ "x", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_att_pos_mocap_t, x) }, \
{ "y", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_att_pos_mocap_t, y) }, \
{ "z", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_att_pos_mocap_t, z) }, \
} \
}
/**
* @brief Pack a att_pos_mocap message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
* @param x X position in meters (NED)
* @param y Y position in meters (NED)
* @param z Z position in meters (NED)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_att_pos_mocap_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, const float *q, float x, float y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 24, x);
_mav_put_float(buf, 28, y);
_mav_put_float(buf, 32, z);
_mav_put_float_array(buf, 8, q, 4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#else
mavlink_att_pos_mocap_t packet;
packet.time_usec = time_usec;
packet.x = x;
packet.y = y;
packet.z = z;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
}
/**
* @brief Pack a att_pos_mocap message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
* @param x X position in meters (NED)
* @param y Y position in meters (NED)
* @param z Z position in meters (NED)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_att_pos_mocap_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,const float *q,float x,float y,float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 24, x);
_mav_put_float(buf, 28, y);
_mav_put_float(buf, 32, z);
_mav_put_float_array(buf, 8, q, 4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#else
mavlink_att_pos_mocap_t packet;
packet.time_usec = time_usec;
packet.x = x;
packet.y = y;
packet.z = z;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
}
/**
* @brief Encode a att_pos_mocap struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param att_pos_mocap C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_att_pos_mocap_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_att_pos_mocap_t* att_pos_mocap)
{
return mavlink_msg_att_pos_mocap_pack(system_id, component_id, msg, att_pos_mocap->time_usec, att_pos_mocap->q, att_pos_mocap->x, att_pos_mocap->y, att_pos_mocap->z);
}
/**
* @brief Encode a att_pos_mocap struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param att_pos_mocap C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_att_pos_mocap_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_att_pos_mocap_t* att_pos_mocap)
{
return mavlink_msg_att_pos_mocap_pack_chan(system_id, component_id, chan, msg, att_pos_mocap->time_usec, att_pos_mocap->q, att_pos_mocap->x, att_pos_mocap->y, att_pos_mocap->z);
}
/**
* @brief Send a att_pos_mocap message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
* @param x X position in meters (NED)
* @param y Y position in meters (NED)
* @param z Z position in meters (NED)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_att_pos_mocap_send(mavlink_channel_t chan, uint64_t time_usec, const float *q, float x, float y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 24, x);
_mav_put_float(buf, 28, y);
_mav_put_float(buf, 32, z);
_mav_put_float_array(buf, 8, q, 4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
#else
mavlink_att_pos_mocap_t packet;
packet.time_usec = time_usec;
packet.x = x;
packet.y = y;
packet.z = z;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)&packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)&packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_att_pos_mocap_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, const float *q, float x, float y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 24, x);
_mav_put_float(buf, 28, y);
_mav_put_float(buf, 32, z);
_mav_put_float_array(buf, 8, q, 4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, buf, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
#else
mavlink_att_pos_mocap_t *packet = (mavlink_att_pos_mocap_t *)msgbuf;
packet->time_usec = time_usec;
packet->x = x;
packet->y = y;
packet->z = z;
mav_array_memcpy(packet->q, q, sizeof(float)*4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN, MAVLINK_MSG_ID_ATT_POS_MOCAP_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATT_POS_MOCAP, (const char *)packet, MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ATT_POS_MOCAP UNPACKING
/**
* @brief Get field time_usec from att_pos_mocap message
*
* @return Timestamp (micros since boot or Unix epoch)
*/
static inline uint64_t mavlink_msg_att_pos_mocap_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field q from att_pos_mocap message
*
* @return Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
*/
static inline uint16_t mavlink_msg_att_pos_mocap_get_q(const mavlink_message_t* msg, float *q)
{
return _MAV_RETURN_float_array(msg, q, 4, 8);
}
/**
* @brief Get field x from att_pos_mocap message
*
* @return X position in meters (NED)
*/
static inline float mavlink_msg_att_pos_mocap_get_x(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field y from att_pos_mocap message
*
* @return Y position in meters (NED)
*/
static inline float mavlink_msg_att_pos_mocap_get_y(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field z from att_pos_mocap message
*
* @return Z position in meters (NED)
*/
static inline float mavlink_msg_att_pos_mocap_get_z(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 32);
}
/**
* @brief Decode a att_pos_mocap message into a struct
*
* @param msg The message to decode
* @param att_pos_mocap C-struct to decode the message contents into
*/
static inline void mavlink_msg_att_pos_mocap_decode(const mavlink_message_t* msg, mavlink_att_pos_mocap_t* att_pos_mocap)
{
#if MAVLINK_NEED_BYTE_SWAP
att_pos_mocap->time_usec = mavlink_msg_att_pos_mocap_get_time_usec(msg);
mavlink_msg_att_pos_mocap_get_q(msg, att_pos_mocap->q);
att_pos_mocap->x = mavlink_msg_att_pos_mocap_get_x(msg);
att_pos_mocap->y = mavlink_msg_att_pos_mocap_get_y(msg);
att_pos_mocap->z = mavlink_msg_att_pos_mocap_get_z(msg);
#else
memcpy(att_pos_mocap, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ATT_POS_MOCAP_LEN);
#endif
}

View File

@ -0,0 +1,353 @@
// MESSAGE ATTITUDE PACKING
#define MAVLINK_MSG_ID_ATTITUDE 30
typedef struct __mavlink_attitude_t
{
uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
float roll; /*< Roll angle (rad, -pi..+pi)*/
float pitch; /*< Pitch angle (rad, -pi..+pi)*/
float yaw; /*< Yaw angle (rad, -pi..+pi)*/
float rollspeed; /*< Roll angular speed (rad/s)*/
float pitchspeed; /*< Pitch angular speed (rad/s)*/
float yawspeed; /*< Yaw angular speed (rad/s)*/
} mavlink_attitude_t;
#define MAVLINK_MSG_ID_ATTITUDE_LEN 28
#define MAVLINK_MSG_ID_30_LEN 28
#define MAVLINK_MSG_ID_ATTITUDE_CRC 39
#define MAVLINK_MSG_ID_30_CRC 39
#define MAVLINK_MESSAGE_INFO_ATTITUDE { \
"ATTITUDE", \
7, \
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_t, time_boot_ms) }, \
{ "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_attitude_t, roll) }, \
{ "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_attitude_t, pitch) }, \
{ "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_attitude_t, yaw) }, \
{ "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_attitude_t, rollspeed) }, \
{ "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_t, pitchspeed) }, \
{ "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_t, yawspeed) }, \
} \
}
/**
* @brief Pack a attitude message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param roll Roll angle (rad, -pi..+pi)
* @param pitch Pitch angle (rad, -pi..+pi)
* @param yaw Yaw angle (rad, -pi..+pi)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_attitude_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_boot_ms, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, roll);
_mav_put_float(buf, 8, pitch);
_mav_put_float(buf, 12, yaw);
_mav_put_float(buf, 16, rollspeed);
_mav_put_float(buf, 20, pitchspeed);
_mav_put_float(buf, 24, yawspeed);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_LEN);
#else
mavlink_attitude_t packet;
packet.time_boot_ms = time_boot_ms;
packet.roll = roll;
packet.pitch = pitch;
packet.yaw = yaw;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATTITUDE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_LEN, MAVLINK_MSG_ID_ATTITUDE_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
}
/**
* @brief Pack a attitude message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param roll Roll angle (rad, -pi..+pi)
* @param pitch Pitch angle (rad, -pi..+pi)
* @param yaw Yaw angle (rad, -pi..+pi)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_attitude_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_boot_ms,float roll,float pitch,float yaw,float rollspeed,float pitchspeed,float yawspeed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, roll);
_mav_put_float(buf, 8, pitch);
_mav_put_float(buf, 12, yaw);
_mav_put_float(buf, 16, rollspeed);
_mav_put_float(buf, 20, pitchspeed);
_mav_put_float(buf, 24, yawspeed);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_LEN);
#else
mavlink_attitude_t packet;
packet.time_boot_ms = time_boot_ms;
packet.roll = roll;
packet.pitch = pitch;
packet.yaw = yaw;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATTITUDE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_LEN, MAVLINK_MSG_ID_ATTITUDE_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
}
/**
* @brief Encode a attitude struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param attitude C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_attitude_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_t* attitude)
{
return mavlink_msg_attitude_pack(system_id, component_id, msg, attitude->time_boot_ms, attitude->roll, attitude->pitch, attitude->yaw, attitude->rollspeed, attitude->pitchspeed, attitude->yawspeed);
}
/**
* @brief Encode a attitude struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param attitude C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_attitude_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_t* attitude)
{
return mavlink_msg_attitude_pack_chan(system_id, component_id, chan, msg, attitude->time_boot_ms, attitude->roll, attitude->pitch, attitude->yaw, attitude->rollspeed, attitude->pitchspeed, attitude->yawspeed);
}
/**
* @brief Send a attitude message
* @param chan MAVLink channel to send the message
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param roll Roll angle (rad, -pi..+pi)
* @param pitch Pitch angle (rad, -pi..+pi)
* @param yaw Yaw angle (rad, -pi..+pi)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_attitude_send(mavlink_channel_t chan, uint32_t time_boot_ms, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, roll);
_mav_put_float(buf, 8, pitch);
_mav_put_float(buf, 12, yaw);
_mav_put_float(buf, 16, rollspeed);
_mav_put_float(buf, 20, pitchspeed);
_mav_put_float(buf, 24, yawspeed);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, buf, MAVLINK_MSG_ID_ATTITUDE_LEN, MAVLINK_MSG_ID_ATTITUDE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, buf, MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
#else
mavlink_attitude_t packet;
packet.time_boot_ms = time_boot_ms;
packet.roll = roll;
packet.pitch = pitch;
packet.yaw = yaw;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_LEN, MAVLINK_MSG_ID_ATTITUDE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ATTITUDE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_attitude_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, roll);
_mav_put_float(buf, 8, pitch);
_mav_put_float(buf, 12, yaw);
_mav_put_float(buf, 16, rollspeed);
_mav_put_float(buf, 20, pitchspeed);
_mav_put_float(buf, 24, yawspeed);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, buf, MAVLINK_MSG_ID_ATTITUDE_LEN, MAVLINK_MSG_ID_ATTITUDE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, buf, MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
#else
mavlink_attitude_t *packet = (mavlink_attitude_t *)msgbuf;
packet->time_boot_ms = time_boot_ms;
packet->roll = roll;
packet->pitch = pitch;
packet->yaw = yaw;
packet->rollspeed = rollspeed;
packet->pitchspeed = pitchspeed;
packet->yawspeed = yawspeed;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_LEN, MAVLINK_MSG_ID_ATTITUDE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ATTITUDE UNPACKING
/**
* @brief Get field time_boot_ms from attitude message
*
* @return Timestamp (milliseconds since system boot)
*/
static inline uint32_t mavlink_msg_attitude_get_time_boot_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field roll from attitude message
*
* @return Roll angle (rad, -pi..+pi)
*/
static inline float mavlink_msg_attitude_get_roll(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 4);
}
/**
* @brief Get field pitch from attitude message
*
* @return Pitch angle (rad, -pi..+pi)
*/
static inline float mavlink_msg_attitude_get_pitch(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field yaw from attitude message
*
* @return Yaw angle (rad, -pi..+pi)
*/
static inline float mavlink_msg_attitude_get_yaw(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field rollspeed from attitude message
*
* @return Roll angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_get_rollspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field pitchspeed from attitude message
*
* @return Pitch angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_get_pitchspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field yawspeed from attitude message
*
* @return Yaw angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_get_yawspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Decode a attitude message into a struct
*
* @param msg The message to decode
* @param attitude C-struct to decode the message contents into
*/
static inline void mavlink_msg_attitude_decode(const mavlink_message_t* msg, mavlink_attitude_t* attitude)
{
#if MAVLINK_NEED_BYTE_SWAP
attitude->time_boot_ms = mavlink_msg_attitude_get_time_boot_ms(msg);
attitude->roll = mavlink_msg_attitude_get_roll(msg);
attitude->pitch = mavlink_msg_attitude_get_pitch(msg);
attitude->yaw = mavlink_msg_attitude_get_yaw(msg);
attitude->rollspeed = mavlink_msg_attitude_get_rollspeed(msg);
attitude->pitchspeed = mavlink_msg_attitude_get_pitchspeed(msg);
attitude->yawspeed = mavlink_msg_attitude_get_yawspeed(msg);
#else
memcpy(attitude, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ATTITUDE_LEN);
#endif
}

View File

@ -0,0 +1,377 @@
// MESSAGE ATTITUDE_QUATERNION PACKING
#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION 31
typedef struct __mavlink_attitude_quaternion_t
{
uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
float q1; /*< Quaternion component 1, w (1 in null-rotation)*/
float q2; /*< Quaternion component 2, x (0 in null-rotation)*/
float q3; /*< Quaternion component 3, y (0 in null-rotation)*/
float q4; /*< Quaternion component 4, z (0 in null-rotation)*/
float rollspeed; /*< Roll angular speed (rad/s)*/
float pitchspeed; /*< Pitch angular speed (rad/s)*/
float yawspeed; /*< Yaw angular speed (rad/s)*/
} mavlink_attitude_quaternion_t;
#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN 32
#define MAVLINK_MSG_ID_31_LEN 32
#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC 246
#define MAVLINK_MSG_ID_31_CRC 246
#define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION { \
"ATTITUDE_QUATERNION", \
8, \
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_quaternion_t, time_boot_ms) }, \
{ "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_attitude_quaternion_t, q1) }, \
{ "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_attitude_quaternion_t, q2) }, \
{ "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_attitude_quaternion_t, q3) }, \
{ "q4", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_attitude_quaternion_t, q4) }, \
{ "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_quaternion_t, rollspeed) }, \
{ "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_quaternion_t, pitchspeed) }, \
{ "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_quaternion_t, yawspeed) }, \
} \
}
/**
* @brief Pack a attitude_quaternion message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param q1 Quaternion component 1, w (1 in null-rotation)
* @param q2 Quaternion component 2, x (0 in null-rotation)
* @param q3 Quaternion component 3, y (0 in null-rotation)
* @param q4 Quaternion component 4, z (0 in null-rotation)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_attitude_quaternion_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_boot_ms, float q1, float q2, float q3, float q4, float rollspeed, float pitchspeed, float yawspeed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, q1);
_mav_put_float(buf, 8, q2);
_mav_put_float(buf, 12, q3);
_mav_put_float(buf, 16, q4);
_mav_put_float(buf, 20, rollspeed);
_mav_put_float(buf, 24, pitchspeed);
_mav_put_float(buf, 28, yawspeed);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#else
mavlink_attitude_quaternion_t packet;
packet.time_boot_ms = time_boot_ms;
packet.q1 = q1;
packet.q2 = q2;
packet.q3 = q3;
packet.q4 = q4;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
}
/**
* @brief Pack a attitude_quaternion message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param q1 Quaternion component 1, w (1 in null-rotation)
* @param q2 Quaternion component 2, x (0 in null-rotation)
* @param q3 Quaternion component 3, y (0 in null-rotation)
* @param q4 Quaternion component 4, z (0 in null-rotation)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_attitude_quaternion_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_boot_ms,float q1,float q2,float q3,float q4,float rollspeed,float pitchspeed,float yawspeed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, q1);
_mav_put_float(buf, 8, q2);
_mav_put_float(buf, 12, q3);
_mav_put_float(buf, 16, q4);
_mav_put_float(buf, 20, rollspeed);
_mav_put_float(buf, 24, pitchspeed);
_mav_put_float(buf, 28, yawspeed);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#else
mavlink_attitude_quaternion_t packet;
packet.time_boot_ms = time_boot_ms;
packet.q1 = q1;
packet.q2 = q2;
packet.q3 = q3;
packet.q4 = q4;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
}
/**
* @brief Encode a attitude_quaternion struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param attitude_quaternion C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_attitude_quaternion_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_quaternion_t* attitude_quaternion)
{
return mavlink_msg_attitude_quaternion_pack(system_id, component_id, msg, attitude_quaternion->time_boot_ms, attitude_quaternion->q1, attitude_quaternion->q2, attitude_quaternion->q3, attitude_quaternion->q4, attitude_quaternion->rollspeed, attitude_quaternion->pitchspeed, attitude_quaternion->yawspeed);
}
/**
* @brief Encode a attitude_quaternion struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param attitude_quaternion C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_attitude_quaternion_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_quaternion_t* attitude_quaternion)
{
return mavlink_msg_attitude_quaternion_pack_chan(system_id, component_id, chan, msg, attitude_quaternion->time_boot_ms, attitude_quaternion->q1, attitude_quaternion->q2, attitude_quaternion->q3, attitude_quaternion->q4, attitude_quaternion->rollspeed, attitude_quaternion->pitchspeed, attitude_quaternion->yawspeed);
}
/**
* @brief Send a attitude_quaternion message
* @param chan MAVLink channel to send the message
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param q1 Quaternion component 1, w (1 in null-rotation)
* @param q2 Quaternion component 2, x (0 in null-rotation)
* @param q3 Quaternion component 3, y (0 in null-rotation)
* @param q4 Quaternion component 4, z (0 in null-rotation)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_attitude_quaternion_send(mavlink_channel_t chan, uint32_t time_boot_ms, float q1, float q2, float q3, float q4, float rollspeed, float pitchspeed, float yawspeed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, q1);
_mav_put_float(buf, 8, q2);
_mav_put_float(buf, 12, q3);
_mav_put_float(buf, 16, q4);
_mav_put_float(buf, 20, rollspeed);
_mav_put_float(buf, 24, pitchspeed);
_mav_put_float(buf, 28, yawspeed);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
#else
mavlink_attitude_quaternion_t packet;
packet.time_boot_ms = time_boot_ms;
packet.q1 = q1;
packet.q2 = q2;
packet.q3 = q3;
packet.q4 = q4;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_attitude_quaternion_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, float q1, float q2, float q3, float q4, float rollspeed, float pitchspeed, float yawspeed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, q1);
_mav_put_float(buf, 8, q2);
_mav_put_float(buf, 12, q3);
_mav_put_float(buf, 16, q4);
_mav_put_float(buf, 20, rollspeed);
_mav_put_float(buf, 24, pitchspeed);
_mav_put_float(buf, 28, yawspeed);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
#else
mavlink_attitude_quaternion_t *packet = (mavlink_attitude_quaternion_t *)msgbuf;
packet->time_boot_ms = time_boot_ms;
packet->q1 = q1;
packet->q2 = q2;
packet->q3 = q3;
packet->q4 = q4;
packet->rollspeed = rollspeed;
packet->pitchspeed = pitchspeed;
packet->yawspeed = yawspeed;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ATTITUDE_QUATERNION UNPACKING
/**
* @brief Get field time_boot_ms from attitude_quaternion message
*
* @return Timestamp (milliseconds since system boot)
*/
static inline uint32_t mavlink_msg_attitude_quaternion_get_time_boot_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field q1 from attitude_quaternion message
*
* @return Quaternion component 1, w (1 in null-rotation)
*/
static inline float mavlink_msg_attitude_quaternion_get_q1(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 4);
}
/**
* @brief Get field q2 from attitude_quaternion message
*
* @return Quaternion component 2, x (0 in null-rotation)
*/
static inline float mavlink_msg_attitude_quaternion_get_q2(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field q3 from attitude_quaternion message
*
* @return Quaternion component 3, y (0 in null-rotation)
*/
static inline float mavlink_msg_attitude_quaternion_get_q3(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field q4 from attitude_quaternion message
*
* @return Quaternion component 4, z (0 in null-rotation)
*/
static inline float mavlink_msg_attitude_quaternion_get_q4(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field rollspeed from attitude_quaternion message
*
* @return Roll angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_quaternion_get_rollspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field pitchspeed from attitude_quaternion message
*
* @return Pitch angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_quaternion_get_pitchspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field yawspeed from attitude_quaternion message
*
* @return Yaw angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_quaternion_get_yawspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Decode a attitude_quaternion message into a struct
*
* @param msg The message to decode
* @param attitude_quaternion C-struct to decode the message contents into
*/
static inline void mavlink_msg_attitude_quaternion_decode(const mavlink_message_t* msg, mavlink_attitude_quaternion_t* attitude_quaternion)
{
#if MAVLINK_NEED_BYTE_SWAP
attitude_quaternion->time_boot_ms = mavlink_msg_attitude_quaternion_get_time_boot_ms(msg);
attitude_quaternion->q1 = mavlink_msg_attitude_quaternion_get_q1(msg);
attitude_quaternion->q2 = mavlink_msg_attitude_quaternion_get_q2(msg);
attitude_quaternion->q3 = mavlink_msg_attitude_quaternion_get_q3(msg);
attitude_quaternion->q4 = mavlink_msg_attitude_quaternion_get_q4(msg);
attitude_quaternion->rollspeed = mavlink_msg_attitude_quaternion_get_rollspeed(msg);
attitude_quaternion->pitchspeed = mavlink_msg_attitude_quaternion_get_pitchspeed(msg);
attitude_quaternion->yawspeed = mavlink_msg_attitude_quaternion_get_yawspeed(msg);
#else
memcpy(attitude_quaternion, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
#endif
}

View File

@ -0,0 +1,322 @@
// MESSAGE ATTITUDE_QUATERNION_COV PACKING
#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV 61
typedef struct __mavlink_attitude_quaternion_cov_t
{
uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)*/
float rollspeed; /*< Roll angular speed (rad/s)*/
float pitchspeed; /*< Pitch angular speed (rad/s)*/
float yawspeed; /*< Yaw angular speed (rad/s)*/
float covariance[9]; /*< Attitude covariance*/
} mavlink_attitude_quaternion_cov_t;
#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN 68
#define MAVLINK_MSG_ID_61_LEN 68
#define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC 153
#define MAVLINK_MSG_ID_61_CRC 153
#define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_Q_LEN 4
#define MAVLINK_MSG_ATTITUDE_QUATERNION_COV_FIELD_COVARIANCE_LEN 9
#define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION_COV { \
"ATTITUDE_QUATERNION_COV", \
6, \
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_quaternion_cov_t, time_boot_ms) }, \
{ "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_attitude_quaternion_cov_t, q) }, \
{ "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_quaternion_cov_t, rollspeed) }, \
{ "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_quaternion_cov_t, pitchspeed) }, \
{ "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_quaternion_cov_t, yawspeed) }, \
{ "covariance", NULL, MAVLINK_TYPE_FLOAT, 9, 32, offsetof(mavlink_attitude_quaternion_cov_t, covariance) }, \
} \
}
/**
* @brief Pack a attitude_quaternion_cov message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
* @param covariance Attitude covariance
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_boot_ms, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 20, rollspeed);
_mav_put_float(buf, 24, pitchspeed);
_mav_put_float(buf, 28, yawspeed);
_mav_put_float_array(buf, 4, q, 4);
_mav_put_float_array(buf, 32, covariance, 9);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#else
mavlink_attitude_quaternion_cov_t packet;
packet.time_boot_ms = time_boot_ms;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
}
/**
* @brief Pack a attitude_quaternion_cov message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
* @param covariance Attitude covariance
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_attitude_quaternion_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_boot_ms,const float *q,float rollspeed,float pitchspeed,float yawspeed,const float *covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 20, rollspeed);
_mav_put_float(buf, 24, pitchspeed);
_mav_put_float(buf, 28, yawspeed);
_mav_put_float_array(buf, 4, q, 4);
_mav_put_float_array(buf, 32, covariance, 9);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#else
mavlink_attitude_quaternion_cov_t packet;
packet.time_boot_ms = time_boot_ms;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
}
/**
* @brief Encode a attitude_quaternion_cov struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param attitude_quaternion_cov C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
{
return mavlink_msg_attitude_quaternion_cov_pack(system_id, component_id, msg, attitude_quaternion_cov->time_boot_ms, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance);
}
/**
* @brief Encode a attitude_quaternion_cov struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param attitude_quaternion_cov C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_attitude_quaternion_cov_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
{
return mavlink_msg_attitude_quaternion_cov_pack_chan(system_id, component_id, chan, msg, attitude_quaternion_cov->time_boot_ms, attitude_quaternion_cov->q, attitude_quaternion_cov->rollspeed, attitude_quaternion_cov->pitchspeed, attitude_quaternion_cov->yawspeed, attitude_quaternion_cov->covariance);
}
/**
* @brief Send a attitude_quaternion_cov message
* @param chan MAVLink channel to send the message
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
* @param rollspeed Roll angular speed (rad/s)
* @param pitchspeed Pitch angular speed (rad/s)
* @param yawspeed Yaw angular speed (rad/s)
* @param covariance Attitude covariance
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_attitude_quaternion_cov_send(mavlink_channel_t chan, uint32_t time_boot_ms, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 20, rollspeed);
_mav_put_float(buf, 24, pitchspeed);
_mav_put_float(buf, 28, yawspeed);
_mav_put_float_array(buf, 4, q, 4);
_mav_put_float_array(buf, 32, covariance, 9);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
#else
mavlink_attitude_quaternion_cov_t packet;
packet.time_boot_ms = time_boot_ms;
packet.rollspeed = rollspeed;
packet.pitchspeed = pitchspeed;
packet.yawspeed = yawspeed;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
mav_array_memcpy(packet.covariance, covariance, sizeof(float)*9);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_attitude_quaternion_cov_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const float *q, float rollspeed, float pitchspeed, float yawspeed, const float *covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 20, rollspeed);
_mav_put_float(buf, 24, pitchspeed);
_mav_put_float(buf, 28, yawspeed);
_mav_put_float_array(buf, 4, q, 4);
_mav_put_float_array(buf, 32, covariance, 9);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
#else
mavlink_attitude_quaternion_cov_t *packet = (mavlink_attitude_quaternion_cov_t *)msgbuf;
packet->time_boot_ms = time_boot_ms;
packet->rollspeed = rollspeed;
packet->pitchspeed = pitchspeed;
packet->yawspeed = yawspeed;
mav_array_memcpy(packet->q, q, sizeof(float)*4);
mav_array_memcpy(packet->covariance, covariance, sizeof(float)*9);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ATTITUDE_QUATERNION_COV UNPACKING
/**
* @brief Get field time_boot_ms from attitude_quaternion_cov message
*
* @return Timestamp (milliseconds since system boot)
*/
static inline uint32_t mavlink_msg_attitude_quaternion_cov_get_time_boot_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field q from attitude_quaternion_cov message
*
* @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation)
*/
static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_q(const mavlink_message_t* msg, float *q)
{
return _MAV_RETURN_float_array(msg, q, 4, 4);
}
/**
* @brief Get field rollspeed from attitude_quaternion_cov message
*
* @return Roll angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_quaternion_cov_get_rollspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field pitchspeed from attitude_quaternion_cov message
*
* @return Pitch angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_quaternion_cov_get_pitchspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field yawspeed from attitude_quaternion_cov message
*
* @return Yaw angular speed (rad/s)
*/
static inline float mavlink_msg_attitude_quaternion_cov_get_yawspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field covariance from attitude_quaternion_cov message
*
* @return Attitude covariance
*/
static inline uint16_t mavlink_msg_attitude_quaternion_cov_get_covariance(const mavlink_message_t* msg, float *covariance)
{
return _MAV_RETURN_float_array(msg, covariance, 9, 32);
}
/**
* @brief Decode a attitude_quaternion_cov message into a struct
*
* @param msg The message to decode
* @param attitude_quaternion_cov C-struct to decode the message contents into
*/
static inline void mavlink_msg_attitude_quaternion_cov_decode(const mavlink_message_t* msg, mavlink_attitude_quaternion_cov_t* attitude_quaternion_cov)
{
#if MAVLINK_NEED_BYTE_SWAP
attitude_quaternion_cov->time_boot_ms = mavlink_msg_attitude_quaternion_cov_get_time_boot_ms(msg);
mavlink_msg_attitude_quaternion_cov_get_q(msg, attitude_quaternion_cov->q);
attitude_quaternion_cov->rollspeed = mavlink_msg_attitude_quaternion_cov_get_rollspeed(msg);
attitude_quaternion_cov->pitchspeed = mavlink_msg_attitude_quaternion_cov_get_pitchspeed(msg);
attitude_quaternion_cov->yawspeed = mavlink_msg_attitude_quaternion_cov_get_yawspeed(msg);
mavlink_msg_attitude_quaternion_cov_get_covariance(msg, attitude_quaternion_cov->covariance);
#else
memcpy(attitude_quaternion_cov, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_LEN);
#endif
}

View File

@ -0,0 +1,345 @@
// MESSAGE ATTITUDE_TARGET PACKING
#define MAVLINK_MSG_ID_ATTITUDE_TARGET 83
typedef struct __mavlink_attitude_target_t
{
uint32_t time_boot_ms; /*< Timestamp in milliseconds since system boot*/
float q[4]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/
float body_roll_rate; /*< Body roll rate in radians per second*/
float body_pitch_rate; /*< Body roll rate in radians per second*/
float body_yaw_rate; /*< Body roll rate in radians per second*/
float thrust; /*< Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)*/
uint8_t type_mask; /*< 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*/
} mavlink_attitude_target_t;
#define MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN 37
#define MAVLINK_MSG_ID_83_LEN 37
#define MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC 22
#define MAVLINK_MSG_ID_83_CRC 22
#define MAVLINK_MSG_ATTITUDE_TARGET_FIELD_Q_LEN 4
#define MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET { \
"ATTITUDE_TARGET", \
7, \
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_target_t, time_boot_ms) }, \
{ "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_attitude_target_t, q) }, \
{ "body_roll_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_target_t, body_roll_rate) }, \
{ "body_pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_target_t, body_pitch_rate) }, \
{ "body_yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_target_t, body_yaw_rate) }, \
{ "thrust", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_attitude_target_t, thrust) }, \
{ "type_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_attitude_target_t, type_mask) }, \
} \
}
/**
* @brief Pack a attitude_target message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_boot_ms Timestamp in milliseconds since system boot
* @param type_mask 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
* @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
* @param body_roll_rate Body roll rate in radians per second
* @param body_pitch_rate Body roll rate in radians per second
* @param body_yaw_rate Body roll rate in radians per second
* @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_attitude_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_boot_ms, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 20, body_roll_rate);
_mav_put_float(buf, 24, body_pitch_rate);
_mav_put_float(buf, 28, body_yaw_rate);
_mav_put_float(buf, 32, thrust);
_mav_put_uint8_t(buf, 36, type_mask);
_mav_put_float_array(buf, 4, q, 4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#else
mavlink_attitude_target_t packet;
packet.time_boot_ms = time_boot_ms;
packet.body_roll_rate = body_roll_rate;
packet.body_pitch_rate = body_pitch_rate;
packet.body_yaw_rate = body_yaw_rate;
packet.thrust = thrust;
packet.type_mask = type_mask;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATTITUDE_TARGET;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
}
/**
* @brief Pack a attitude_target message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_boot_ms Timestamp in milliseconds since system boot
* @param type_mask 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
* @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
* @param body_roll_rate Body roll rate in radians per second
* @param body_pitch_rate Body roll rate in radians per second
* @param body_yaw_rate Body roll rate in radians per second
* @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_attitude_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_boot_ms,uint8_t type_mask,const float *q,float body_roll_rate,float body_pitch_rate,float body_yaw_rate,float thrust)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 20, body_roll_rate);
_mav_put_float(buf, 24, body_pitch_rate);
_mav_put_float(buf, 28, body_yaw_rate);
_mav_put_float(buf, 32, thrust);
_mav_put_uint8_t(buf, 36, type_mask);
_mav_put_float_array(buf, 4, q, 4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#else
mavlink_attitude_target_t packet;
packet.time_boot_ms = time_boot_ms;
packet.body_roll_rate = body_roll_rate;
packet.body_pitch_rate = body_pitch_rate;
packet.body_yaw_rate = body_yaw_rate;
packet.thrust = thrust;
packet.type_mask = type_mask;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ATTITUDE_TARGET;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
}
/**
* @brief Encode a attitude_target struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param attitude_target C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_attitude_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_target_t* attitude_target)
{
return mavlink_msg_attitude_target_pack(system_id, component_id, msg, attitude_target->time_boot_ms, attitude_target->type_mask, attitude_target->q, attitude_target->body_roll_rate, attitude_target->body_pitch_rate, attitude_target->body_yaw_rate, attitude_target->thrust);
}
/**
* @brief Encode a attitude_target struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param attitude_target C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_attitude_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_target_t* attitude_target)
{
return mavlink_msg_attitude_target_pack_chan(system_id, component_id, chan, msg, attitude_target->time_boot_ms, attitude_target->type_mask, attitude_target->q, attitude_target->body_roll_rate, attitude_target->body_pitch_rate, attitude_target->body_yaw_rate, attitude_target->thrust);
}
/**
* @brief Send a attitude_target message
* @param chan MAVLink channel to send the message
*
* @param time_boot_ms Timestamp in milliseconds since system boot
* @param type_mask 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
* @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
* @param body_roll_rate Body roll rate in radians per second
* @param body_pitch_rate Body roll rate in radians per second
* @param body_yaw_rate Body roll rate in radians per second
* @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_attitude_target_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 20, body_roll_rate);
_mav_put_float(buf, 24, body_pitch_rate);
_mav_put_float(buf, 28, body_yaw_rate);
_mav_put_float(buf, 32, thrust);
_mav_put_uint8_t(buf, 36, type_mask);
_mav_put_float_array(buf, 4, q, 4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
#else
mavlink_attitude_target_t packet;
packet.time_boot_ms = time_boot_ms;
packet.body_roll_rate = body_roll_rate;
packet.body_pitch_rate = body_pitch_rate;
packet.body_yaw_rate = body_yaw_rate;
packet.thrust = thrust;
packet.type_mask = type_mask;
mav_array_memcpy(packet.q, q, sizeof(float)*4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_attitude_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 20, body_roll_rate);
_mav_put_float(buf, 24, body_pitch_rate);
_mav_put_float(buf, 28, body_yaw_rate);
_mav_put_float(buf, 32, thrust);
_mav_put_uint8_t(buf, 36, type_mask);
_mav_put_float_array(buf, 4, q, 4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
#else
mavlink_attitude_target_t *packet = (mavlink_attitude_target_t *)msgbuf;
packet->time_boot_ms = time_boot_ms;
packet->body_roll_rate = body_roll_rate;
packet->body_pitch_rate = body_pitch_rate;
packet->body_yaw_rate = body_yaw_rate;
packet->thrust = thrust;
packet->type_mask = type_mask;
mav_array_memcpy(packet->q, q, sizeof(float)*4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ATTITUDE_TARGET UNPACKING
/**
* @brief Get field time_boot_ms from attitude_target message
*
* @return Timestamp in milliseconds since system boot
*/
static inline uint32_t mavlink_msg_attitude_target_get_time_boot_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field type_mask from attitude_target message
*
* @return 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
*/
static inline uint8_t mavlink_msg_attitude_target_get_type_mask(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 36);
}
/**
* @brief Get field q from attitude_target message
*
* @return Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
*/
static inline uint16_t mavlink_msg_attitude_target_get_q(const mavlink_message_t* msg, float *q)
{
return _MAV_RETURN_float_array(msg, q, 4, 4);
}
/**
* @brief Get field body_roll_rate from attitude_target message
*
* @return Body roll rate in radians per second
*/
static inline float mavlink_msg_attitude_target_get_body_roll_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field body_pitch_rate from attitude_target message
*
* @return Body roll rate in radians per second
*/
static inline float mavlink_msg_attitude_target_get_body_pitch_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field body_yaw_rate from attitude_target message
*
* @return Body roll rate in radians per second
*/
static inline float mavlink_msg_attitude_target_get_body_yaw_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field thrust from attitude_target message
*
* @return Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)
*/
static inline float mavlink_msg_attitude_target_get_thrust(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 32);
}
/**
* @brief Decode a attitude_target message into a struct
*
* @param msg The message to decode
* @param attitude_target C-struct to decode the message contents into
*/
static inline void mavlink_msg_attitude_target_decode(const mavlink_message_t* msg, mavlink_attitude_target_t* attitude_target)
{
#if MAVLINK_NEED_BYTE_SWAP
attitude_target->time_boot_ms = mavlink_msg_attitude_target_get_time_boot_ms(msg);
mavlink_msg_attitude_target_get_q(msg, attitude_target->q);
attitude_target->body_roll_rate = mavlink_msg_attitude_target_get_body_roll_rate(msg);
attitude_target->body_pitch_rate = mavlink_msg_attitude_target_get_body_pitch_rate(msg);
attitude_target->body_yaw_rate = mavlink_msg_attitude_target_get_body_yaw_rate(msg);
attitude_target->thrust = mavlink_msg_attitude_target_get_thrust(msg);
attitude_target->type_mask = mavlink_msg_attitude_target_get_type_mask(msg);
#else
memcpy(attitude_target, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
#endif
}

View File

@ -0,0 +1,209 @@
// MESSAGE AUTH_KEY PACKING
#define MAVLINK_MSG_ID_AUTH_KEY 7
typedef struct __mavlink_auth_key_t
{
char key[32]; /*< key*/
} mavlink_auth_key_t;
#define MAVLINK_MSG_ID_AUTH_KEY_LEN 32
#define MAVLINK_MSG_ID_7_LEN 32
#define MAVLINK_MSG_ID_AUTH_KEY_CRC 119
#define MAVLINK_MSG_ID_7_CRC 119
#define MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN 32
#define MAVLINK_MESSAGE_INFO_AUTH_KEY { \
"AUTH_KEY", \
1, \
{ { "key", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_auth_key_t, key) }, \
} \
}
/**
* @brief Pack a auth_key message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param key key
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
const char *key)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_AUTH_KEY_LEN];
_mav_put_char_array(buf, 0, key, 32);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#else
mavlink_auth_key_t packet;
mav_array_memcpy(packet.key, key, sizeof(char)*32);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_AUTH_KEY;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
}
/**
* @brief Pack a auth_key message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param key key
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
const char *key)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_AUTH_KEY_LEN];
_mav_put_char_array(buf, 0, key, 32);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#else
mavlink_auth_key_t packet;
mav_array_memcpy(packet.key, key, sizeof(char)*32);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_AUTH_KEY;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
}
/**
* @brief Encode a auth_key struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param auth_key C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_auth_key_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_auth_key_t* auth_key)
{
return mavlink_msg_auth_key_pack(system_id, component_id, msg, auth_key->key);
}
/**
* @brief Encode a auth_key struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param auth_key C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_auth_key_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_auth_key_t* auth_key)
{
return mavlink_msg_auth_key_pack_chan(system_id, component_id, chan, msg, auth_key->key);
}
/**
* @brief Send a auth_key message
* @param chan MAVLink channel to send the message
*
* @param key key
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char *key)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_AUTH_KEY_LEN];
_mav_put_char_array(buf, 0, key, 32);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, buf, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, buf, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
#else
mavlink_auth_key_t packet;
mav_array_memcpy(packet.key, key, sizeof(char)*32);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)&packet, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)&packet, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_AUTH_KEY_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_auth_key_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const char *key)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_char_array(buf, 0, key, 32);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, buf, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, buf, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
#else
mavlink_auth_key_t *packet = (mavlink_auth_key_t *)msgbuf;
mav_array_memcpy(packet->key, key, sizeof(char)*32);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)packet, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)packet, MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE AUTH_KEY UNPACKING
/**
* @brief Get field key from auth_key message
*
* @return key
*/
static inline uint16_t mavlink_msg_auth_key_get_key(const mavlink_message_t* msg, char *key)
{
return _MAV_RETURN_char_array(msg, key, 32, 0);
}
/**
* @brief Decode a auth_key message into a struct
*
* @param msg The message to decode
* @param auth_key C-struct to decode the message contents into
*/
static inline void mavlink_msg_auth_key_decode(const mavlink_message_t* msg, mavlink_auth_key_t* auth_key)
{
#if MAVLINK_NEED_BYTE_SWAP
mavlink_msg_auth_key_get_key(msg, auth_key->key);
#else
memcpy(auth_key, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_AUTH_KEY_LEN);
#endif
}

View File

@ -0,0 +1,443 @@
// MESSAGE AUTOPILOT_VERSION PACKING
#define MAVLINK_MSG_ID_AUTOPILOT_VERSION 148
typedef struct __mavlink_autopilot_version_t
{
uint64_t capabilities; /*< bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum)*/
uint64_t uid; /*< UID if provided by hardware*/
uint32_t flight_sw_version; /*< Firmware version number*/
uint32_t middleware_sw_version; /*< Middleware version number*/
uint32_t os_sw_version; /*< Operating system version number*/
uint32_t board_version; /*< HW / board version (last 8 bytes should be silicon ID, if any)*/
uint16_t vendor_id; /*< ID of the board vendor*/
uint16_t product_id; /*< ID of the product*/
uint8_t flight_custom_version[8]; /*< 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.*/
uint8_t middleware_custom_version[8]; /*< 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.*/
uint8_t os_custom_version[8]; /*< 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.*/
} mavlink_autopilot_version_t;
#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN 60
#define MAVLINK_MSG_ID_148_LEN 60
#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC 178
#define MAVLINK_MSG_ID_148_CRC 178
#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_FLIGHT_CUSTOM_VERSION_LEN 8
#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_MIDDLEWARE_CUSTOM_VERSION_LEN 8
#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_OS_CUSTOM_VERSION_LEN 8
#define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION { \
"AUTOPILOT_VERSION", \
11, \
{ { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_version_t, capabilities) }, \
{ "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_autopilot_version_t, uid) }, \
{ "flight_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_autopilot_version_t, flight_sw_version) }, \
{ "middleware_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_autopilot_version_t, middleware_sw_version) }, \
{ "os_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_autopilot_version_t, os_sw_version) }, \
{ "board_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_autopilot_version_t, board_version) }, \
{ "vendor_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_autopilot_version_t, vendor_id) }, \
{ "product_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_autopilot_version_t, product_id) }, \
{ "flight_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 36, offsetof(mavlink_autopilot_version_t, flight_custom_version) }, \
{ "middleware_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 44, offsetof(mavlink_autopilot_version_t, middleware_custom_version) }, \
{ "os_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 52, offsetof(mavlink_autopilot_version_t, os_custom_version) }, \
} \
}
/**
* @brief Pack a autopilot_version message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param capabilities bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum)
* @param flight_sw_version Firmware version number
* @param middleware_sw_version Middleware version number
* @param os_sw_version Operating system version number
* @param board_version HW / board version (last 8 bytes should be silicon ID, if any)
* @param flight_custom_version 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.
* @param middleware_custom_version 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.
* @param os_custom_version 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.
* @param vendor_id ID of the board vendor
* @param product_id ID of the product
* @param uid UID if provided by hardware
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_autopilot_version_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN];
_mav_put_uint64_t(buf, 0, capabilities);
_mav_put_uint64_t(buf, 8, uid);
_mav_put_uint32_t(buf, 16, flight_sw_version);
_mav_put_uint32_t(buf, 20, middleware_sw_version);
_mav_put_uint32_t(buf, 24, os_sw_version);
_mav_put_uint32_t(buf, 28, board_version);
_mav_put_uint16_t(buf, 32, vendor_id);
_mav_put_uint16_t(buf, 34, product_id);
_mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
_mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
_mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#else
mavlink_autopilot_version_t packet;
packet.capabilities = capabilities;
packet.uid = uid;
packet.flight_sw_version = flight_sw_version;
packet.middleware_sw_version = middleware_sw_version;
packet.os_sw_version = os_sw_version;
packet.board_version = board_version;
packet.vendor_id = vendor_id;
packet.product_id = product_id;
mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
}
/**
* @brief Pack a autopilot_version message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param capabilities bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum)
* @param flight_sw_version Firmware version number
* @param middleware_sw_version Middleware version number
* @param os_sw_version Operating system version number
* @param board_version HW / board version (last 8 bytes should be silicon ID, if any)
* @param flight_custom_version 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.
* @param middleware_custom_version 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.
* @param os_custom_version 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.
* @param vendor_id ID of the board vendor
* @param product_id ID of the product
* @param uid UID if provided by hardware
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_autopilot_version_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t capabilities,uint32_t flight_sw_version,uint32_t middleware_sw_version,uint32_t os_sw_version,uint32_t board_version,const uint8_t *flight_custom_version,const uint8_t *middleware_custom_version,const uint8_t *os_custom_version,uint16_t vendor_id,uint16_t product_id,uint64_t uid)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN];
_mav_put_uint64_t(buf, 0, capabilities);
_mav_put_uint64_t(buf, 8, uid);
_mav_put_uint32_t(buf, 16, flight_sw_version);
_mav_put_uint32_t(buf, 20, middleware_sw_version);
_mav_put_uint32_t(buf, 24, os_sw_version);
_mav_put_uint32_t(buf, 28, board_version);
_mav_put_uint16_t(buf, 32, vendor_id);
_mav_put_uint16_t(buf, 34, product_id);
_mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
_mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
_mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#else
mavlink_autopilot_version_t packet;
packet.capabilities = capabilities;
packet.uid = uid;
packet.flight_sw_version = flight_sw_version;
packet.middleware_sw_version = middleware_sw_version;
packet.os_sw_version = os_sw_version;
packet.board_version = board_version;
packet.vendor_id = vendor_id;
packet.product_id = product_id;
mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
}
/**
* @brief Encode a autopilot_version struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param autopilot_version C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_autopilot_version_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version)
{
return mavlink_msg_autopilot_version_pack(system_id, component_id, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid);
}
/**
* @brief Encode a autopilot_version struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param autopilot_version C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_autopilot_version_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version)
{
return mavlink_msg_autopilot_version_pack_chan(system_id, component_id, chan, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid);
}
/**
* @brief Send a autopilot_version message
* @param chan MAVLink channel to send the message
*
* @param capabilities bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum)
* @param flight_sw_version Firmware version number
* @param middleware_sw_version Middleware version number
* @param os_sw_version Operating system version number
* @param board_version HW / board version (last 8 bytes should be silicon ID, if any)
* @param flight_custom_version 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.
* @param middleware_custom_version 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.
* @param os_custom_version 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.
* @param vendor_id ID of the board vendor
* @param product_id ID of the product
* @param uid UID if provided by hardware
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_autopilot_version_send(mavlink_channel_t chan, uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN];
_mav_put_uint64_t(buf, 0, capabilities);
_mav_put_uint64_t(buf, 8, uid);
_mav_put_uint32_t(buf, 16, flight_sw_version);
_mav_put_uint32_t(buf, 20, middleware_sw_version);
_mav_put_uint32_t(buf, 24, os_sw_version);
_mav_put_uint32_t(buf, 28, board_version);
_mav_put_uint16_t(buf, 32, vendor_id);
_mav_put_uint16_t(buf, 34, product_id);
_mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
_mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
_mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
#else
mavlink_autopilot_version_t packet;
packet.capabilities = capabilities;
packet.uid = uid;
packet.flight_sw_version = flight_sw_version;
packet.middleware_sw_version = middleware_sw_version;
packet.os_sw_version = os_sw_version;
packet.board_version = board_version;
packet.vendor_id = vendor_id;
packet.product_id = product_id;
mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)&packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)&packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_autopilot_version_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, capabilities);
_mav_put_uint64_t(buf, 8, uid);
_mav_put_uint32_t(buf, 16, flight_sw_version);
_mav_put_uint32_t(buf, 20, middleware_sw_version);
_mav_put_uint32_t(buf, 24, os_sw_version);
_mav_put_uint32_t(buf, 28, board_version);
_mav_put_uint16_t(buf, 32, vendor_id);
_mav_put_uint16_t(buf, 34, product_id);
_mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
_mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
_mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
#else
mavlink_autopilot_version_t *packet = (mavlink_autopilot_version_t *)msgbuf;
packet->capabilities = capabilities;
packet->uid = uid;
packet->flight_sw_version = flight_sw_version;
packet->middleware_sw_version = middleware_sw_version;
packet->os_sw_version = os_sw_version;
packet->board_version = board_version;
packet->vendor_id = vendor_id;
packet->product_id = product_id;
mav_array_memcpy(packet->flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
mav_array_memcpy(packet->middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
mav_array_memcpy(packet->os_custom_version, os_custom_version, sizeof(uint8_t)*8);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE AUTOPILOT_VERSION UNPACKING
/**
* @brief Get field capabilities from autopilot_version message
*
* @return bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum)
*/
static inline uint64_t mavlink_msg_autopilot_version_get_capabilities(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field flight_sw_version from autopilot_version message
*
* @return Firmware version number
*/
static inline uint32_t mavlink_msg_autopilot_version_get_flight_sw_version(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 16);
}
/**
* @brief Get field middleware_sw_version from autopilot_version message
*
* @return Middleware version number
*/
static inline uint32_t mavlink_msg_autopilot_version_get_middleware_sw_version(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 20);
}
/**
* @brief Get field os_sw_version from autopilot_version message
*
* @return Operating system version number
*/
static inline uint32_t mavlink_msg_autopilot_version_get_os_sw_version(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 24);
}
/**
* @brief Get field board_version from autopilot_version message
*
* @return HW / board version (last 8 bytes should be silicon ID, if any)
*/
static inline uint32_t mavlink_msg_autopilot_version_get_board_version(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 28);
}
/**
* @brief Get field flight_custom_version from autopilot_version message
*
* @return 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.
*/
static inline uint16_t mavlink_msg_autopilot_version_get_flight_custom_version(const mavlink_message_t* msg, uint8_t *flight_custom_version)
{
return _MAV_RETURN_uint8_t_array(msg, flight_custom_version, 8, 36);
}
/**
* @brief Get field middleware_custom_version from autopilot_version message
*
* @return 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.
*/
static inline uint16_t mavlink_msg_autopilot_version_get_middleware_custom_version(const mavlink_message_t* msg, uint8_t *middleware_custom_version)
{
return _MAV_RETURN_uint8_t_array(msg, middleware_custom_version, 8, 44);
}
/**
* @brief Get field os_custom_version from autopilot_version message
*
* @return 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.
*/
static inline uint16_t mavlink_msg_autopilot_version_get_os_custom_version(const mavlink_message_t* msg, uint8_t *os_custom_version)
{
return _MAV_RETURN_uint8_t_array(msg, os_custom_version, 8, 52);
}
/**
* @brief Get field vendor_id from autopilot_version message
*
* @return ID of the board vendor
*/
static inline uint16_t mavlink_msg_autopilot_version_get_vendor_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 32);
}
/**
* @brief Get field product_id from autopilot_version message
*
* @return ID of the product
*/
static inline uint16_t mavlink_msg_autopilot_version_get_product_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 34);
}
/**
* @brief Get field uid from autopilot_version message
*
* @return UID if provided by hardware
*/
static inline uint64_t mavlink_msg_autopilot_version_get_uid(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 8);
}
/**
* @brief Decode a autopilot_version message into a struct
*
* @param msg The message to decode
* @param autopilot_version C-struct to decode the message contents into
*/
static inline void mavlink_msg_autopilot_version_decode(const mavlink_message_t* msg, mavlink_autopilot_version_t* autopilot_version)
{
#if MAVLINK_NEED_BYTE_SWAP
autopilot_version->capabilities = mavlink_msg_autopilot_version_get_capabilities(msg);
autopilot_version->uid = mavlink_msg_autopilot_version_get_uid(msg);
autopilot_version->flight_sw_version = mavlink_msg_autopilot_version_get_flight_sw_version(msg);
autopilot_version->middleware_sw_version = mavlink_msg_autopilot_version_get_middleware_sw_version(msg);
autopilot_version->os_sw_version = mavlink_msg_autopilot_version_get_os_sw_version(msg);
autopilot_version->board_version = mavlink_msg_autopilot_version_get_board_version(msg);
autopilot_version->vendor_id = mavlink_msg_autopilot_version_get_vendor_id(msg);
autopilot_version->product_id = mavlink_msg_autopilot_version_get_product_id(msg);
mavlink_msg_autopilot_version_get_flight_custom_version(msg, autopilot_version->flight_custom_version);
mavlink_msg_autopilot_version_get_middleware_custom_version(msg, autopilot_version->middleware_custom_version);
mavlink_msg_autopilot_version_get_os_custom_version(msg, autopilot_version->os_custom_version);
#else
memcpy(autopilot_version, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
#endif
}

View File

@ -0,0 +1,393 @@
// MESSAGE BATTERY_STATUS PACKING
#define MAVLINK_MSG_ID_BATTERY_STATUS 147
typedef struct __mavlink_battery_status_t
{
int32_t current_consumed; /*< Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate*/
int32_t energy_consumed; /*< Consumed energy, in 100*Joules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate*/
int16_t temperature; /*< Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.*/
uint16_t voltages[10]; /*< Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.*/
int16_t current_battery; /*< Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current*/
uint8_t id; /*< Battery ID*/
uint8_t battery_function; /*< Function of the battery*/
uint8_t type; /*< Type (chemistry) of the battery*/
int8_t battery_remaining; /*< Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery*/
} mavlink_battery_status_t;
#define MAVLINK_MSG_ID_BATTERY_STATUS_LEN 36
#define MAVLINK_MSG_ID_147_LEN 36
#define MAVLINK_MSG_ID_BATTERY_STATUS_CRC 154
#define MAVLINK_MSG_ID_147_CRC 154
#define MAVLINK_MSG_BATTERY_STATUS_FIELD_VOLTAGES_LEN 10
#define MAVLINK_MESSAGE_INFO_BATTERY_STATUS { \
"BATTERY_STATUS", \
9, \
{ { "current_consumed", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_battery_status_t, current_consumed) }, \
{ "energy_consumed", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_battery_status_t, energy_consumed) }, \
{ "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_battery_status_t, temperature) }, \
{ "voltages", NULL, MAVLINK_TYPE_UINT16_T, 10, 10, offsetof(mavlink_battery_status_t, voltages) }, \
{ "current_battery", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_battery_status_t, current_battery) }, \
{ "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_battery_status_t, id) }, \
{ "battery_function", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_battery_status_t, battery_function) }, \
{ "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_battery_status_t, type) }, \
{ "battery_remaining", NULL, MAVLINK_TYPE_INT8_T, 0, 35, offsetof(mavlink_battery_status_t, battery_remaining) }, \
} \
}
/**
* @brief Pack a battery_status message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param id Battery ID
* @param battery_function Function of the battery
* @param type Type (chemistry) of the battery
* @param temperature Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.
* @param voltages Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.
* @param current_battery Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current
* @param current_consumed Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate
* @param energy_consumed Consumed energy, in 100*Joules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate
* @param battery_remaining Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_battery_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t id, uint8_t battery_function, uint8_t type, int16_t temperature, const uint16_t *voltages, int16_t current_battery, int32_t current_consumed, int32_t energy_consumed, int8_t battery_remaining)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_BATTERY_STATUS_LEN];
_mav_put_int32_t(buf, 0, current_consumed);
_mav_put_int32_t(buf, 4, energy_consumed);
_mav_put_int16_t(buf, 8, temperature);
_mav_put_int16_t(buf, 30, current_battery);
_mav_put_uint8_t(buf, 32, id);
_mav_put_uint8_t(buf, 33, battery_function);
_mav_put_uint8_t(buf, 34, type);
_mav_put_int8_t(buf, 35, battery_remaining);
_mav_put_uint16_t_array(buf, 10, voltages, 10);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#else
mavlink_battery_status_t packet;
packet.current_consumed = current_consumed;
packet.energy_consumed = energy_consumed;
packet.temperature = temperature;
packet.current_battery = current_battery;
packet.id = id;
packet.battery_function = battery_function;
packet.type = type;
packet.battery_remaining = battery_remaining;
mav_array_memcpy(packet.voltages, voltages, sizeof(uint16_t)*10);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
}
/**
* @brief Pack a battery_status message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param id Battery ID
* @param battery_function Function of the battery
* @param type Type (chemistry) of the battery
* @param temperature Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.
* @param voltages Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.
* @param current_battery Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current
* @param current_consumed Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate
* @param energy_consumed Consumed energy, in 100*Joules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate
* @param battery_remaining Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_battery_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t id,uint8_t battery_function,uint8_t type,int16_t temperature,const uint16_t *voltages,int16_t current_battery,int32_t current_consumed,int32_t energy_consumed,int8_t battery_remaining)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_BATTERY_STATUS_LEN];
_mav_put_int32_t(buf, 0, current_consumed);
_mav_put_int32_t(buf, 4, energy_consumed);
_mav_put_int16_t(buf, 8, temperature);
_mav_put_int16_t(buf, 30, current_battery);
_mav_put_uint8_t(buf, 32, id);
_mav_put_uint8_t(buf, 33, battery_function);
_mav_put_uint8_t(buf, 34, type);
_mav_put_int8_t(buf, 35, battery_remaining);
_mav_put_uint16_t_array(buf, 10, voltages, 10);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#else
mavlink_battery_status_t packet;
packet.current_consumed = current_consumed;
packet.energy_consumed = energy_consumed;
packet.temperature = temperature;
packet.current_battery = current_battery;
packet.id = id;
packet.battery_function = battery_function;
packet.type = type;
packet.battery_remaining = battery_remaining;
mav_array_memcpy(packet.voltages, voltages, sizeof(uint16_t)*10);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_BATTERY_STATUS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
}
/**
* @brief Encode a battery_status struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param battery_status C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_battery_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_battery_status_t* battery_status)
{
return mavlink_msg_battery_status_pack(system_id, component_id, msg, battery_status->id, battery_status->battery_function, battery_status->type, battery_status->temperature, battery_status->voltages, battery_status->current_battery, battery_status->current_consumed, battery_status->energy_consumed, battery_status->battery_remaining);
}
/**
* @brief Encode a battery_status struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param battery_status C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_battery_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_battery_status_t* battery_status)
{
return mavlink_msg_battery_status_pack_chan(system_id, component_id, chan, msg, battery_status->id, battery_status->battery_function, battery_status->type, battery_status->temperature, battery_status->voltages, battery_status->current_battery, battery_status->current_consumed, battery_status->energy_consumed, battery_status->battery_remaining);
}
/**
* @brief Send a battery_status message
* @param chan MAVLink channel to send the message
*
* @param id Battery ID
* @param battery_function Function of the battery
* @param type Type (chemistry) of the battery
* @param temperature Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.
* @param voltages Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.
* @param current_battery Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current
* @param current_consumed Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate
* @param energy_consumed Consumed energy, in 100*Joules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate
* @param battery_remaining Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_battery_status_send(mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, int16_t temperature, const uint16_t *voltages, int16_t current_battery, int32_t current_consumed, int32_t energy_consumed, int8_t battery_remaining)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_BATTERY_STATUS_LEN];
_mav_put_int32_t(buf, 0, current_consumed);
_mav_put_int32_t(buf, 4, energy_consumed);
_mav_put_int16_t(buf, 8, temperature);
_mav_put_int16_t(buf, 30, current_battery);
_mav_put_uint8_t(buf, 32, id);
_mav_put_uint8_t(buf, 33, battery_function);
_mav_put_uint8_t(buf, 34, type);
_mav_put_int8_t(buf, 35, battery_remaining);
_mav_put_uint16_t_array(buf, 10, voltages, 10);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
#else
mavlink_battery_status_t packet;
packet.current_consumed = current_consumed;
packet.energy_consumed = energy_consumed;
packet.temperature = temperature;
packet.current_battery = current_battery;
packet.id = id;
packet.battery_function = battery_function;
packet.type = type;
packet.battery_remaining = battery_remaining;
mav_array_memcpy(packet.voltages, voltages, sizeof(uint16_t)*10);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)&packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)&packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_BATTERY_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_battery_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t id, uint8_t battery_function, uint8_t type, int16_t temperature, const uint16_t *voltages, int16_t current_battery, int32_t current_consumed, int32_t energy_consumed, int8_t battery_remaining)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_int32_t(buf, 0, current_consumed);
_mav_put_int32_t(buf, 4, energy_consumed);
_mav_put_int16_t(buf, 8, temperature);
_mav_put_int16_t(buf, 30, current_battery);
_mav_put_uint8_t(buf, 32, id);
_mav_put_uint8_t(buf, 33, battery_function);
_mav_put_uint8_t(buf, 34, type);
_mav_put_int8_t(buf, 35, battery_remaining);
_mav_put_uint16_t_array(buf, 10, voltages, 10);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, buf, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
#else
mavlink_battery_status_t *packet = (mavlink_battery_status_t *)msgbuf;
packet->current_consumed = current_consumed;
packet->energy_consumed = energy_consumed;
packet->temperature = temperature;
packet->current_battery = current_battery;
packet->id = id;
packet->battery_function = battery_function;
packet->type = type;
packet->battery_remaining = battery_remaining;
mav_array_memcpy(packet->voltages, voltages, sizeof(uint16_t)*10);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN, MAVLINK_MSG_ID_BATTERY_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BATTERY_STATUS, (const char *)packet, MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE BATTERY_STATUS UNPACKING
/**
* @brief Get field id from battery_status message
*
* @return Battery ID
*/
static inline uint8_t mavlink_msg_battery_status_get_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 32);
}
/**
* @brief Get field battery_function from battery_status message
*
* @return Function of the battery
*/
static inline uint8_t mavlink_msg_battery_status_get_battery_function(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 33);
}
/**
* @brief Get field type from battery_status message
*
* @return Type (chemistry) of the battery
*/
static inline uint8_t mavlink_msg_battery_status_get_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 34);
}
/**
* @brief Get field temperature from battery_status message
*
* @return Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature.
*/
static inline int16_t mavlink_msg_battery_status_get_temperature(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 8);
}
/**
* @brief Get field voltages from battery_status message
*
* @return Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value.
*/
static inline uint16_t mavlink_msg_battery_status_get_voltages(const mavlink_message_t* msg, uint16_t *voltages)
{
return _MAV_RETURN_uint16_t_array(msg, voltages, 10, 10);
}
/**
* @brief Get field current_battery from battery_status message
*
* @return Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current
*/
static inline int16_t mavlink_msg_battery_status_get_current_battery(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 30);
}
/**
* @brief Get field current_consumed from battery_status message
*
* @return Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate
*/
static inline int32_t mavlink_msg_battery_status_get_current_consumed(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 0);
}
/**
* @brief Get field energy_consumed from battery_status message
*
* @return Consumed energy, in 100*Joules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate
*/
static inline int32_t mavlink_msg_battery_status_get_energy_consumed(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 4);
}
/**
* @brief Get field battery_remaining from battery_status message
*
* @return Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery
*/
static inline int8_t mavlink_msg_battery_status_get_battery_remaining(const mavlink_message_t* msg)
{
return _MAV_RETURN_int8_t(msg, 35);
}
/**
* @brief Decode a battery_status message into a struct
*
* @param msg The message to decode
* @param battery_status C-struct to decode the message contents into
*/
static inline void mavlink_msg_battery_status_decode(const mavlink_message_t* msg, mavlink_battery_status_t* battery_status)
{
#if MAVLINK_NEED_BYTE_SWAP
battery_status->current_consumed = mavlink_msg_battery_status_get_current_consumed(msg);
battery_status->energy_consumed = mavlink_msg_battery_status_get_energy_consumed(msg);
battery_status->temperature = mavlink_msg_battery_status_get_temperature(msg);
mavlink_msg_battery_status_get_voltages(msg, battery_status->voltages);
battery_status->current_battery = mavlink_msg_battery_status_get_current_battery(msg);
battery_status->id = mavlink_msg_battery_status_get_id(msg);
battery_status->battery_function = mavlink_msg_battery_status_get_battery_function(msg);
battery_status->type = mavlink_msg_battery_status_get_type(msg);
battery_status->battery_remaining = mavlink_msg_battery_status_get_battery_remaining(msg);
#else
memcpy(battery_status, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_BATTERY_STATUS_LEN);
#endif
}

View File

@ -0,0 +1,233 @@
// MESSAGE CAMERA_TRIGGER PACKING
#define MAVLINK_MSG_ID_CAMERA_TRIGGER 112
typedef struct __mavlink_camera_trigger_t
{
uint64_t time_usec; /*< Timestamp for the image frame in microseconds*/
uint32_t seq; /*< Image frame sequence*/
} mavlink_camera_trigger_t;
#define MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN 12
#define MAVLINK_MSG_ID_112_LEN 12
#define MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC 174
#define MAVLINK_MSG_ID_112_CRC 174
#define MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER { \
"CAMERA_TRIGGER", \
2, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_trigger_t, time_usec) }, \
{ "seq", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_trigger_t, seq) }, \
} \
}
/**
* @brief Pack a camera_trigger message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp for the image frame in microseconds
* @param seq Image frame sequence
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_camera_trigger_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, uint32_t seq)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint32_t(buf, 8, seq);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#else
mavlink_camera_trigger_t packet;
packet.time_usec = time_usec;
packet.seq = seq;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
}
/**
* @brief Pack a camera_trigger message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp for the image frame in microseconds
* @param seq Image frame sequence
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_camera_trigger_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,uint32_t seq)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint32_t(buf, 8, seq);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#else
mavlink_camera_trigger_t packet;
packet.time_usec = time_usec;
packet.seq = seq;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
}
/**
* @brief Encode a camera_trigger struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param camera_trigger C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_camera_trigger_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_trigger_t* camera_trigger)
{
return mavlink_msg_camera_trigger_pack(system_id, component_id, msg, camera_trigger->time_usec, camera_trigger->seq);
}
/**
* @brief Encode a camera_trigger struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param camera_trigger C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_camera_trigger_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_trigger_t* camera_trigger)
{
return mavlink_msg_camera_trigger_pack_chan(system_id, component_id, chan, msg, camera_trigger->time_usec, camera_trigger->seq);
}
/**
* @brief Send a camera_trigger message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp for the image frame in microseconds
* @param seq Image frame sequence
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_camera_trigger_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t seq)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint32_t(buf, 8, seq);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
#else
mavlink_camera_trigger_t packet;
packet.time_usec = time_usec;
packet.seq = seq;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_camera_trigger_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint32_t seq)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint32_t(buf, 8, seq);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
#else
mavlink_camera_trigger_t *packet = (mavlink_camera_trigger_t *)msgbuf;
packet->time_usec = time_usec;
packet->seq = seq;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, (const char *)packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, (const char *)packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE CAMERA_TRIGGER UNPACKING
/**
* @brief Get field time_usec from camera_trigger message
*
* @return Timestamp for the image frame in microseconds
*/
static inline uint64_t mavlink_msg_camera_trigger_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field seq from camera_trigger message
*
* @return Image frame sequence
*/
static inline uint32_t mavlink_msg_camera_trigger_get_seq(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 8);
}
/**
* @brief Decode a camera_trigger message into a struct
*
* @param msg The message to decode
* @param camera_trigger C-struct to decode the message contents into
*/
static inline void mavlink_msg_camera_trigger_decode(const mavlink_message_t* msg, mavlink_camera_trigger_t* camera_trigger)
{
#if MAVLINK_NEED_BYTE_SWAP
camera_trigger->time_usec = mavlink_msg_camera_trigger_get_time_usec(msg);
camera_trigger->seq = mavlink_msg_camera_trigger_get_seq(msg);
#else
memcpy(camera_trigger, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
#endif
}

View File

@ -0,0 +1,273 @@
// MESSAGE CHANGE_OPERATOR_CONTROL PACKING
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL 5
typedef struct __mavlink_change_operator_control_t
{
uint8_t target_system; /*< System the GCS requests control for*/
uint8_t control_request; /*< 0: request control of this MAV, 1: Release control of this MAV*/
uint8_t version; /*< 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.*/
char passkey[25]; /*< 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 "!?,.-"*/
} mavlink_change_operator_control_t;
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN 28
#define MAVLINK_MSG_ID_5_LEN 28
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC 217
#define MAVLINK_MSG_ID_5_CRC 217
#define MAVLINK_MSG_CHANGE_OPERATOR_CONTROL_FIELD_PASSKEY_LEN 25
#define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL { \
"CHANGE_OPERATOR_CONTROL", \
4, \
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
{ "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
{ "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
{ "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
} \
}
/**
* @brief Pack a change_operator_control message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param target_system System the GCS requests control for
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
* @param version 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.
* @param passkey 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 "!?,.-"
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, control_request);
_mav_put_uint8_t(buf, 2, version);
_mav_put_char_array(buf, 3, passkey, 25);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#else
mavlink_change_operator_control_t packet;
packet.target_system = target_system;
packet.control_request = control_request;
packet.version = version;
mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
}
/**
* @brief Pack a change_operator_control message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System the GCS requests control for
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
* @param version 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.
* @param passkey 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 "!?,.-"
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t control_request,uint8_t version,const char *passkey)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, control_request);
_mav_put_uint8_t(buf, 2, version);
_mav_put_char_array(buf, 3, passkey, 25);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#else
mavlink_change_operator_control_t packet;
packet.target_system = target_system;
packet.control_request = control_request;
packet.version = version;
mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
}
/**
* @brief Encode a change_operator_control struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param change_operator_control C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_change_operator_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_change_operator_control_t* change_operator_control)
{
return mavlink_msg_change_operator_control_pack(system_id, component_id, msg, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey);
}
/**
* @brief Encode a change_operator_control struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param change_operator_control C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_change_operator_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_change_operator_control_t* change_operator_control)
{
return mavlink_msg_change_operator_control_pack_chan(system_id, component_id, chan, msg, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey);
}
/**
* @brief Send a change_operator_control message
* @param chan MAVLink channel to send the message
*
* @param target_system System the GCS requests control for
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
* @param version 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.
* @param passkey 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 "!?,.-"
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_change_operator_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, control_request);
_mav_put_uint8_t(buf, 2, version);
_mav_put_char_array(buf, 3, passkey, 25);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
#else
mavlink_change_operator_control_t packet;
packet.target_system = target_system;
packet.control_request = control_request;
packet.version = version;
mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_change_operator_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, control_request);
_mav_put_uint8_t(buf, 2, version);
_mav_put_char_array(buf, 3, passkey, 25);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
#else
mavlink_change_operator_control_t *packet = (mavlink_change_operator_control_t *)msgbuf;
packet->target_system = target_system;
packet->control_request = control_request;
packet->version = version;
mav_array_memcpy(packet->passkey, passkey, sizeof(char)*25);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE CHANGE_OPERATOR_CONTROL UNPACKING
/**
* @brief Get field target_system from change_operator_control message
*
* @return System the GCS requests control for
*/
static inline uint8_t mavlink_msg_change_operator_control_get_target_system(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 0);
}
/**
* @brief Get field control_request from change_operator_control message
*
* @return 0: request control of this MAV, 1: Release control of this MAV
*/
static inline uint8_t mavlink_msg_change_operator_control_get_control_request(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 1);
}
/**
* @brief Get field version from change_operator_control message
*
* @return 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.
*/
static inline uint8_t mavlink_msg_change_operator_control_get_version(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 2);
}
/**
* @brief Get field passkey from change_operator_control message
*
* @return 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 "!?,.-"
*/
static inline uint16_t mavlink_msg_change_operator_control_get_passkey(const mavlink_message_t* msg, char *passkey)
{
return _MAV_RETURN_char_array(msg, passkey, 25, 3);
}
/**
* @brief Decode a change_operator_control message into a struct
*
* @param msg The message to decode
* @param change_operator_control C-struct to decode the message contents into
*/
static inline void mavlink_msg_change_operator_control_decode(const mavlink_message_t* msg, mavlink_change_operator_control_t* change_operator_control)
{
#if MAVLINK_NEED_BYTE_SWAP
change_operator_control->target_system = mavlink_msg_change_operator_control_get_target_system(msg);
change_operator_control->control_request = mavlink_msg_change_operator_control_get_control_request(msg);
change_operator_control->version = mavlink_msg_change_operator_control_get_version(msg);
mavlink_msg_change_operator_control_get_passkey(msg, change_operator_control->passkey);
#else
memcpy(change_operator_control, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
#endif
}

View File

@ -0,0 +1,257 @@
// MESSAGE CHANGE_OPERATOR_CONTROL_ACK PACKING
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK 6
typedef struct __mavlink_change_operator_control_ack_t
{
uint8_t gcs_system_id; /*< ID of the GCS this message */
uint8_t control_request; /*< 0: request control of this MAV, 1: Release control of this MAV*/
uint8_t ack; /*< 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control*/
} mavlink_change_operator_control_ack_t;
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN 3
#define MAVLINK_MSG_ID_6_LEN 3
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC 104
#define MAVLINK_MSG_ID_6_CRC 104
#define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK { \
"CHANGE_OPERATOR_CONTROL_ACK", \
3, \
{ { "gcs_system_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_ack_t, gcs_system_id) }, \
{ "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_ack_t, control_request) }, \
{ "ack", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_ack_t, ack) }, \
} \
}
/**
* @brief Pack a change_operator_control_ack message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param gcs_system_id ID of the GCS this message
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
* @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_change_operator_control_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN];
_mav_put_uint8_t(buf, 0, gcs_system_id);
_mav_put_uint8_t(buf, 1, control_request);
_mav_put_uint8_t(buf, 2, ack);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#else
mavlink_change_operator_control_ack_t packet;
packet.gcs_system_id = gcs_system_id;
packet.control_request = control_request;
packet.ack = ack;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
}
/**
* @brief Pack a change_operator_control_ack message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param gcs_system_id ID of the GCS this message
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
* @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_change_operator_control_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t gcs_system_id,uint8_t control_request,uint8_t ack)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN];
_mav_put_uint8_t(buf, 0, gcs_system_id);
_mav_put_uint8_t(buf, 1, control_request);
_mav_put_uint8_t(buf, 2, ack);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#else
mavlink_change_operator_control_ack_t packet;
packet.gcs_system_id = gcs_system_id;
packet.control_request = control_request;
packet.ack = ack;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
}
/**
* @brief Encode a change_operator_control_ack struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param change_operator_control_ack C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_change_operator_control_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_change_operator_control_ack_t* change_operator_control_ack)
{
return mavlink_msg_change_operator_control_ack_pack(system_id, component_id, msg, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack);
}
/**
* @brief Encode a change_operator_control_ack struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param change_operator_control_ack C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_change_operator_control_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_change_operator_control_ack_t* change_operator_control_ack)
{
return mavlink_msg_change_operator_control_ack_pack_chan(system_id, component_id, chan, msg, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack);
}
/**
* @brief Send a change_operator_control_ack message
* @param chan MAVLink channel to send the message
*
* @param gcs_system_id ID of the GCS this message
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
* @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_change_operator_control_ack_send(mavlink_channel_t chan, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN];
_mav_put_uint8_t(buf, 0, gcs_system_id);
_mav_put_uint8_t(buf, 1, control_request);
_mav_put_uint8_t(buf, 2, ack);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
#else
mavlink_change_operator_control_ack_t packet;
packet.gcs_system_id = gcs_system_id;
packet.control_request = control_request;
packet.ack = ack;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, (const char *)&packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, (const char *)&packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_change_operator_control_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint8_t(buf, 0, gcs_system_id);
_mav_put_uint8_t(buf, 1, control_request);
_mav_put_uint8_t(buf, 2, ack);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
#else
mavlink_change_operator_control_ack_t *packet = (mavlink_change_operator_control_ack_t *)msgbuf;
packet->gcs_system_id = gcs_system_id;
packet->control_request = control_request;
packet->ack = ack;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, (const char *)packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, (const char *)packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE CHANGE_OPERATOR_CONTROL_ACK UNPACKING
/**
* @brief Get field gcs_system_id from change_operator_control_ack message
*
* @return ID of the GCS this message
*/
static inline uint8_t mavlink_msg_change_operator_control_ack_get_gcs_system_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 0);
}
/**
* @brief Get field control_request from change_operator_control_ack message
*
* @return 0: request control of this MAV, 1: Release control of this MAV
*/
static inline uint8_t mavlink_msg_change_operator_control_ack_get_control_request(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 1);
}
/**
* @brief Get field ack from change_operator_control_ack message
*
* @return 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
*/
static inline uint8_t mavlink_msg_change_operator_control_ack_get_ack(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 2);
}
/**
* @brief Decode a change_operator_control_ack message into a struct
*
* @param msg The message to decode
* @param change_operator_control_ack C-struct to decode the message contents into
*/
static inline void mavlink_msg_change_operator_control_ack_decode(const mavlink_message_t* msg, mavlink_change_operator_control_ack_t* change_operator_control_ack)
{
#if MAVLINK_NEED_BYTE_SWAP
change_operator_control_ack->gcs_system_id = mavlink_msg_change_operator_control_ack_get_gcs_system_id(msg);
change_operator_control_ack->control_request = mavlink_msg_change_operator_control_ack_get_control_request(msg);
change_operator_control_ack->ack = mavlink_msg_change_operator_control_ack_get_ack(msg);
#else
memcpy(change_operator_control_ack, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
#endif
}

View File

@ -0,0 +1,233 @@
// MESSAGE COMMAND_ACK PACKING
#define MAVLINK_MSG_ID_COMMAND_ACK 77
typedef struct __mavlink_command_ack_t
{
uint16_t command; /*< Command ID, as defined by MAV_CMD enum.*/
uint8_t result; /*< See MAV_RESULT enum*/
} mavlink_command_ack_t;
#define MAVLINK_MSG_ID_COMMAND_ACK_LEN 3
#define MAVLINK_MSG_ID_77_LEN 3
#define MAVLINK_MSG_ID_COMMAND_ACK_CRC 143
#define MAVLINK_MSG_ID_77_CRC 143
#define MAVLINK_MESSAGE_INFO_COMMAND_ACK { \
"COMMAND_ACK", \
2, \
{ { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_command_ack_t, command) }, \
{ "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_command_ack_t, result) }, \
} \
}
/**
* @brief Pack a command_ack message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param command Command ID, as defined by MAV_CMD enum.
* @param result See MAV_RESULT enum
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_command_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint16_t command, uint8_t result)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_ACK_LEN];
_mav_put_uint16_t(buf, 0, command);
_mav_put_uint8_t(buf, 2, result);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#else
mavlink_command_ack_t packet;
packet.command = command;
packet.result = result;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
}
/**
* @brief Pack a command_ack message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param command Command ID, as defined by MAV_CMD enum.
* @param result See MAV_RESULT enum
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_command_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint16_t command,uint8_t result)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_ACK_LEN];
_mav_put_uint16_t(buf, 0, command);
_mav_put_uint8_t(buf, 2, result);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#else
mavlink_command_ack_t packet;
packet.command = command;
packet.result = result;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
}
/**
* @brief Encode a command_ack struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param command_ack C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_command_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_ack_t* command_ack)
{
return mavlink_msg_command_ack_pack(system_id, component_id, msg, command_ack->command, command_ack->result);
}
/**
* @brief Encode a command_ack struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param command_ack C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_command_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_ack_t* command_ack)
{
return mavlink_msg_command_ack_pack_chan(system_id, component_id, chan, msg, command_ack->command, command_ack->result);
}
/**
* @brief Send a command_ack message
* @param chan MAVLink channel to send the message
*
* @param command Command ID, as defined by MAV_CMD enum.
* @param result See MAV_RESULT enum
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_command_ack_send(mavlink_channel_t chan, uint16_t command, uint8_t result)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_ACK_LEN];
_mav_put_uint16_t(buf, 0, command);
_mav_put_uint8_t(buf, 2, result);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
#else
mavlink_command_ack_t packet;
packet.command = command;
packet.result = result;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_COMMAND_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_command_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t command, uint8_t result)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint16_t(buf, 0, command);
_mav_put_uint8_t(buf, 2, result);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
#else
mavlink_command_ack_t *packet = (mavlink_command_ack_t *)msgbuf;
packet->command = command;
packet->result = result;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, (const char *)packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, (const char *)packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE COMMAND_ACK UNPACKING
/**
* @brief Get field command from command_ack message
*
* @return Command ID, as defined by MAV_CMD enum.
*/
static inline uint16_t mavlink_msg_command_ack_get_command(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 0);
}
/**
* @brief Get field result from command_ack message
*
* @return See MAV_RESULT enum
*/
static inline uint8_t mavlink_msg_command_ack_get_result(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 2);
}
/**
* @brief Decode a command_ack message into a struct
*
* @param msg The message to decode
* @param command_ack C-struct to decode the message contents into
*/
static inline void mavlink_msg_command_ack_decode(const mavlink_message_t* msg, mavlink_command_ack_t* command_ack)
{
#if MAVLINK_NEED_BYTE_SWAP
command_ack->command = mavlink_msg_command_ack_get_command(msg);
command_ack->result = mavlink_msg_command_ack_get_result(msg);
#else
memcpy(command_ack, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_COMMAND_ACK_LEN);
#endif
}

View File

@ -0,0 +1,497 @@
// MESSAGE COMMAND_INT PACKING
#define MAVLINK_MSG_ID_COMMAND_INT 75
typedef struct __mavlink_command_int_t
{
float param1; /*< PARAM1, see MAV_CMD enum*/
float param2; /*< PARAM2, see MAV_CMD enum*/
float param3; /*< PARAM3, see MAV_CMD enum*/
float param4; /*< PARAM4, see MAV_CMD enum*/
int32_t x; /*< PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7*/
int32_t y; /*< PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7*/
float z; /*< PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.*/
uint16_t command; /*< The scheduled action for the mission item. see MAV_CMD in common.xml MAVLink specs*/
uint8_t target_system; /*< System ID*/
uint8_t target_component; /*< Component ID*/
uint8_t frame; /*< The coordinate system of the COMMAND. see MAV_FRAME in mavlink_types.h*/
uint8_t current; /*< false:0, true:1*/
uint8_t autocontinue; /*< autocontinue to next wp*/
} mavlink_command_int_t;
#define MAVLINK_MSG_ID_COMMAND_INT_LEN 35
#define MAVLINK_MSG_ID_75_LEN 35
#define MAVLINK_MSG_ID_COMMAND_INT_CRC 158
#define MAVLINK_MSG_ID_75_CRC 158
#define MAVLINK_MESSAGE_INFO_COMMAND_INT { \
"COMMAND_INT", \
13, \
{ { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_int_t, param1) }, \
{ "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_int_t, param2) }, \
{ "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_int_t, param3) }, \
{ "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_int_t, param4) }, \
{ "x", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_command_int_t, x) }, \
{ "y", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_command_int_t, y) }, \
{ "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_int_t, z) }, \
{ "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_int_t, command) }, \
{ "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_int_t, target_system) }, \
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_int_t, target_component) }, \
{ "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_int_t, frame) }, \
{ "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_command_int_t, current) }, \
{ "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_command_int_t, autocontinue) }, \
} \
}
/**
* @brief Pack a command_int message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param target_system System ID
* @param target_component Component ID
* @param frame The coordinate system of the COMMAND. see MAV_FRAME in mavlink_types.h
* @param command The scheduled action for the mission item. see MAV_CMD in common.xml MAVLink specs
* @param current false:0, true:1
* @param autocontinue autocontinue to next wp
* @param param1 PARAM1, see MAV_CMD enum
* @param param2 PARAM2, see MAV_CMD enum
* @param param3 PARAM3, see MAV_CMD enum
* @param param4 PARAM4, see MAV_CMD enum
* @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
* @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
* @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_command_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
_mav_put_float(buf, 0, param1);
_mav_put_float(buf, 4, param2);
_mav_put_float(buf, 8, param3);
_mav_put_float(buf, 12, param4);
_mav_put_int32_t(buf, 16, x);
_mav_put_int32_t(buf, 20, y);
_mav_put_float(buf, 24, z);
_mav_put_uint16_t(buf, 28, command);
_mav_put_uint8_t(buf, 30, target_system);
_mav_put_uint8_t(buf, 31, target_component);
_mav_put_uint8_t(buf, 32, frame);
_mav_put_uint8_t(buf, 33, current);
_mav_put_uint8_t(buf, 34, autocontinue);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#else
mavlink_command_int_t packet;
packet.param1 = param1;
packet.param2 = param2;
packet.param3 = param3;
packet.param4 = param4;
packet.x = x;
packet.y = y;
packet.z = z;
packet.command = command;
packet.target_system = target_system;
packet.target_component = target_component;
packet.frame = frame;
packet.current = current;
packet.autocontinue = autocontinue;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
}
/**
* @brief Pack a command_int message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System ID
* @param target_component Component ID
* @param frame The coordinate system of the COMMAND. see MAV_FRAME in mavlink_types.h
* @param command The scheduled action for the mission item. see MAV_CMD in common.xml MAVLink specs
* @param current false:0, true:1
* @param autocontinue autocontinue to next wp
* @param param1 PARAM1, see MAV_CMD enum
* @param param2 PARAM2, see MAV_CMD enum
* @param param3 PARAM3, see MAV_CMD enum
* @param param4 PARAM4, see MAV_CMD enum
* @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
* @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
* @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_command_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t target_component,uint8_t frame,uint16_t command,uint8_t current,uint8_t autocontinue,float param1,float param2,float param3,float param4,int32_t x,int32_t y,float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
_mav_put_float(buf, 0, param1);
_mav_put_float(buf, 4, param2);
_mav_put_float(buf, 8, param3);
_mav_put_float(buf, 12, param4);
_mav_put_int32_t(buf, 16, x);
_mav_put_int32_t(buf, 20, y);
_mav_put_float(buf, 24, z);
_mav_put_uint16_t(buf, 28, command);
_mav_put_uint8_t(buf, 30, target_system);
_mav_put_uint8_t(buf, 31, target_component);
_mav_put_uint8_t(buf, 32, frame);
_mav_put_uint8_t(buf, 33, current);
_mav_put_uint8_t(buf, 34, autocontinue);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#else
mavlink_command_int_t packet;
packet.param1 = param1;
packet.param2 = param2;
packet.param3 = param3;
packet.param4 = param4;
packet.x = x;
packet.y = y;
packet.z = z;
packet.command = command;
packet.target_system = target_system;
packet.target_component = target_component;
packet.frame = frame;
packet.current = current;
packet.autocontinue = autocontinue;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
}
/**
* @brief Encode a command_int struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param command_int C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_command_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_int_t* command_int)
{
return mavlink_msg_command_int_pack(system_id, component_id, msg, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z);
}
/**
* @brief Encode a command_int struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param command_int C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_command_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_int_t* command_int)
{
return mavlink_msg_command_int_pack_chan(system_id, component_id, chan, msg, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z);
}
/**
* @brief Send a command_int message
* @param chan MAVLink channel to send the message
*
* @param target_system System ID
* @param target_component Component ID
* @param frame The coordinate system of the COMMAND. see MAV_FRAME in mavlink_types.h
* @param command The scheduled action for the mission item. see MAV_CMD in common.xml MAVLink specs
* @param current false:0, true:1
* @param autocontinue autocontinue to next wp
* @param param1 PARAM1, see MAV_CMD enum
* @param param2 PARAM2, see MAV_CMD enum
* @param param3 PARAM3, see MAV_CMD enum
* @param param4 PARAM4, see MAV_CMD enum
* @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
* @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
* @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_command_int_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
_mav_put_float(buf, 0, param1);
_mav_put_float(buf, 4, param2);
_mav_put_float(buf, 8, param3);
_mav_put_float(buf, 12, param4);
_mav_put_int32_t(buf, 16, x);
_mav_put_int32_t(buf, 20, y);
_mav_put_float(buf, 24, z);
_mav_put_uint16_t(buf, 28, command);
_mav_put_uint8_t(buf, 30, target_system);
_mav_put_uint8_t(buf, 31, target_component);
_mav_put_uint8_t(buf, 32, frame);
_mav_put_uint8_t(buf, 33, current);
_mav_put_uint8_t(buf, 34, autocontinue);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
#else
mavlink_command_int_t packet;
packet.param1 = param1;
packet.param2 = param2;
packet.param3 = param3;
packet.param4 = param4;
packet.x = x;
packet.y = y;
packet.z = z;
packet.command = command;
packet.target_system = target_system;
packet.target_component = target_component;
packet.frame = frame;
packet.current = current;
packet.autocontinue = autocontinue;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_COMMAND_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_command_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_float(buf, 0, param1);
_mav_put_float(buf, 4, param2);
_mav_put_float(buf, 8, param3);
_mav_put_float(buf, 12, param4);
_mav_put_int32_t(buf, 16, x);
_mav_put_int32_t(buf, 20, y);
_mav_put_float(buf, 24, z);
_mav_put_uint16_t(buf, 28, command);
_mav_put_uint8_t(buf, 30, target_system);
_mav_put_uint8_t(buf, 31, target_component);
_mav_put_uint8_t(buf, 32, frame);
_mav_put_uint8_t(buf, 33, current);
_mav_put_uint8_t(buf, 34, autocontinue);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
#else
mavlink_command_int_t *packet = (mavlink_command_int_t *)msgbuf;
packet->param1 = param1;
packet->param2 = param2;
packet->param3 = param3;
packet->param4 = param4;
packet->x = x;
packet->y = y;
packet->z = z;
packet->command = command;
packet->target_system = target_system;
packet->target_component = target_component;
packet->frame = frame;
packet->current = current;
packet->autocontinue = autocontinue;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)packet, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE COMMAND_INT UNPACKING
/**
* @brief Get field target_system from command_int message
*
* @return System ID
*/
static inline uint8_t mavlink_msg_command_int_get_target_system(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 30);
}
/**
* @brief Get field target_component from command_int message
*
* @return Component ID
*/
static inline uint8_t mavlink_msg_command_int_get_target_component(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 31);
}
/**
* @brief Get field frame from command_int message
*
* @return The coordinate system of the COMMAND. see MAV_FRAME in mavlink_types.h
*/
static inline uint8_t mavlink_msg_command_int_get_frame(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 32);
}
/**
* @brief Get field command from command_int message
*
* @return The scheduled action for the mission item. see MAV_CMD in common.xml MAVLink specs
*/
static inline uint16_t mavlink_msg_command_int_get_command(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 28);
}
/**
* @brief Get field current from command_int message
*
* @return false:0, true:1
*/
static inline uint8_t mavlink_msg_command_int_get_current(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 33);
}
/**
* @brief Get field autocontinue from command_int message
*
* @return autocontinue to next wp
*/
static inline uint8_t mavlink_msg_command_int_get_autocontinue(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 34);
}
/**
* @brief Get field param1 from command_int message
*
* @return PARAM1, see MAV_CMD enum
*/
static inline float mavlink_msg_command_int_get_param1(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 0);
}
/**
* @brief Get field param2 from command_int message
*
* @return PARAM2, see MAV_CMD enum
*/
static inline float mavlink_msg_command_int_get_param2(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 4);
}
/**
* @brief Get field param3 from command_int message
*
* @return PARAM3, see MAV_CMD enum
*/
static inline float mavlink_msg_command_int_get_param3(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field param4 from command_int message
*
* @return PARAM4, see MAV_CMD enum
*/
static inline float mavlink_msg_command_int_get_param4(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field x from command_int message
*
* @return PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
*/
static inline int32_t mavlink_msg_command_int_get_x(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field y from command_int message
*
* @return PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
*/
static inline int32_t mavlink_msg_command_int_get_y(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 20);
}
/**
* @brief Get field z from command_int message
*
* @return PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.
*/
static inline float mavlink_msg_command_int_get_z(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Decode a command_int message into a struct
*
* @param msg The message to decode
* @param command_int C-struct to decode the message contents into
*/
static inline void mavlink_msg_command_int_decode(const mavlink_message_t* msg, mavlink_command_int_t* command_int)
{
#if MAVLINK_NEED_BYTE_SWAP
command_int->param1 = mavlink_msg_command_int_get_param1(msg);
command_int->param2 = mavlink_msg_command_int_get_param2(msg);
command_int->param3 = mavlink_msg_command_int_get_param3(msg);
command_int->param4 = mavlink_msg_command_int_get_param4(msg);
command_int->x = mavlink_msg_command_int_get_x(msg);
command_int->y = mavlink_msg_command_int_get_y(msg);
command_int->z = mavlink_msg_command_int_get_z(msg);
command_int->command = mavlink_msg_command_int_get_command(msg);
command_int->target_system = mavlink_msg_command_int_get_target_system(msg);
command_int->target_component = mavlink_msg_command_int_get_target_component(msg);
command_int->frame = mavlink_msg_command_int_get_frame(msg);
command_int->current = mavlink_msg_command_int_get_current(msg);
command_int->autocontinue = mavlink_msg_command_int_get_autocontinue(msg);
#else
memcpy(command_int, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_COMMAND_INT_LEN);
#endif
}

View File

@ -0,0 +1,449 @@
// MESSAGE COMMAND_LONG PACKING
#define MAVLINK_MSG_ID_COMMAND_LONG 76
typedef struct __mavlink_command_long_t
{
float param1; /*< Parameter 1, as defined by MAV_CMD enum.*/
float param2; /*< Parameter 2, as defined by MAV_CMD enum.*/
float param3; /*< Parameter 3, as defined by MAV_CMD enum.*/
float param4; /*< Parameter 4, as defined by MAV_CMD enum.*/
float param5; /*< Parameter 5, as defined by MAV_CMD enum.*/
float param6; /*< Parameter 6, as defined by MAV_CMD enum.*/
float param7; /*< Parameter 7, as defined by MAV_CMD enum.*/
uint16_t command; /*< Command ID, as defined by MAV_CMD enum.*/
uint8_t target_system; /*< System which should execute the command*/
uint8_t target_component; /*< Component which should execute the command, 0 for all components*/
uint8_t confirmation; /*< 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)*/
} mavlink_command_long_t;
#define MAVLINK_MSG_ID_COMMAND_LONG_LEN 33
#define MAVLINK_MSG_ID_76_LEN 33
#define MAVLINK_MSG_ID_COMMAND_LONG_CRC 152
#define MAVLINK_MSG_ID_76_CRC 152
#define MAVLINK_MESSAGE_INFO_COMMAND_LONG { \
"COMMAND_LONG", \
11, \
{ { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_long_t, param1) }, \
{ "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_long_t, param2) }, \
{ "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_long_t, param3) }, \
{ "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_long_t, param4) }, \
{ "param5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_long_t, param5) }, \
{ "param6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_command_long_t, param6) }, \
{ "param7", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_long_t, param7) }, \
{ "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_long_t, command) }, \
{ "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_long_t, target_system) }, \
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_long_t, target_component) }, \
{ "confirmation", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_long_t, confirmation) }, \
} \
}
/**
* @brief Pack a command_long message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param target_system System which should execute the command
* @param target_component Component which should execute the command, 0 for all components
* @param command Command ID, as defined by MAV_CMD enum.
* @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
* @param param1 Parameter 1, as defined by MAV_CMD enum.
* @param param2 Parameter 2, as defined by MAV_CMD enum.
* @param param3 Parameter 3, as defined by MAV_CMD enum.
* @param param4 Parameter 4, as defined by MAV_CMD enum.
* @param param5 Parameter 5, as defined by MAV_CMD enum.
* @param param6 Parameter 6, as defined by MAV_CMD enum.
* @param param7 Parameter 7, as defined by MAV_CMD enum.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_command_long_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_LONG_LEN];
_mav_put_float(buf, 0, param1);
_mav_put_float(buf, 4, param2);
_mav_put_float(buf, 8, param3);
_mav_put_float(buf, 12, param4);
_mav_put_float(buf, 16, param5);
_mav_put_float(buf, 20, param6);
_mav_put_float(buf, 24, param7);
_mav_put_uint16_t(buf, 28, command);
_mav_put_uint8_t(buf, 30, target_system);
_mav_put_uint8_t(buf, 31, target_component);
_mav_put_uint8_t(buf, 32, confirmation);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#else
mavlink_command_long_t packet;
packet.param1 = param1;
packet.param2 = param2;
packet.param3 = param3;
packet.param4 = param4;
packet.param5 = param5;
packet.param6 = param6;
packet.param7 = param7;
packet.command = command;
packet.target_system = target_system;
packet.target_component = target_component;
packet.confirmation = confirmation;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
}
/**
* @brief Pack a command_long message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System which should execute the command
* @param target_component Component which should execute the command, 0 for all components
* @param command Command ID, as defined by MAV_CMD enum.
* @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
* @param param1 Parameter 1, as defined by MAV_CMD enum.
* @param param2 Parameter 2, as defined by MAV_CMD enum.
* @param param3 Parameter 3, as defined by MAV_CMD enum.
* @param param4 Parameter 4, as defined by MAV_CMD enum.
* @param param5 Parameter 5, as defined by MAV_CMD enum.
* @param param6 Parameter 6, as defined by MAV_CMD enum.
* @param param7 Parameter 7, as defined by MAV_CMD enum.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_command_long_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t target_component,uint16_t command,uint8_t confirmation,float param1,float param2,float param3,float param4,float param5,float param6,float param7)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_LONG_LEN];
_mav_put_float(buf, 0, param1);
_mav_put_float(buf, 4, param2);
_mav_put_float(buf, 8, param3);
_mav_put_float(buf, 12, param4);
_mav_put_float(buf, 16, param5);
_mav_put_float(buf, 20, param6);
_mav_put_float(buf, 24, param7);
_mav_put_uint16_t(buf, 28, command);
_mav_put_uint8_t(buf, 30, target_system);
_mav_put_uint8_t(buf, 31, target_component);
_mav_put_uint8_t(buf, 32, confirmation);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#else
mavlink_command_long_t packet;
packet.param1 = param1;
packet.param2 = param2;
packet.param3 = param3;
packet.param4 = param4;
packet.param5 = param5;
packet.param6 = param6;
packet.param7 = param7;
packet.command = command;
packet.target_system = target_system;
packet.target_component = target_component;
packet.confirmation = confirmation;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
}
/**
* @brief Encode a command_long struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param command_long C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_command_long_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_long_t* command_long)
{
return mavlink_msg_command_long_pack(system_id, component_id, msg, command_long->target_system, command_long->target_component, command_long->command, command_long->confirmation, command_long->param1, command_long->param2, command_long->param3, command_long->param4, command_long->param5, command_long->param6, command_long->param7);
}
/**
* @brief Encode a command_long struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param command_long C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_command_long_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_long_t* command_long)
{
return mavlink_msg_command_long_pack_chan(system_id, component_id, chan, msg, command_long->target_system, command_long->target_component, command_long->command, command_long->confirmation, command_long->param1, command_long->param2, command_long->param3, command_long->param4, command_long->param5, command_long->param6, command_long->param7);
}
/**
* @brief Send a command_long message
* @param chan MAVLink channel to send the message
*
* @param target_system System which should execute the command
* @param target_component Component which should execute the command, 0 for all components
* @param command Command ID, as defined by MAV_CMD enum.
* @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
* @param param1 Parameter 1, as defined by MAV_CMD enum.
* @param param2 Parameter 2, as defined by MAV_CMD enum.
* @param param3 Parameter 3, as defined by MAV_CMD enum.
* @param param4 Parameter 4, as defined by MAV_CMD enum.
* @param param5 Parameter 5, as defined by MAV_CMD enum.
* @param param6 Parameter 6, as defined by MAV_CMD enum.
* @param param7 Parameter 7, as defined by MAV_CMD enum.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_command_long_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_COMMAND_LONG_LEN];
_mav_put_float(buf, 0, param1);
_mav_put_float(buf, 4, param2);
_mav_put_float(buf, 8, param3);
_mav_put_float(buf, 12, param4);
_mav_put_float(buf, 16, param5);
_mav_put_float(buf, 20, param6);
_mav_put_float(buf, 24, param7);
_mav_put_uint16_t(buf, 28, command);
_mav_put_uint8_t(buf, 30, target_system);
_mav_put_uint8_t(buf, 31, target_component);
_mav_put_uint8_t(buf, 32, confirmation);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
#else
mavlink_command_long_t packet;
packet.param1 = param1;
packet.param2 = param2;
packet.param3 = param3;
packet.param4 = param4;
packet.param5 = param5;
packet.param6 = param6;
packet.param7 = param7;
packet.command = command;
packet.target_system = target_system;
packet.target_component = target_component;
packet.confirmation = confirmation;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_COMMAND_LONG_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_command_long_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_float(buf, 0, param1);
_mav_put_float(buf, 4, param2);
_mav_put_float(buf, 8, param3);
_mav_put_float(buf, 12, param4);
_mav_put_float(buf, 16, param5);
_mav_put_float(buf, 20, param6);
_mav_put_float(buf, 24, param7);
_mav_put_uint16_t(buf, 28, command);
_mav_put_uint8_t(buf, 30, target_system);
_mav_put_uint8_t(buf, 31, target_component);
_mav_put_uint8_t(buf, 32, confirmation);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
#else
mavlink_command_long_t *packet = (mavlink_command_long_t *)msgbuf;
packet->param1 = param1;
packet->param2 = param2;
packet->param3 = param3;
packet->param4 = param4;
packet->param5 = param5;
packet->param6 = param6;
packet->param7 = param7;
packet->command = command;
packet->target_system = target_system;
packet->target_component = target_component;
packet->confirmation = confirmation;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE COMMAND_LONG UNPACKING
/**
* @brief Get field target_system from command_long message
*
* @return System which should execute the command
*/
static inline uint8_t mavlink_msg_command_long_get_target_system(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 30);
}
/**
* @brief Get field target_component from command_long message
*
* @return Component which should execute the command, 0 for all components
*/
static inline uint8_t mavlink_msg_command_long_get_target_component(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 31);
}
/**
* @brief Get field command from command_long message
*
* @return Command ID, as defined by MAV_CMD enum.
*/
static inline uint16_t mavlink_msg_command_long_get_command(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 28);
}
/**
* @brief Get field confirmation from command_long message
*
* @return 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
*/
static inline uint8_t mavlink_msg_command_long_get_confirmation(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 32);
}
/**
* @brief Get field param1 from command_long message
*
* @return Parameter 1, as defined by MAV_CMD enum.
*/
static inline float mavlink_msg_command_long_get_param1(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 0);
}
/**
* @brief Get field param2 from command_long message
*
* @return Parameter 2, as defined by MAV_CMD enum.
*/
static inline float mavlink_msg_command_long_get_param2(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 4);
}
/**
* @brief Get field param3 from command_long message
*
* @return Parameter 3, as defined by MAV_CMD enum.
*/
static inline float mavlink_msg_command_long_get_param3(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field param4 from command_long message
*
* @return Parameter 4, as defined by MAV_CMD enum.
*/
static inline float mavlink_msg_command_long_get_param4(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field param5 from command_long message
*
* @return Parameter 5, as defined by MAV_CMD enum.
*/
static inline float mavlink_msg_command_long_get_param5(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field param6 from command_long message
*
* @return Parameter 6, as defined by MAV_CMD enum.
*/
static inline float mavlink_msg_command_long_get_param6(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field param7 from command_long message
*
* @return Parameter 7, as defined by MAV_CMD enum.
*/
static inline float mavlink_msg_command_long_get_param7(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Decode a command_long message into a struct
*
* @param msg The message to decode
* @param command_long C-struct to decode the message contents into
*/
static inline void mavlink_msg_command_long_decode(const mavlink_message_t* msg, mavlink_command_long_t* command_long)
{
#if MAVLINK_NEED_BYTE_SWAP
command_long->param1 = mavlink_msg_command_long_get_param1(msg);
command_long->param2 = mavlink_msg_command_long_get_param2(msg);
command_long->param3 = mavlink_msg_command_long_get_param3(msg);
command_long->param4 = mavlink_msg_command_long_get_param4(msg);
command_long->param5 = mavlink_msg_command_long_get_param5(msg);
command_long->param6 = mavlink_msg_command_long_get_param6(msg);
command_long->param7 = mavlink_msg_command_long_get_param7(msg);
command_long->command = mavlink_msg_command_long_get_command(msg);
command_long->target_system = mavlink_msg_command_long_get_target_system(msg);
command_long->target_component = mavlink_msg_command_long_get_target_component(msg);
command_long->confirmation = mavlink_msg_command_long_get_confirmation(msg);
#else
memcpy(command_long, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_COMMAND_LONG_LEN);
#endif
}

View File

@ -0,0 +1,587 @@
// MESSAGE CONTROL_SYSTEM_STATE PACKING
#define MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE 146
typedef struct __mavlink_control_system_state_t
{
uint64_t time_usec; /*< Timestamp (micros since boot or Unix epoch)*/
float x_acc; /*< X acceleration in body frame*/
float y_acc; /*< Y acceleration in body frame*/
float z_acc; /*< Z acceleration in body frame*/
float x_vel; /*< X velocity in body frame*/
float y_vel; /*< Y velocity in body frame*/
float z_vel; /*< Z velocity in body frame*/
float x_pos; /*< X position in local frame*/
float y_pos; /*< Y position in local frame*/
float z_pos; /*< Z position in local frame*/
float airspeed; /*< Airspeed, set to -1 if unknown*/
float vel_variance[3]; /*< Variance of body velocity estimate*/
float pos_variance[3]; /*< Variance in local position*/
float q[4]; /*< The attitude, represented as Quaternion*/
float roll_rate; /*< Angular rate in roll axis*/
float pitch_rate; /*< Angular rate in pitch axis*/
float yaw_rate; /*< Angular rate in yaw axis*/
} mavlink_control_system_state_t;
#define MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN 100
#define MAVLINK_MSG_ID_146_LEN 100
#define MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC 103
#define MAVLINK_MSG_ID_146_CRC 103
#define MAVLINK_MSG_CONTROL_SYSTEM_STATE_FIELD_VEL_VARIANCE_LEN 3
#define MAVLINK_MSG_CONTROL_SYSTEM_STATE_FIELD_POS_VARIANCE_LEN 3
#define MAVLINK_MSG_CONTROL_SYSTEM_STATE_FIELD_Q_LEN 4
#define MAVLINK_MESSAGE_INFO_CONTROL_SYSTEM_STATE { \
"CONTROL_SYSTEM_STATE", \
17, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_control_system_state_t, time_usec) }, \
{ "x_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_control_system_state_t, x_acc) }, \
{ "y_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_control_system_state_t, y_acc) }, \
{ "z_acc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_control_system_state_t, z_acc) }, \
{ "x_vel", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_control_system_state_t, x_vel) }, \
{ "y_vel", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_control_system_state_t, y_vel) }, \
{ "z_vel", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_control_system_state_t, z_vel) }, \
{ "x_pos", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_control_system_state_t, x_pos) }, \
{ "y_pos", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_control_system_state_t, y_pos) }, \
{ "z_pos", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_control_system_state_t, z_pos) }, \
{ "airspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_control_system_state_t, airspeed) }, \
{ "vel_variance", NULL, MAVLINK_TYPE_FLOAT, 3, 48, offsetof(mavlink_control_system_state_t, vel_variance) }, \
{ "pos_variance", NULL, MAVLINK_TYPE_FLOAT, 3, 60, offsetof(mavlink_control_system_state_t, pos_variance) }, \
{ "q", NULL, MAVLINK_TYPE_FLOAT, 4, 72, offsetof(mavlink_control_system_state_t, q) }, \
{ "roll_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 88, offsetof(mavlink_control_system_state_t, roll_rate) }, \
{ "pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 92, offsetof(mavlink_control_system_state_t, pitch_rate) }, \
{ "yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 96, offsetof(mavlink_control_system_state_t, yaw_rate) }, \
} \
}
/**
* @brief Pack a control_system_state message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param x_acc X acceleration in body frame
* @param y_acc Y acceleration in body frame
* @param z_acc Z acceleration in body frame
* @param x_vel X velocity in body frame
* @param y_vel Y velocity in body frame
* @param z_vel Z velocity in body frame
* @param x_pos X position in local frame
* @param y_pos Y position in local frame
* @param z_pos Z position in local frame
* @param airspeed Airspeed, set to -1 if unknown
* @param vel_variance Variance of body velocity estimate
* @param pos_variance Variance in local position
* @param q The attitude, represented as Quaternion
* @param roll_rate Angular rate in roll axis
* @param pitch_rate Angular rate in pitch axis
* @param yaw_rate Angular rate in yaw axis
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_control_system_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, float x_acc, float y_acc, float z_acc, float x_vel, float y_vel, float z_vel, float x_pos, float y_pos, float z_pos, float airspeed, const float *vel_variance, const float *pos_variance, const float *q, float roll_rate, float pitch_rate, float yaw_rate)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, x_acc);
_mav_put_float(buf, 12, y_acc);
_mav_put_float(buf, 16, z_acc);
_mav_put_float(buf, 20, x_vel);
_mav_put_float(buf, 24, y_vel);
_mav_put_float(buf, 28, z_vel);
_mav_put_float(buf, 32, x_pos);
_mav_put_float(buf, 36, y_pos);
_mav_put_float(buf, 40, z_pos);
_mav_put_float(buf, 44, airspeed);
_mav_put_float(buf, 88, roll_rate);
_mav_put_float(buf, 92, pitch_rate);
_mav_put_float(buf, 96, yaw_rate);
_mav_put_float_array(buf, 48, vel_variance, 3);
_mav_put_float_array(buf, 60, pos_variance, 3);
_mav_put_float_array(buf, 72, q, 4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#else
mavlink_control_system_state_t packet;
packet.time_usec = time_usec;
packet.x_acc = x_acc;
packet.y_acc = y_acc;
packet.z_acc = z_acc;
packet.x_vel = x_vel;
packet.y_vel = y_vel;
packet.z_vel = z_vel;
packet.x_pos = x_pos;
packet.y_pos = y_pos;
packet.z_pos = z_pos;
packet.airspeed = airspeed;
packet.roll_rate = roll_rate;
packet.pitch_rate = pitch_rate;
packet.yaw_rate = yaw_rate;
mav_array_memcpy(packet.vel_variance, vel_variance, sizeof(float)*3);
mav_array_memcpy(packet.pos_variance, pos_variance, sizeof(float)*3);
mav_array_memcpy(packet.q, q, sizeof(float)*4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
}
/**
* @brief Pack a control_system_state message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param x_acc X acceleration in body frame
* @param y_acc Y acceleration in body frame
* @param z_acc Z acceleration in body frame
* @param x_vel X velocity in body frame
* @param y_vel Y velocity in body frame
* @param z_vel Z velocity in body frame
* @param x_pos X position in local frame
* @param y_pos Y position in local frame
* @param z_pos Z position in local frame
* @param airspeed Airspeed, set to -1 if unknown
* @param vel_variance Variance of body velocity estimate
* @param pos_variance Variance in local position
* @param q The attitude, represented as Quaternion
* @param roll_rate Angular rate in roll axis
* @param pitch_rate Angular rate in pitch axis
* @param yaw_rate Angular rate in yaw axis
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_control_system_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,float x_acc,float y_acc,float z_acc,float x_vel,float y_vel,float z_vel,float x_pos,float y_pos,float z_pos,float airspeed,const float *vel_variance,const float *pos_variance,const float *q,float roll_rate,float pitch_rate,float yaw_rate)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, x_acc);
_mav_put_float(buf, 12, y_acc);
_mav_put_float(buf, 16, z_acc);
_mav_put_float(buf, 20, x_vel);
_mav_put_float(buf, 24, y_vel);
_mav_put_float(buf, 28, z_vel);
_mav_put_float(buf, 32, x_pos);
_mav_put_float(buf, 36, y_pos);
_mav_put_float(buf, 40, z_pos);
_mav_put_float(buf, 44, airspeed);
_mav_put_float(buf, 88, roll_rate);
_mav_put_float(buf, 92, pitch_rate);
_mav_put_float(buf, 96, yaw_rate);
_mav_put_float_array(buf, 48, vel_variance, 3);
_mav_put_float_array(buf, 60, pos_variance, 3);
_mav_put_float_array(buf, 72, q, 4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#else
mavlink_control_system_state_t packet;
packet.time_usec = time_usec;
packet.x_acc = x_acc;
packet.y_acc = y_acc;
packet.z_acc = z_acc;
packet.x_vel = x_vel;
packet.y_vel = y_vel;
packet.z_vel = z_vel;
packet.x_pos = x_pos;
packet.y_pos = y_pos;
packet.z_pos = z_pos;
packet.airspeed = airspeed;
packet.roll_rate = roll_rate;
packet.pitch_rate = pitch_rate;
packet.yaw_rate = yaw_rate;
mav_array_memcpy(packet.vel_variance, vel_variance, sizeof(float)*3);
mav_array_memcpy(packet.pos_variance, pos_variance, sizeof(float)*3);
mav_array_memcpy(packet.q, q, sizeof(float)*4);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
}
/**
* @brief Encode a control_system_state struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param control_system_state C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_control_system_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_control_system_state_t* control_system_state)
{
return mavlink_msg_control_system_state_pack(system_id, component_id, msg, control_system_state->time_usec, control_system_state->x_acc, control_system_state->y_acc, control_system_state->z_acc, control_system_state->x_vel, control_system_state->y_vel, control_system_state->z_vel, control_system_state->x_pos, control_system_state->y_pos, control_system_state->z_pos, control_system_state->airspeed, control_system_state->vel_variance, control_system_state->pos_variance, control_system_state->q, control_system_state->roll_rate, control_system_state->pitch_rate, control_system_state->yaw_rate);
}
/**
* @brief Encode a control_system_state struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param control_system_state C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_control_system_state_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_control_system_state_t* control_system_state)
{
return mavlink_msg_control_system_state_pack_chan(system_id, component_id, chan, msg, control_system_state->time_usec, control_system_state->x_acc, control_system_state->y_acc, control_system_state->z_acc, control_system_state->x_vel, control_system_state->y_vel, control_system_state->z_vel, control_system_state->x_pos, control_system_state->y_pos, control_system_state->z_pos, control_system_state->airspeed, control_system_state->vel_variance, control_system_state->pos_variance, control_system_state->q, control_system_state->roll_rate, control_system_state->pitch_rate, control_system_state->yaw_rate);
}
/**
* @brief Send a control_system_state message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param x_acc X acceleration in body frame
* @param y_acc Y acceleration in body frame
* @param z_acc Z acceleration in body frame
* @param x_vel X velocity in body frame
* @param y_vel Y velocity in body frame
* @param z_vel Z velocity in body frame
* @param x_pos X position in local frame
* @param y_pos Y position in local frame
* @param z_pos Z position in local frame
* @param airspeed Airspeed, set to -1 if unknown
* @param vel_variance Variance of body velocity estimate
* @param pos_variance Variance in local position
* @param q The attitude, represented as Quaternion
* @param roll_rate Angular rate in roll axis
* @param pitch_rate Angular rate in pitch axis
* @param yaw_rate Angular rate in yaw axis
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_control_system_state_send(mavlink_channel_t chan, uint64_t time_usec, float x_acc, float y_acc, float z_acc, float x_vel, float y_vel, float z_vel, float x_pos, float y_pos, float z_pos, float airspeed, const float *vel_variance, const float *pos_variance, const float *q, float roll_rate, float pitch_rate, float yaw_rate)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, x_acc);
_mav_put_float(buf, 12, y_acc);
_mav_put_float(buf, 16, z_acc);
_mav_put_float(buf, 20, x_vel);
_mav_put_float(buf, 24, y_vel);
_mav_put_float(buf, 28, z_vel);
_mav_put_float(buf, 32, x_pos);
_mav_put_float(buf, 36, y_pos);
_mav_put_float(buf, 40, z_pos);
_mav_put_float(buf, 44, airspeed);
_mav_put_float(buf, 88, roll_rate);
_mav_put_float(buf, 92, pitch_rate);
_mav_put_float(buf, 96, yaw_rate);
_mav_put_float_array(buf, 48, vel_variance, 3);
_mav_put_float_array(buf, 60, pos_variance, 3);
_mav_put_float_array(buf, 72, q, 4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
#else
mavlink_control_system_state_t packet;
packet.time_usec = time_usec;
packet.x_acc = x_acc;
packet.y_acc = y_acc;
packet.z_acc = z_acc;
packet.x_vel = x_vel;
packet.y_vel = y_vel;
packet.z_vel = z_vel;
packet.x_pos = x_pos;
packet.y_pos = y_pos;
packet.z_pos = z_pos;
packet.airspeed = airspeed;
packet.roll_rate = roll_rate;
packet.pitch_rate = pitch_rate;
packet.yaw_rate = yaw_rate;
mav_array_memcpy(packet.vel_variance, vel_variance, sizeof(float)*3);
mav_array_memcpy(packet.pos_variance, pos_variance, sizeof(float)*3);
mav_array_memcpy(packet.q, q, sizeof(float)*4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, (const char *)&packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, (const char *)&packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_control_system_state_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float x_acc, float y_acc, float z_acc, float x_vel, float y_vel, float z_vel, float x_pos, float y_pos, float z_pos, float airspeed, const float *vel_variance, const float *pos_variance, const float *q, float roll_rate, float pitch_rate, float yaw_rate)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, x_acc);
_mav_put_float(buf, 12, y_acc);
_mav_put_float(buf, 16, z_acc);
_mav_put_float(buf, 20, x_vel);
_mav_put_float(buf, 24, y_vel);
_mav_put_float(buf, 28, z_vel);
_mav_put_float(buf, 32, x_pos);
_mav_put_float(buf, 36, y_pos);
_mav_put_float(buf, 40, z_pos);
_mav_put_float(buf, 44, airspeed);
_mav_put_float(buf, 88, roll_rate);
_mav_put_float(buf, 92, pitch_rate);
_mav_put_float(buf, 96, yaw_rate);
_mav_put_float_array(buf, 48, vel_variance, 3);
_mav_put_float_array(buf, 60, pos_variance, 3);
_mav_put_float_array(buf, 72, q, 4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, buf, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
#else
mavlink_control_system_state_t *packet = (mavlink_control_system_state_t *)msgbuf;
packet->time_usec = time_usec;
packet->x_acc = x_acc;
packet->y_acc = y_acc;
packet->z_acc = z_acc;
packet->x_vel = x_vel;
packet->y_vel = y_vel;
packet->z_vel = z_vel;
packet->x_pos = x_pos;
packet->y_pos = y_pos;
packet->z_pos = z_pos;
packet->airspeed = airspeed;
packet->roll_rate = roll_rate;
packet->pitch_rate = pitch_rate;
packet->yaw_rate = yaw_rate;
mav_array_memcpy(packet->vel_variance, vel_variance, sizeof(float)*3);
mav_array_memcpy(packet->pos_variance, pos_variance, sizeof(float)*3);
mav_array_memcpy(packet->q, q, sizeof(float)*4);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, (const char *)packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE, (const char *)packet, MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE CONTROL_SYSTEM_STATE UNPACKING
/**
* @brief Get field time_usec from control_system_state message
*
* @return Timestamp (micros since boot or Unix epoch)
*/
static inline uint64_t mavlink_msg_control_system_state_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field x_acc from control_system_state message
*
* @return X acceleration in body frame
*/
static inline float mavlink_msg_control_system_state_get_x_acc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field y_acc from control_system_state message
*
* @return Y acceleration in body frame
*/
static inline float mavlink_msg_control_system_state_get_y_acc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field z_acc from control_system_state message
*
* @return Z acceleration in body frame
*/
static inline float mavlink_msg_control_system_state_get_z_acc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field x_vel from control_system_state message
*
* @return X velocity in body frame
*/
static inline float mavlink_msg_control_system_state_get_x_vel(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field y_vel from control_system_state message
*
* @return Y velocity in body frame
*/
static inline float mavlink_msg_control_system_state_get_y_vel(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field z_vel from control_system_state message
*
* @return Z velocity in body frame
*/
static inline float mavlink_msg_control_system_state_get_z_vel(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field x_pos from control_system_state message
*
* @return X position in local frame
*/
static inline float mavlink_msg_control_system_state_get_x_pos(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 32);
}
/**
* @brief Get field y_pos from control_system_state message
*
* @return Y position in local frame
*/
static inline float mavlink_msg_control_system_state_get_y_pos(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 36);
}
/**
* @brief Get field z_pos from control_system_state message
*
* @return Z position in local frame
*/
static inline float mavlink_msg_control_system_state_get_z_pos(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 40);
}
/**
* @brief Get field airspeed from control_system_state message
*
* @return Airspeed, set to -1 if unknown
*/
static inline float mavlink_msg_control_system_state_get_airspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 44);
}
/**
* @brief Get field vel_variance from control_system_state message
*
* @return Variance of body velocity estimate
*/
static inline uint16_t mavlink_msg_control_system_state_get_vel_variance(const mavlink_message_t* msg, float *vel_variance)
{
return _MAV_RETURN_float_array(msg, vel_variance, 3, 48);
}
/**
* @brief Get field pos_variance from control_system_state message
*
* @return Variance in local position
*/
static inline uint16_t mavlink_msg_control_system_state_get_pos_variance(const mavlink_message_t* msg, float *pos_variance)
{
return _MAV_RETURN_float_array(msg, pos_variance, 3, 60);
}
/**
* @brief Get field q from control_system_state message
*
* @return The attitude, represented as Quaternion
*/
static inline uint16_t mavlink_msg_control_system_state_get_q(const mavlink_message_t* msg, float *q)
{
return _MAV_RETURN_float_array(msg, q, 4, 72);
}
/**
* @brief Get field roll_rate from control_system_state message
*
* @return Angular rate in roll axis
*/
static inline float mavlink_msg_control_system_state_get_roll_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 88);
}
/**
* @brief Get field pitch_rate from control_system_state message
*
* @return Angular rate in pitch axis
*/
static inline float mavlink_msg_control_system_state_get_pitch_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 92);
}
/**
* @brief Get field yaw_rate from control_system_state message
*
* @return Angular rate in yaw axis
*/
static inline float mavlink_msg_control_system_state_get_yaw_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 96);
}
/**
* @brief Decode a control_system_state message into a struct
*
* @param msg The message to decode
* @param control_system_state C-struct to decode the message contents into
*/
static inline void mavlink_msg_control_system_state_decode(const mavlink_message_t* msg, mavlink_control_system_state_t* control_system_state)
{
#if MAVLINK_NEED_BYTE_SWAP
control_system_state->time_usec = mavlink_msg_control_system_state_get_time_usec(msg);
control_system_state->x_acc = mavlink_msg_control_system_state_get_x_acc(msg);
control_system_state->y_acc = mavlink_msg_control_system_state_get_y_acc(msg);
control_system_state->z_acc = mavlink_msg_control_system_state_get_z_acc(msg);
control_system_state->x_vel = mavlink_msg_control_system_state_get_x_vel(msg);
control_system_state->y_vel = mavlink_msg_control_system_state_get_y_vel(msg);
control_system_state->z_vel = mavlink_msg_control_system_state_get_z_vel(msg);
control_system_state->x_pos = mavlink_msg_control_system_state_get_x_pos(msg);
control_system_state->y_pos = mavlink_msg_control_system_state_get_y_pos(msg);
control_system_state->z_pos = mavlink_msg_control_system_state_get_z_pos(msg);
control_system_state->airspeed = mavlink_msg_control_system_state_get_airspeed(msg);
mavlink_msg_control_system_state_get_vel_variance(msg, control_system_state->vel_variance);
mavlink_msg_control_system_state_get_pos_variance(msg, control_system_state->pos_variance);
mavlink_msg_control_system_state_get_q(msg, control_system_state->q);
control_system_state->roll_rate = mavlink_msg_control_system_state_get_roll_rate(msg);
control_system_state->pitch_rate = mavlink_msg_control_system_state_get_pitch_rate(msg);
control_system_state->yaw_rate = mavlink_msg_control_system_state_get_yaw_rate(msg);
#else
memcpy(control_system_state, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_LEN);
#endif
}

View File

@ -0,0 +1,257 @@
// MESSAGE DATA_STREAM PACKING
#define MAVLINK_MSG_ID_DATA_STREAM 67
typedef struct __mavlink_data_stream_t
{
uint16_t message_rate; /*< The message rate*/
uint8_t stream_id; /*< The ID of the requested data stream*/
uint8_t on_off; /*< 1 stream is enabled, 0 stream is stopped.*/
} mavlink_data_stream_t;
#define MAVLINK_MSG_ID_DATA_STREAM_LEN 4
#define MAVLINK_MSG_ID_67_LEN 4
#define MAVLINK_MSG_ID_DATA_STREAM_CRC 21
#define MAVLINK_MSG_ID_67_CRC 21
#define MAVLINK_MESSAGE_INFO_DATA_STREAM { \
"DATA_STREAM", \
3, \
{ { "message_rate", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_data_stream_t, message_rate) }, \
{ "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_data_stream_t, stream_id) }, \
{ "on_off", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_data_stream_t, on_off) }, \
} \
}
/**
* @brief Pack a data_stream message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param stream_id The ID of the requested data stream
* @param message_rate The message rate
* @param on_off 1 stream is enabled, 0 stream is stopped.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_data_stream_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t stream_id, uint16_t message_rate, uint8_t on_off)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DATA_STREAM_LEN];
_mav_put_uint16_t(buf, 0, message_rate);
_mav_put_uint8_t(buf, 2, stream_id);
_mav_put_uint8_t(buf, 3, on_off);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#else
mavlink_data_stream_t packet;
packet.message_rate = message_rate;
packet.stream_id = stream_id;
packet.on_off = on_off;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DATA_STREAM;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_STREAM_LEN, MAVLINK_MSG_ID_DATA_STREAM_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
}
/**
* @brief Pack a data_stream message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param stream_id The ID of the requested data stream
* @param message_rate The message rate
* @param on_off 1 stream is enabled, 0 stream is stopped.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_data_stream_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t stream_id,uint16_t message_rate,uint8_t on_off)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DATA_STREAM_LEN];
_mav_put_uint16_t(buf, 0, message_rate);
_mav_put_uint8_t(buf, 2, stream_id);
_mav_put_uint8_t(buf, 3, on_off);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#else
mavlink_data_stream_t packet;
packet.message_rate = message_rate;
packet.stream_id = stream_id;
packet.on_off = on_off;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DATA_STREAM;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA_STREAM_LEN, MAVLINK_MSG_ID_DATA_STREAM_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
}
/**
* @brief Encode a data_stream struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param data_stream C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_data_stream_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_data_stream_t* data_stream)
{
return mavlink_msg_data_stream_pack(system_id, component_id, msg, data_stream->stream_id, data_stream->message_rate, data_stream->on_off);
}
/**
* @brief Encode a data_stream struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param data_stream C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_data_stream_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_data_stream_t* data_stream)
{
return mavlink_msg_data_stream_pack_chan(system_id, component_id, chan, msg, data_stream->stream_id, data_stream->message_rate, data_stream->on_off);
}
/**
* @brief Send a data_stream message
* @param chan MAVLink channel to send the message
*
* @param stream_id The ID of the requested data stream
* @param message_rate The message rate
* @param on_off 1 stream is enabled, 0 stream is stopped.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_data_stream_send(mavlink_channel_t chan, uint8_t stream_id, uint16_t message_rate, uint8_t on_off)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DATA_STREAM_LEN];
_mav_put_uint16_t(buf, 0, message_rate);
_mav_put_uint8_t(buf, 2, stream_id);
_mav_put_uint8_t(buf, 3, on_off);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_STREAM, buf, MAVLINK_MSG_ID_DATA_STREAM_LEN, MAVLINK_MSG_ID_DATA_STREAM_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_STREAM, buf, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
#else
mavlink_data_stream_t packet;
packet.message_rate = message_rate;
packet.stream_id = stream_id;
packet.on_off = on_off;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_STREAM, (const char *)&packet, MAVLINK_MSG_ID_DATA_STREAM_LEN, MAVLINK_MSG_ID_DATA_STREAM_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_STREAM, (const char *)&packet, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_DATA_STREAM_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_data_stream_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t stream_id, uint16_t message_rate, uint8_t on_off)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint16_t(buf, 0, message_rate);
_mav_put_uint8_t(buf, 2, stream_id);
_mav_put_uint8_t(buf, 3, on_off);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_STREAM, buf, MAVLINK_MSG_ID_DATA_STREAM_LEN, MAVLINK_MSG_ID_DATA_STREAM_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_STREAM, buf, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
#else
mavlink_data_stream_t *packet = (mavlink_data_stream_t *)msgbuf;
packet->message_rate = message_rate;
packet->stream_id = stream_id;
packet->on_off = on_off;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_STREAM, (const char *)packet, MAVLINK_MSG_ID_DATA_STREAM_LEN, MAVLINK_MSG_ID_DATA_STREAM_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_STREAM, (const char *)packet, MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE DATA_STREAM UNPACKING
/**
* @brief Get field stream_id from data_stream message
*
* @return The ID of the requested data stream
*/
static inline uint8_t mavlink_msg_data_stream_get_stream_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 2);
}
/**
* @brief Get field message_rate from data_stream message
*
* @return The message rate
*/
static inline uint16_t mavlink_msg_data_stream_get_message_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 0);
}
/**
* @brief Get field on_off from data_stream message
*
* @return 1 stream is enabled, 0 stream is stopped.
*/
static inline uint8_t mavlink_msg_data_stream_get_on_off(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 3);
}
/**
* @brief Decode a data_stream message into a struct
*
* @param msg The message to decode
* @param data_stream C-struct to decode the message contents into
*/
static inline void mavlink_msg_data_stream_decode(const mavlink_message_t* msg, mavlink_data_stream_t* data_stream)
{
#if MAVLINK_NEED_BYTE_SWAP
data_stream->message_rate = mavlink_msg_data_stream_get_message_rate(msg);
data_stream->stream_id = mavlink_msg_data_stream_get_stream_id(msg);
data_stream->on_off = mavlink_msg_data_stream_get_on_off(msg);
#else
memcpy(data_stream, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_DATA_STREAM_LEN);
#endif
}

View File

@ -0,0 +1,353 @@
// MESSAGE DATA_TRANSMISSION_HANDSHAKE PACKING
#define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE 130
typedef struct __mavlink_data_transmission_handshake_t
{
uint32_t size; /*< total data size in bytes (set on ACK only)*/
uint16_t width; /*< Width of a matrix or image*/
uint16_t height; /*< Height of a matrix or image*/
uint16_t packets; /*< number of packets beeing sent (set on ACK only)*/
uint8_t type; /*< type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)*/
uint8_t payload; /*< payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)*/
uint8_t jpg_quality; /*< JPEG quality out of [1,100]*/
} mavlink_data_transmission_handshake_t;
#define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN 13
#define MAVLINK_MSG_ID_130_LEN 13
#define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC 29
#define MAVLINK_MSG_ID_130_CRC 29
#define MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE { \
"DATA_TRANSMISSION_HANDSHAKE", \
7, \
{ { "size", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_data_transmission_handshake_t, size) }, \
{ "width", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_data_transmission_handshake_t, width) }, \
{ "height", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_data_transmission_handshake_t, height) }, \
{ "packets", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_data_transmission_handshake_t, packets) }, \
{ "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_data_transmission_handshake_t, type) }, \
{ "payload", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_data_transmission_handshake_t, payload) }, \
{ "jpg_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_data_transmission_handshake_t, jpg_quality) }, \
} \
}
/**
* @brief Pack a data_transmission_handshake message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param type type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
* @param size total data size in bytes (set on ACK only)
* @param width Width of a matrix or image
* @param height Height of a matrix or image
* @param packets number of packets beeing sent (set on ACK only)
* @param payload payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
* @param jpg_quality JPEG quality out of [1,100]
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_data_transmission_handshake_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t type, uint32_t size, uint16_t width, uint16_t height, uint16_t packets, uint8_t payload, uint8_t jpg_quality)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN];
_mav_put_uint32_t(buf, 0, size);
_mav_put_uint16_t(buf, 4, width);
_mav_put_uint16_t(buf, 6, height);
_mav_put_uint16_t(buf, 8, packets);
_mav_put_uint8_t(buf, 10, type);
_mav_put_uint8_t(buf, 11, payload);
_mav_put_uint8_t(buf, 12, jpg_quality);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#else
mavlink_data_transmission_handshake_t packet;
packet.size = size;
packet.width = width;
packet.height = height;
packet.packets = packets;
packet.type = type;
packet.payload = payload;
packet.jpg_quality = jpg_quality;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
}
/**
* @brief Pack a data_transmission_handshake message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param type type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
* @param size total data size in bytes (set on ACK only)
* @param width Width of a matrix or image
* @param height Height of a matrix or image
* @param packets number of packets beeing sent (set on ACK only)
* @param payload payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
* @param jpg_quality JPEG quality out of [1,100]
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_data_transmission_handshake_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t type,uint32_t size,uint16_t width,uint16_t height,uint16_t packets,uint8_t payload,uint8_t jpg_quality)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN];
_mav_put_uint32_t(buf, 0, size);
_mav_put_uint16_t(buf, 4, width);
_mav_put_uint16_t(buf, 6, height);
_mav_put_uint16_t(buf, 8, packets);
_mav_put_uint8_t(buf, 10, type);
_mav_put_uint8_t(buf, 11, payload);
_mav_put_uint8_t(buf, 12, jpg_quality);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#else
mavlink_data_transmission_handshake_t packet;
packet.size = size;
packet.width = width;
packet.height = height;
packet.packets = packets;
packet.type = type;
packet.payload = payload;
packet.jpg_quality = jpg_quality;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
}
/**
* @brief Encode a data_transmission_handshake struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param data_transmission_handshake C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_data_transmission_handshake_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_data_transmission_handshake_t* data_transmission_handshake)
{
return mavlink_msg_data_transmission_handshake_pack(system_id, component_id, msg, data_transmission_handshake->type, data_transmission_handshake->size, data_transmission_handshake->width, data_transmission_handshake->height, data_transmission_handshake->packets, data_transmission_handshake->payload, data_transmission_handshake->jpg_quality);
}
/**
* @brief Encode a data_transmission_handshake struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param data_transmission_handshake C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_data_transmission_handshake_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_data_transmission_handshake_t* data_transmission_handshake)
{
return mavlink_msg_data_transmission_handshake_pack_chan(system_id, component_id, chan, msg, data_transmission_handshake->type, data_transmission_handshake->size, data_transmission_handshake->width, data_transmission_handshake->height, data_transmission_handshake->packets, data_transmission_handshake->payload, data_transmission_handshake->jpg_quality);
}
/**
* @brief Send a data_transmission_handshake message
* @param chan MAVLink channel to send the message
*
* @param type type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
* @param size total data size in bytes (set on ACK only)
* @param width Width of a matrix or image
* @param height Height of a matrix or image
* @param packets number of packets beeing sent (set on ACK only)
* @param payload payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
* @param jpg_quality JPEG quality out of [1,100]
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_data_transmission_handshake_send(mavlink_channel_t chan, uint8_t type, uint32_t size, uint16_t width, uint16_t height, uint16_t packets, uint8_t payload, uint8_t jpg_quality)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN];
_mav_put_uint32_t(buf, 0, size);
_mav_put_uint16_t(buf, 4, width);
_mav_put_uint16_t(buf, 6, height);
_mav_put_uint16_t(buf, 8, packets);
_mav_put_uint8_t(buf, 10, type);
_mav_put_uint8_t(buf, 11, payload);
_mav_put_uint8_t(buf, 12, jpg_quality);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
#else
mavlink_data_transmission_handshake_t packet;
packet.size = size;
packet.width = width;
packet.height = height;
packet.packets = packets;
packet.type = type;
packet.payload = payload;
packet.jpg_quality = jpg_quality;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, (const char *)&packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, (const char *)&packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_data_transmission_handshake_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, uint32_t size, uint16_t width, uint16_t height, uint16_t packets, uint8_t payload, uint8_t jpg_quality)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, size);
_mav_put_uint16_t(buf, 4, width);
_mav_put_uint16_t(buf, 6, height);
_mav_put_uint16_t(buf, 8, packets);
_mav_put_uint8_t(buf, 10, type);
_mav_put_uint8_t(buf, 11, payload);
_mav_put_uint8_t(buf, 12, jpg_quality);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
#else
mavlink_data_transmission_handshake_t *packet = (mavlink_data_transmission_handshake_t *)msgbuf;
packet->size = size;
packet->width = width;
packet->height = height;
packet->packets = packets;
packet->type = type;
packet->payload = payload;
packet->jpg_quality = jpg_quality;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, (const char *)packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, (const char *)packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE DATA_TRANSMISSION_HANDSHAKE UNPACKING
/**
* @brief Get field type from data_transmission_handshake message
*
* @return type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
*/
static inline uint8_t mavlink_msg_data_transmission_handshake_get_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 10);
}
/**
* @brief Get field size from data_transmission_handshake message
*
* @return total data size in bytes (set on ACK only)
*/
static inline uint32_t mavlink_msg_data_transmission_handshake_get_size(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field width from data_transmission_handshake message
*
* @return Width of a matrix or image
*/
static inline uint16_t mavlink_msg_data_transmission_handshake_get_width(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 4);
}
/**
* @brief Get field height from data_transmission_handshake message
*
* @return Height of a matrix or image
*/
static inline uint16_t mavlink_msg_data_transmission_handshake_get_height(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 6);
}
/**
* @brief Get field packets from data_transmission_handshake message
*
* @return number of packets beeing sent (set on ACK only)
*/
static inline uint16_t mavlink_msg_data_transmission_handshake_get_packets(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 8);
}
/**
* @brief Get field payload from data_transmission_handshake message
*
* @return payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
*/
static inline uint8_t mavlink_msg_data_transmission_handshake_get_payload(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 11);
}
/**
* @brief Get field jpg_quality from data_transmission_handshake message
*
* @return JPEG quality out of [1,100]
*/
static inline uint8_t mavlink_msg_data_transmission_handshake_get_jpg_quality(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 12);
}
/**
* @brief Decode a data_transmission_handshake message into a struct
*
* @param msg The message to decode
* @param data_transmission_handshake C-struct to decode the message contents into
*/
static inline void mavlink_msg_data_transmission_handshake_decode(const mavlink_message_t* msg, mavlink_data_transmission_handshake_t* data_transmission_handshake)
{
#if MAVLINK_NEED_BYTE_SWAP
data_transmission_handshake->size = mavlink_msg_data_transmission_handshake_get_size(msg);
data_transmission_handshake->width = mavlink_msg_data_transmission_handshake_get_width(msg);
data_transmission_handshake->height = mavlink_msg_data_transmission_handshake_get_height(msg);
data_transmission_handshake->packets = mavlink_msg_data_transmission_handshake_get_packets(msg);
data_transmission_handshake->type = mavlink_msg_data_transmission_handshake_get_type(msg);
data_transmission_handshake->payload = mavlink_msg_data_transmission_handshake_get_payload(msg);
data_transmission_handshake->jpg_quality = mavlink_msg_data_transmission_handshake_get_jpg_quality(msg);
#else
memcpy(data_transmission_handshake, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
#endif
}

View File

@ -0,0 +1,257 @@
// MESSAGE DEBUG PACKING
#define MAVLINK_MSG_ID_DEBUG 254
typedef struct __mavlink_debug_t
{
uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
float value; /*< DEBUG value*/
uint8_t ind; /*< index of debug variable*/
} mavlink_debug_t;
#define MAVLINK_MSG_ID_DEBUG_LEN 9
#define MAVLINK_MSG_ID_254_LEN 9
#define MAVLINK_MSG_ID_DEBUG_CRC 46
#define MAVLINK_MSG_ID_254_CRC 46
#define MAVLINK_MESSAGE_INFO_DEBUG { \
"DEBUG", \
3, \
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_debug_t, time_boot_ms) }, \
{ "value", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_debug_t, value) }, \
{ "ind", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_debug_t, ind) }, \
} \
}
/**
* @brief Pack a debug message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param ind index of debug variable
* @param value DEBUG value
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_debug_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_boot_ms, uint8_t ind, float value)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DEBUG_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, value);
_mav_put_uint8_t(buf, 8, ind);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_LEN);
#else
mavlink_debug_t packet;
packet.time_boot_ms = time_boot_ms;
packet.value = value;
packet.ind = ind;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DEBUG;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_LEN, MAVLINK_MSG_ID_DEBUG_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_LEN);
#endif
}
/**
* @brief Pack a debug message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param ind index of debug variable
* @param value DEBUG value
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_debug_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_boot_ms,uint8_t ind,float value)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DEBUG_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, value);
_mav_put_uint8_t(buf, 8, ind);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_LEN);
#else
mavlink_debug_t packet;
packet.time_boot_ms = time_boot_ms;
packet.value = value;
packet.ind = ind;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DEBUG;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEBUG_LEN, MAVLINK_MSG_ID_DEBUG_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEBUG_LEN);
#endif
}
/**
* @brief Encode a debug struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param debug C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_debug_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_debug_t* debug)
{
return mavlink_msg_debug_pack(system_id, component_id, msg, debug->time_boot_ms, debug->ind, debug->value);
}
/**
* @brief Encode a debug struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param debug C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_debug_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_debug_t* debug)
{
return mavlink_msg_debug_pack_chan(system_id, component_id, chan, msg, debug->time_boot_ms, debug->ind, debug->value);
}
/**
* @brief Send a debug message
* @param chan MAVLink channel to send the message
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param ind index of debug variable
* @param value DEBUG value
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_debug_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t ind, float value)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DEBUG_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, value);
_mav_put_uint8_t(buf, 8, ind);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, buf, MAVLINK_MSG_ID_DEBUG_LEN, MAVLINK_MSG_ID_DEBUG_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, buf, MAVLINK_MSG_ID_DEBUG_LEN);
#endif
#else
mavlink_debug_t packet;
packet.time_boot_ms = time_boot_ms;
packet.value = value;
packet.ind = ind;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, (const char *)&packet, MAVLINK_MSG_ID_DEBUG_LEN, MAVLINK_MSG_ID_DEBUG_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, (const char *)&packet, MAVLINK_MSG_ID_DEBUG_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_DEBUG_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_debug_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t ind, float value)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_float(buf, 4, value);
_mav_put_uint8_t(buf, 8, ind);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, buf, MAVLINK_MSG_ID_DEBUG_LEN, MAVLINK_MSG_ID_DEBUG_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, buf, MAVLINK_MSG_ID_DEBUG_LEN);
#endif
#else
mavlink_debug_t *packet = (mavlink_debug_t *)msgbuf;
packet->time_boot_ms = time_boot_ms;
packet->value = value;
packet->ind = ind;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, (const char *)packet, MAVLINK_MSG_ID_DEBUG_LEN, MAVLINK_MSG_ID_DEBUG_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, (const char *)packet, MAVLINK_MSG_ID_DEBUG_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE DEBUG UNPACKING
/**
* @brief Get field time_boot_ms from debug message
*
* @return Timestamp (milliseconds since system boot)
*/
static inline uint32_t mavlink_msg_debug_get_time_boot_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field ind from debug message
*
* @return index of debug variable
*/
static inline uint8_t mavlink_msg_debug_get_ind(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 8);
}
/**
* @brief Get field value from debug message
*
* @return DEBUG value
*/
static inline float mavlink_msg_debug_get_value(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 4);
}
/**
* @brief Decode a debug message into a struct
*
* @param msg The message to decode
* @param debug C-struct to decode the message contents into
*/
static inline void mavlink_msg_debug_decode(const mavlink_message_t* msg, mavlink_debug_t* debug)
{
#if MAVLINK_NEED_BYTE_SWAP
debug->time_boot_ms = mavlink_msg_debug_get_time_boot_ms(msg);
debug->value = mavlink_msg_debug_get_value(msg);
debug->ind = mavlink_msg_debug_get_ind(msg);
#else
memcpy(debug, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_DEBUG_LEN);
#endif
}

View File

@ -0,0 +1,297 @@
// MESSAGE DEBUG_VECT PACKING
#define MAVLINK_MSG_ID_DEBUG_VECT 250
typedef struct __mavlink_debug_vect_t
{
uint64_t time_usec; /*< Timestamp*/
float x; /*< x*/
float y; /*< y*/
float z; /*< z*/
char name[10]; /*< Name*/
} mavlink_debug_vect_t;
#define MAVLINK_MSG_ID_DEBUG_VECT_LEN 30
#define MAVLINK_MSG_ID_250_LEN 30
#define MAVLINK_MSG_ID_DEBUG_VECT_CRC 49
#define MAVLINK_MSG_ID_250_CRC 49
#define MAVLINK_MSG_DEBUG_VECT_FIELD_NAME_LEN 10
#define MAVLINK_MESSAGE_INFO_DEBUG_VECT { \
"DEBUG_VECT", \
5, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_debug_vect_t, time_usec) }, \
{ "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_debug_vect_t, x) }, \
{ "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_debug_vect_t, y) }, \
{ "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_debug_vect_t, z) }, \
{ "name", NULL, MAVLINK_TYPE_CHAR, 10, 20, offsetof(mavlink_debug_vect_t, name) }, \
} \
}
/**
* @brief Pack a debug_vect message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param name Name
* @param time_usec Timestamp
* @param x x
* @param y y
* @param z z
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
const char *name, uint64_t time_usec, float x, float y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DEBUG_VECT_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, x);
_mav_put_float(buf, 12, y);
_mav_put_float(buf, 16, z);
_mav_put_char_array(buf, 20, name, 10);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#else
mavlink_debug_vect_t packet;
packet.time_usec = time_usec;
packet.x = x;
packet.y = y;
packet.z = z;
mav_array_memcpy(packet.name, name, sizeof(char)*10);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
}
/**
* @brief Pack a debug_vect message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param name Name
* @param time_usec Timestamp
* @param x x
* @param y y
* @param z z
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_debug_vect_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
const char *name,uint64_t time_usec,float x,float y,float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DEBUG_VECT_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, x);
_mav_put_float(buf, 12, y);
_mav_put_float(buf, 16, z);
_mav_put_char_array(buf, 20, name, 10);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#else
mavlink_debug_vect_t packet;
packet.time_usec = time_usec;
packet.x = x;
packet.y = y;
packet.z = z;
mav_array_memcpy(packet.name, name, sizeof(char)*10);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
}
/**
* @brief Encode a debug_vect struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param debug_vect C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_debug_vect_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_debug_vect_t* debug_vect)
{
return mavlink_msg_debug_vect_pack(system_id, component_id, msg, debug_vect->name, debug_vect->time_usec, debug_vect->x, debug_vect->y, debug_vect->z);
}
/**
* @brief Encode a debug_vect struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param debug_vect C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_debug_vect_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_debug_vect_t* debug_vect)
{
return mavlink_msg_debug_vect_pack_chan(system_id, component_id, chan, msg, debug_vect->name, debug_vect->time_usec, debug_vect->x, debug_vect->y, debug_vect->z);
}
/**
* @brief Send a debug_vect message
* @param chan MAVLink channel to send the message
*
* @param name Name
* @param time_usec Timestamp
* @param x x
* @param y y
* @param z z
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const char *name, uint64_t time_usec, float x, float y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DEBUG_VECT_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, x);
_mav_put_float(buf, 12, y);
_mav_put_float(buf, 16, z);
_mav_put_char_array(buf, 20, name, 10);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, buf, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, buf, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
#else
mavlink_debug_vect_t packet;
packet.time_usec = time_usec;
packet.x = x;
packet.y = y;
packet.z = z;
mav_array_memcpy(packet.name, name, sizeof(char)*10);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)&packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)&packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_DEBUG_VECT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_debug_vect_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const char *name, uint64_t time_usec, float x, float y, float z)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, x);
_mav_put_float(buf, 12, y);
_mav_put_float(buf, 16, z);
_mav_put_char_array(buf, 20, name, 10);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, buf, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, buf, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
#else
mavlink_debug_vect_t *packet = (mavlink_debug_vect_t *)msgbuf;
packet->time_usec = time_usec;
packet->x = x;
packet->y = y;
packet->z = z;
mav_array_memcpy(packet->name, name, sizeof(char)*10);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN, MAVLINK_MSG_ID_DEBUG_VECT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)packet, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE DEBUG_VECT UNPACKING
/**
* @brief Get field name from debug_vect message
*
* @return Name
*/
static inline uint16_t mavlink_msg_debug_vect_get_name(const mavlink_message_t* msg, char *name)
{
return _MAV_RETURN_char_array(msg, name, 10, 20);
}
/**
* @brief Get field time_usec from debug_vect message
*
* @return Timestamp
*/
static inline uint64_t mavlink_msg_debug_vect_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field x from debug_vect message
*
* @return x
*/
static inline float mavlink_msg_debug_vect_get_x(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field y from debug_vect message
*
* @return y
*/
static inline float mavlink_msg_debug_vect_get_y(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field z from debug_vect message
*
* @return z
*/
static inline float mavlink_msg_debug_vect_get_z(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Decode a debug_vect message into a struct
*
* @param msg The message to decode
* @param debug_vect C-struct to decode the message contents into
*/
static inline void mavlink_msg_debug_vect_decode(const mavlink_message_t* msg, mavlink_debug_vect_t* debug_vect)
{
#if MAVLINK_NEED_BYTE_SWAP
debug_vect->time_usec = mavlink_msg_debug_vect_get_time_usec(msg);
debug_vect->x = mavlink_msg_debug_vect_get_x(msg);
debug_vect->y = mavlink_msg_debug_vect_get_y(msg);
debug_vect->z = mavlink_msg_debug_vect_get_z(msg);
mavlink_msg_debug_vect_get_name(msg, debug_vect->name);
#else
memcpy(debug_vect, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_DEBUG_VECT_LEN);
#endif
}

View File

@ -0,0 +1,377 @@
// MESSAGE DISTANCE_SENSOR PACKING
#define MAVLINK_MSG_ID_DISTANCE_SENSOR 132
typedef struct __mavlink_distance_sensor_t
{
uint32_t time_boot_ms; /*< Time since system boot*/
uint16_t min_distance; /*< Minimum distance the sensor can measure in centimeters*/
uint16_t max_distance; /*< Maximum distance the sensor can measure in centimeters*/
uint16_t current_distance; /*< Current distance reading*/
uint8_t type; /*< Type from MAV_DISTANCE_SENSOR enum.*/
uint8_t id; /*< Onboard ID of the sensor*/
uint8_t orientation; /*< Direction the sensor faces from MAV_SENSOR_ORIENTATION enum.*/
uint8_t covariance; /*< Measurement covariance in centimeters, 0 for unknown / invalid readings*/
} mavlink_distance_sensor_t;
#define MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN 14
#define MAVLINK_MSG_ID_132_LEN 14
#define MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC 85
#define MAVLINK_MSG_ID_132_CRC 85
#define MAVLINK_MESSAGE_INFO_DISTANCE_SENSOR { \
"DISTANCE_SENSOR", \
8, \
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_distance_sensor_t, time_boot_ms) }, \
{ "min_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_distance_sensor_t, min_distance) }, \
{ "max_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_distance_sensor_t, max_distance) }, \
{ "current_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_distance_sensor_t, current_distance) }, \
{ "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_distance_sensor_t, type) }, \
{ "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_distance_sensor_t, id) }, \
{ "orientation", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_distance_sensor_t, orientation) }, \
{ "covariance", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_distance_sensor_t, covariance) }, \
} \
}
/**
* @brief Pack a distance_sensor message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_boot_ms Time since system boot
* @param min_distance Minimum distance the sensor can measure in centimeters
* @param max_distance Maximum distance the sensor can measure in centimeters
* @param current_distance Current distance reading
* @param type Type from MAV_DISTANCE_SENSOR enum.
* @param id Onboard ID of the sensor
* @param orientation Direction the sensor faces from MAV_SENSOR_ORIENTATION enum.
* @param covariance Measurement covariance in centimeters, 0 for unknown / invalid readings
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_distance_sensor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_boot_ms, uint16_t min_distance, uint16_t max_distance, uint16_t current_distance, uint8_t type, uint8_t id, uint8_t orientation, uint8_t covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_uint16_t(buf, 4, min_distance);
_mav_put_uint16_t(buf, 6, max_distance);
_mav_put_uint16_t(buf, 8, current_distance);
_mav_put_uint8_t(buf, 10, type);
_mav_put_uint8_t(buf, 11, id);
_mav_put_uint8_t(buf, 12, orientation);
_mav_put_uint8_t(buf, 13, covariance);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#else
mavlink_distance_sensor_t packet;
packet.time_boot_ms = time_boot_ms;
packet.min_distance = min_distance;
packet.max_distance = max_distance;
packet.current_distance = current_distance;
packet.type = type;
packet.id = id;
packet.orientation = orientation;
packet.covariance = covariance;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DISTANCE_SENSOR;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
}
/**
* @brief Pack a distance_sensor message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_boot_ms Time since system boot
* @param min_distance Minimum distance the sensor can measure in centimeters
* @param max_distance Maximum distance the sensor can measure in centimeters
* @param current_distance Current distance reading
* @param type Type from MAV_DISTANCE_SENSOR enum.
* @param id Onboard ID of the sensor
* @param orientation Direction the sensor faces from MAV_SENSOR_ORIENTATION enum.
* @param covariance Measurement covariance in centimeters, 0 for unknown / invalid readings
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_distance_sensor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_boot_ms,uint16_t min_distance,uint16_t max_distance,uint16_t current_distance,uint8_t type,uint8_t id,uint8_t orientation,uint8_t covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_uint16_t(buf, 4, min_distance);
_mav_put_uint16_t(buf, 6, max_distance);
_mav_put_uint16_t(buf, 8, current_distance);
_mav_put_uint8_t(buf, 10, type);
_mav_put_uint8_t(buf, 11, id);
_mav_put_uint8_t(buf, 12, orientation);
_mav_put_uint8_t(buf, 13, covariance);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#else
mavlink_distance_sensor_t packet;
packet.time_boot_ms = time_boot_ms;
packet.min_distance = min_distance;
packet.max_distance = max_distance;
packet.current_distance = current_distance;
packet.type = type;
packet.id = id;
packet.orientation = orientation;
packet.covariance = covariance;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_DISTANCE_SENSOR;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
}
/**
* @brief Encode a distance_sensor struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param distance_sensor C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_distance_sensor_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_distance_sensor_t* distance_sensor)
{
return mavlink_msg_distance_sensor_pack(system_id, component_id, msg, distance_sensor->time_boot_ms, distance_sensor->min_distance, distance_sensor->max_distance, distance_sensor->current_distance, distance_sensor->type, distance_sensor->id, distance_sensor->orientation, distance_sensor->covariance);
}
/**
* @brief Encode a distance_sensor struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param distance_sensor C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_distance_sensor_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_distance_sensor_t* distance_sensor)
{
return mavlink_msg_distance_sensor_pack_chan(system_id, component_id, chan, msg, distance_sensor->time_boot_ms, distance_sensor->min_distance, distance_sensor->max_distance, distance_sensor->current_distance, distance_sensor->type, distance_sensor->id, distance_sensor->orientation, distance_sensor->covariance);
}
/**
* @brief Send a distance_sensor message
* @param chan MAVLink channel to send the message
*
* @param time_boot_ms Time since system boot
* @param min_distance Minimum distance the sensor can measure in centimeters
* @param max_distance Maximum distance the sensor can measure in centimeters
* @param current_distance Current distance reading
* @param type Type from MAV_DISTANCE_SENSOR enum.
* @param id Onboard ID of the sensor
* @param orientation Direction the sensor faces from MAV_SENSOR_ORIENTATION enum.
* @param covariance Measurement covariance in centimeters, 0 for unknown / invalid readings
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_distance_sensor_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint16_t min_distance, uint16_t max_distance, uint16_t current_distance, uint8_t type, uint8_t id, uint8_t orientation, uint8_t covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_uint16_t(buf, 4, min_distance);
_mav_put_uint16_t(buf, 6, max_distance);
_mav_put_uint16_t(buf, 8, current_distance);
_mav_put_uint8_t(buf, 10, type);
_mav_put_uint8_t(buf, 11, id);
_mav_put_uint8_t(buf, 12, orientation);
_mav_put_uint8_t(buf, 13, covariance);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, buf, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, buf, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
#else
mavlink_distance_sensor_t packet;
packet.time_boot_ms = time_boot_ms;
packet.min_distance = min_distance;
packet.max_distance = max_distance;
packet.current_distance = current_distance;
packet.type = type;
packet.id = id;
packet.orientation = orientation;
packet.covariance = covariance;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, (const char *)&packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, (const char *)&packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_distance_sensor_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint16_t min_distance, uint16_t max_distance, uint16_t current_distance, uint8_t type, uint8_t id, uint8_t orientation, uint8_t covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_uint16_t(buf, 4, min_distance);
_mav_put_uint16_t(buf, 6, max_distance);
_mav_put_uint16_t(buf, 8, current_distance);
_mav_put_uint8_t(buf, 10, type);
_mav_put_uint8_t(buf, 11, id);
_mav_put_uint8_t(buf, 12, orientation);
_mav_put_uint8_t(buf, 13, covariance);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, buf, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, buf, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
#else
mavlink_distance_sensor_t *packet = (mavlink_distance_sensor_t *)msgbuf;
packet->time_boot_ms = time_boot_ms;
packet->min_distance = min_distance;
packet->max_distance = max_distance;
packet->current_distance = current_distance;
packet->type = type;
packet->id = id;
packet->orientation = orientation;
packet->covariance = covariance;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, (const char *)packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN, MAVLINK_MSG_ID_DISTANCE_SENSOR_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DISTANCE_SENSOR, (const char *)packet, MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE DISTANCE_SENSOR UNPACKING
/**
* @brief Get field time_boot_ms from distance_sensor message
*
* @return Time since system boot
*/
static inline uint32_t mavlink_msg_distance_sensor_get_time_boot_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field min_distance from distance_sensor message
*
* @return Minimum distance the sensor can measure in centimeters
*/
static inline uint16_t mavlink_msg_distance_sensor_get_min_distance(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 4);
}
/**
* @brief Get field max_distance from distance_sensor message
*
* @return Maximum distance the sensor can measure in centimeters
*/
static inline uint16_t mavlink_msg_distance_sensor_get_max_distance(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 6);
}
/**
* @brief Get field current_distance from distance_sensor message
*
* @return Current distance reading
*/
static inline uint16_t mavlink_msg_distance_sensor_get_current_distance(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 8);
}
/**
* @brief Get field type from distance_sensor message
*
* @return Type from MAV_DISTANCE_SENSOR enum.
*/
static inline uint8_t mavlink_msg_distance_sensor_get_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 10);
}
/**
* @brief Get field id from distance_sensor message
*
* @return Onboard ID of the sensor
*/
static inline uint8_t mavlink_msg_distance_sensor_get_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 11);
}
/**
* @brief Get field orientation from distance_sensor message
*
* @return Direction the sensor faces from MAV_SENSOR_ORIENTATION enum.
*/
static inline uint8_t mavlink_msg_distance_sensor_get_orientation(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 12);
}
/**
* @brief Get field covariance from distance_sensor message
*
* @return Measurement covariance in centimeters, 0 for unknown / invalid readings
*/
static inline uint8_t mavlink_msg_distance_sensor_get_covariance(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 13);
}
/**
* @brief Decode a distance_sensor message into a struct
*
* @param msg The message to decode
* @param distance_sensor C-struct to decode the message contents into
*/
static inline void mavlink_msg_distance_sensor_decode(const mavlink_message_t* msg, mavlink_distance_sensor_t* distance_sensor)
{
#if MAVLINK_NEED_BYTE_SWAP
distance_sensor->time_boot_ms = mavlink_msg_distance_sensor_get_time_boot_ms(msg);
distance_sensor->min_distance = mavlink_msg_distance_sensor_get_min_distance(msg);
distance_sensor->max_distance = mavlink_msg_distance_sensor_get_max_distance(msg);
distance_sensor->current_distance = mavlink_msg_distance_sensor_get_current_distance(msg);
distance_sensor->type = mavlink_msg_distance_sensor_get_type(msg);
distance_sensor->id = mavlink_msg_distance_sensor_get_id(msg);
distance_sensor->orientation = mavlink_msg_distance_sensor_get_orientation(msg);
distance_sensor->covariance = mavlink_msg_distance_sensor_get_covariance(msg);
#else
memcpy(distance_sensor, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_DISTANCE_SENSOR_LEN);
#endif
}

View File

@ -0,0 +1,225 @@
// MESSAGE ENCAPSULATED_DATA PACKING
#define MAVLINK_MSG_ID_ENCAPSULATED_DATA 131
typedef struct __mavlink_encapsulated_data_t
{
uint16_t seqnr; /*< sequence number (starting with 0 on every transmission)*/
uint8_t data[253]; /*< image data bytes*/
} mavlink_encapsulated_data_t;
#define MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN 255
#define MAVLINK_MSG_ID_131_LEN 255
#define MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC 223
#define MAVLINK_MSG_ID_131_CRC 223
#define MAVLINK_MSG_ENCAPSULATED_DATA_FIELD_DATA_LEN 253
#define MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA { \
"ENCAPSULATED_DATA", \
2, \
{ { "seqnr", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_encapsulated_data_t, seqnr) }, \
{ "data", NULL, MAVLINK_TYPE_UINT8_T, 253, 2, offsetof(mavlink_encapsulated_data_t, data) }, \
} \
}
/**
* @brief Pack a encapsulated_data message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param seqnr sequence number (starting with 0 on every transmission)
* @param data image data bytes
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_encapsulated_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint16_t seqnr, const uint8_t *data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN];
_mav_put_uint16_t(buf, 0, seqnr);
_mav_put_uint8_t_array(buf, 2, data, 253);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#else
mavlink_encapsulated_data_t packet;
packet.seqnr = seqnr;
mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ENCAPSULATED_DATA;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
}
/**
* @brief Pack a encapsulated_data message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param seqnr sequence number (starting with 0 on every transmission)
* @param data image data bytes
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_encapsulated_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint16_t seqnr,const uint8_t *data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN];
_mav_put_uint16_t(buf, 0, seqnr);
_mav_put_uint8_t_array(buf, 2, data, 253);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#else
mavlink_encapsulated_data_t packet;
packet.seqnr = seqnr;
mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ENCAPSULATED_DATA;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
}
/**
* @brief Encode a encapsulated_data struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param encapsulated_data C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_encapsulated_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_encapsulated_data_t* encapsulated_data)
{
return mavlink_msg_encapsulated_data_pack(system_id, component_id, msg, encapsulated_data->seqnr, encapsulated_data->data);
}
/**
* @brief Encode a encapsulated_data struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param encapsulated_data C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_encapsulated_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_encapsulated_data_t* encapsulated_data)
{
return mavlink_msg_encapsulated_data_pack_chan(system_id, component_id, chan, msg, encapsulated_data->seqnr, encapsulated_data->data);
}
/**
* @brief Send a encapsulated_data message
* @param chan MAVLink channel to send the message
*
* @param seqnr sequence number (starting with 0 on every transmission)
* @param data image data bytes
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_encapsulated_data_send(mavlink_channel_t chan, uint16_t seqnr, const uint8_t *data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN];
_mav_put_uint16_t(buf, 0, seqnr);
_mav_put_uint8_t_array(buf, 2, data, 253);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
#else
mavlink_encapsulated_data_t packet;
packet.seqnr = seqnr;
mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)&packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)&packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_encapsulated_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seqnr, const uint8_t *data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint16_t(buf, 0, seqnr);
_mav_put_uint8_t_array(buf, 2, data, 253);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
#else
mavlink_encapsulated_data_t *packet = (mavlink_encapsulated_data_t *)msgbuf;
packet->seqnr = seqnr;
mav_array_memcpy(packet->data, data, sizeof(uint8_t)*253);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ENCAPSULATED_DATA UNPACKING
/**
* @brief Get field seqnr from encapsulated_data message
*
* @return sequence number (starting with 0 on every transmission)
*/
static inline uint16_t mavlink_msg_encapsulated_data_get_seqnr(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 0);
}
/**
* @brief Get field data from encapsulated_data message
*
* @return image data bytes
*/
static inline uint16_t mavlink_msg_encapsulated_data_get_data(const mavlink_message_t* msg, uint8_t *data)
{
return _MAV_RETURN_uint8_t_array(msg, data, 253, 2);
}
/**
* @brief Decode a encapsulated_data message into a struct
*
* @param msg The message to decode
* @param encapsulated_data C-struct to decode the message contents into
*/
static inline void mavlink_msg_encapsulated_data_decode(const mavlink_message_t* msg, mavlink_encapsulated_data_t* encapsulated_data)
{
#if MAVLINK_NEED_BYTE_SWAP
encapsulated_data->seqnr = mavlink_msg_encapsulated_data_get_seqnr(msg);
mavlink_msg_encapsulated_data_get_data(msg, encapsulated_data->data);
#else
memcpy(encapsulated_data, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
#endif
}

View File

@ -0,0 +1,425 @@
// MESSAGE ESTIMATOR_STATUS PACKING
#define MAVLINK_MSG_ID_ESTIMATOR_STATUS 230
typedef struct __mavlink_estimator_status_t
{
uint64_t time_usec; /*< Timestamp (micros since boot or Unix epoch)*/
float vel_ratio; /*< Velocity innovation test ratio*/
float pos_horiz_ratio; /*< Horizontal position innovation test ratio*/
float pos_vert_ratio; /*< Vertical position innovation test ratio*/
float mag_ratio; /*< Magnetometer innovation test ratio*/
float hagl_ratio; /*< Height above terrain innovation test ratio*/
float tas_ratio; /*< True airspeed innovation test ratio*/
float pos_horiz_accuracy; /*< Horizontal position 1-STD accuracy relative to the EKF local origin (m)*/
float pos_vert_accuracy; /*< Vertical position 1-STD accuracy relative to the EKF local origin (m)*/
uint16_t flags; /*< Integer bitmask indicating which EKF outputs are valid. See definition for ESTIMATOR_STATUS_FLAGS.*/
} mavlink_estimator_status_t;
#define MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN 42
#define MAVLINK_MSG_ID_230_LEN 42
#define MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC 163
#define MAVLINK_MSG_ID_230_CRC 163
#define MAVLINK_MESSAGE_INFO_ESTIMATOR_STATUS { \
"ESTIMATOR_STATUS", \
10, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_estimator_status_t, time_usec) }, \
{ "vel_ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_estimator_status_t, vel_ratio) }, \
{ "pos_horiz_ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_estimator_status_t, pos_horiz_ratio) }, \
{ "pos_vert_ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_estimator_status_t, pos_vert_ratio) }, \
{ "mag_ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_estimator_status_t, mag_ratio) }, \
{ "hagl_ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_estimator_status_t, hagl_ratio) }, \
{ "tas_ratio", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_estimator_status_t, tas_ratio) }, \
{ "pos_horiz_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_estimator_status_t, pos_horiz_accuracy) }, \
{ "pos_vert_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_estimator_status_t, pos_vert_accuracy) }, \
{ "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_estimator_status_t, flags) }, \
} \
}
/**
* @brief Pack a estimator_status message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param flags Integer bitmask indicating which EKF outputs are valid. See definition for ESTIMATOR_STATUS_FLAGS.
* @param vel_ratio Velocity innovation test ratio
* @param pos_horiz_ratio Horizontal position innovation test ratio
* @param pos_vert_ratio Vertical position innovation test ratio
* @param mag_ratio Magnetometer innovation test ratio
* @param hagl_ratio Height above terrain innovation test ratio
* @param tas_ratio True airspeed innovation test ratio
* @param pos_horiz_accuracy Horizontal position 1-STD accuracy relative to the EKF local origin (m)
* @param pos_vert_accuracy Vertical position 1-STD accuracy relative to the EKF local origin (m)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_estimator_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, uint16_t flags, float vel_ratio, float pos_horiz_ratio, float pos_vert_ratio, float mag_ratio, float hagl_ratio, float tas_ratio, float pos_horiz_accuracy, float pos_vert_accuracy)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, vel_ratio);
_mav_put_float(buf, 12, pos_horiz_ratio);
_mav_put_float(buf, 16, pos_vert_ratio);
_mav_put_float(buf, 20, mag_ratio);
_mav_put_float(buf, 24, hagl_ratio);
_mav_put_float(buf, 28, tas_ratio);
_mav_put_float(buf, 32, pos_horiz_accuracy);
_mav_put_float(buf, 36, pos_vert_accuracy);
_mav_put_uint16_t(buf, 40, flags);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#else
mavlink_estimator_status_t packet;
packet.time_usec = time_usec;
packet.vel_ratio = vel_ratio;
packet.pos_horiz_ratio = pos_horiz_ratio;
packet.pos_vert_ratio = pos_vert_ratio;
packet.mag_ratio = mag_ratio;
packet.hagl_ratio = hagl_ratio;
packet.tas_ratio = tas_ratio;
packet.pos_horiz_accuracy = pos_horiz_accuracy;
packet.pos_vert_accuracy = pos_vert_accuracy;
packet.flags = flags;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ESTIMATOR_STATUS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
}
/**
* @brief Pack a estimator_status message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param flags Integer bitmask indicating which EKF outputs are valid. See definition for ESTIMATOR_STATUS_FLAGS.
* @param vel_ratio Velocity innovation test ratio
* @param pos_horiz_ratio Horizontal position innovation test ratio
* @param pos_vert_ratio Vertical position innovation test ratio
* @param mag_ratio Magnetometer innovation test ratio
* @param hagl_ratio Height above terrain innovation test ratio
* @param tas_ratio True airspeed innovation test ratio
* @param pos_horiz_accuracy Horizontal position 1-STD accuracy relative to the EKF local origin (m)
* @param pos_vert_accuracy Vertical position 1-STD accuracy relative to the EKF local origin (m)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_estimator_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,uint16_t flags,float vel_ratio,float pos_horiz_ratio,float pos_vert_ratio,float mag_ratio,float hagl_ratio,float tas_ratio,float pos_horiz_accuracy,float pos_vert_accuracy)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, vel_ratio);
_mav_put_float(buf, 12, pos_horiz_ratio);
_mav_put_float(buf, 16, pos_vert_ratio);
_mav_put_float(buf, 20, mag_ratio);
_mav_put_float(buf, 24, hagl_ratio);
_mav_put_float(buf, 28, tas_ratio);
_mav_put_float(buf, 32, pos_horiz_accuracy);
_mav_put_float(buf, 36, pos_vert_accuracy);
_mav_put_uint16_t(buf, 40, flags);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#else
mavlink_estimator_status_t packet;
packet.time_usec = time_usec;
packet.vel_ratio = vel_ratio;
packet.pos_horiz_ratio = pos_horiz_ratio;
packet.pos_vert_ratio = pos_vert_ratio;
packet.mag_ratio = mag_ratio;
packet.hagl_ratio = hagl_ratio;
packet.tas_ratio = tas_ratio;
packet.pos_horiz_accuracy = pos_horiz_accuracy;
packet.pos_vert_accuracy = pos_vert_accuracy;
packet.flags = flags;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_ESTIMATOR_STATUS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
}
/**
* @brief Encode a estimator_status struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param estimator_status C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_estimator_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_estimator_status_t* estimator_status)
{
return mavlink_msg_estimator_status_pack(system_id, component_id, msg, estimator_status->time_usec, estimator_status->flags, estimator_status->vel_ratio, estimator_status->pos_horiz_ratio, estimator_status->pos_vert_ratio, estimator_status->mag_ratio, estimator_status->hagl_ratio, estimator_status->tas_ratio, estimator_status->pos_horiz_accuracy, estimator_status->pos_vert_accuracy);
}
/**
* @brief Encode a estimator_status struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param estimator_status C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_estimator_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_estimator_status_t* estimator_status)
{
return mavlink_msg_estimator_status_pack_chan(system_id, component_id, chan, msg, estimator_status->time_usec, estimator_status->flags, estimator_status->vel_ratio, estimator_status->pos_horiz_ratio, estimator_status->pos_vert_ratio, estimator_status->mag_ratio, estimator_status->hagl_ratio, estimator_status->tas_ratio, estimator_status->pos_horiz_accuracy, estimator_status->pos_vert_accuracy);
}
/**
* @brief Send a estimator_status message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (micros since boot or Unix epoch)
* @param flags Integer bitmask indicating which EKF outputs are valid. See definition for ESTIMATOR_STATUS_FLAGS.
* @param vel_ratio Velocity innovation test ratio
* @param pos_horiz_ratio Horizontal position innovation test ratio
* @param pos_vert_ratio Vertical position innovation test ratio
* @param mag_ratio Magnetometer innovation test ratio
* @param hagl_ratio Height above terrain innovation test ratio
* @param tas_ratio True airspeed innovation test ratio
* @param pos_horiz_accuracy Horizontal position 1-STD accuracy relative to the EKF local origin (m)
* @param pos_vert_accuracy Vertical position 1-STD accuracy relative to the EKF local origin (m)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_estimator_status_send(mavlink_channel_t chan, uint64_t time_usec, uint16_t flags, float vel_ratio, float pos_horiz_ratio, float pos_vert_ratio, float mag_ratio, float hagl_ratio, float tas_ratio, float pos_horiz_accuracy, float pos_vert_accuracy)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, vel_ratio);
_mav_put_float(buf, 12, pos_horiz_ratio);
_mav_put_float(buf, 16, pos_vert_ratio);
_mav_put_float(buf, 20, mag_ratio);
_mav_put_float(buf, 24, hagl_ratio);
_mav_put_float(buf, 28, tas_ratio);
_mav_put_float(buf, 32, pos_horiz_accuracy);
_mav_put_float(buf, 36, pos_vert_accuracy);
_mav_put_uint16_t(buf, 40, flags);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS, buf, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS, buf, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
#else
mavlink_estimator_status_t packet;
packet.time_usec = time_usec;
packet.vel_ratio = vel_ratio;
packet.pos_horiz_ratio = pos_horiz_ratio;
packet.pos_vert_ratio = pos_vert_ratio;
packet.mag_ratio = mag_ratio;
packet.hagl_ratio = hagl_ratio;
packet.tas_ratio = tas_ratio;
packet.pos_horiz_accuracy = pos_horiz_accuracy;
packet.pos_vert_accuracy = pos_vert_accuracy;
packet.flags = flags;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS, (const char *)&packet, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS, (const char *)&packet, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_estimator_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint16_t flags, float vel_ratio, float pos_horiz_ratio, float pos_vert_ratio, float mag_ratio, float hagl_ratio, float tas_ratio, float pos_horiz_accuracy, float pos_vert_accuracy)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, vel_ratio);
_mav_put_float(buf, 12, pos_horiz_ratio);
_mav_put_float(buf, 16, pos_vert_ratio);
_mav_put_float(buf, 20, mag_ratio);
_mav_put_float(buf, 24, hagl_ratio);
_mav_put_float(buf, 28, tas_ratio);
_mav_put_float(buf, 32, pos_horiz_accuracy);
_mav_put_float(buf, 36, pos_vert_accuracy);
_mav_put_uint16_t(buf, 40, flags);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS, buf, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS, buf, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
#else
mavlink_estimator_status_t *packet = (mavlink_estimator_status_t *)msgbuf;
packet->time_usec = time_usec;
packet->vel_ratio = vel_ratio;
packet->pos_horiz_ratio = pos_horiz_ratio;
packet->pos_vert_ratio = pos_vert_ratio;
packet->mag_ratio = mag_ratio;
packet->hagl_ratio = hagl_ratio;
packet->tas_ratio = tas_ratio;
packet->pos_horiz_accuracy = pos_horiz_accuracy;
packet->pos_vert_accuracy = pos_vert_accuracy;
packet->flags = flags;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS, (const char *)packet, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN, MAVLINK_MSG_ID_ESTIMATOR_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ESTIMATOR_STATUS, (const char *)packet, MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE ESTIMATOR_STATUS UNPACKING
/**
* @brief Get field time_usec from estimator_status message
*
* @return Timestamp (micros since boot or Unix epoch)
*/
static inline uint64_t mavlink_msg_estimator_status_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field flags from estimator_status message
*
* @return Integer bitmask indicating which EKF outputs are valid. See definition for ESTIMATOR_STATUS_FLAGS.
*/
static inline uint16_t mavlink_msg_estimator_status_get_flags(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 40);
}
/**
* @brief Get field vel_ratio from estimator_status message
*
* @return Velocity innovation test ratio
*/
static inline float mavlink_msg_estimator_status_get_vel_ratio(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field pos_horiz_ratio from estimator_status message
*
* @return Horizontal position innovation test ratio
*/
static inline float mavlink_msg_estimator_status_get_pos_horiz_ratio(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field pos_vert_ratio from estimator_status message
*
* @return Vertical position innovation test ratio
*/
static inline float mavlink_msg_estimator_status_get_pos_vert_ratio(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field mag_ratio from estimator_status message
*
* @return Magnetometer innovation test ratio
*/
static inline float mavlink_msg_estimator_status_get_mag_ratio(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field hagl_ratio from estimator_status message
*
* @return Height above terrain innovation test ratio
*/
static inline float mavlink_msg_estimator_status_get_hagl_ratio(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field tas_ratio from estimator_status message
*
* @return True airspeed innovation test ratio
*/
static inline float mavlink_msg_estimator_status_get_tas_ratio(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field pos_horiz_accuracy from estimator_status message
*
* @return Horizontal position 1-STD accuracy relative to the EKF local origin (m)
*/
static inline float mavlink_msg_estimator_status_get_pos_horiz_accuracy(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 32);
}
/**
* @brief Get field pos_vert_accuracy from estimator_status message
*
* @return Vertical position 1-STD accuracy relative to the EKF local origin (m)
*/
static inline float mavlink_msg_estimator_status_get_pos_vert_accuracy(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 36);
}
/**
* @brief Decode a estimator_status message into a struct
*
* @param msg The message to decode
* @param estimator_status C-struct to decode the message contents into
*/
static inline void mavlink_msg_estimator_status_decode(const mavlink_message_t* msg, mavlink_estimator_status_t* estimator_status)
{
#if MAVLINK_NEED_BYTE_SWAP
estimator_status->time_usec = mavlink_msg_estimator_status_get_time_usec(msg);
estimator_status->vel_ratio = mavlink_msg_estimator_status_get_vel_ratio(msg);
estimator_status->pos_horiz_ratio = mavlink_msg_estimator_status_get_pos_horiz_ratio(msg);
estimator_status->pos_vert_ratio = mavlink_msg_estimator_status_get_pos_vert_ratio(msg);
estimator_status->mag_ratio = mavlink_msg_estimator_status_get_mag_ratio(msg);
estimator_status->hagl_ratio = mavlink_msg_estimator_status_get_hagl_ratio(msg);
estimator_status->tas_ratio = mavlink_msg_estimator_status_get_tas_ratio(msg);
estimator_status->pos_horiz_accuracy = mavlink_msg_estimator_status_get_pos_horiz_accuracy(msg);
estimator_status->pos_vert_accuracy = mavlink_msg_estimator_status_get_pos_vert_accuracy(msg);
estimator_status->flags = mavlink_msg_estimator_status_get_flags(msg);
#else
memcpy(estimator_status, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ESTIMATOR_STATUS_LEN);
#endif
}

View File

@ -0,0 +1,233 @@
// MESSAGE EXTENDED_SYS_STATE PACKING
#define MAVLINK_MSG_ID_EXTENDED_SYS_STATE 245
typedef struct __mavlink_extended_sys_state_t
{
uint8_t vtol_state; /*< The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.*/
uint8_t landed_state; /*< The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.*/
} mavlink_extended_sys_state_t;
#define MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN 2
#define MAVLINK_MSG_ID_245_LEN 2
#define MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC 130
#define MAVLINK_MSG_ID_245_CRC 130
#define MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE { \
"EXTENDED_SYS_STATE", \
2, \
{ { "vtol_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_extended_sys_state_t, vtol_state) }, \
{ "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_extended_sys_state_t, landed_state) }, \
} \
}
/**
* @brief Pack a extended_sys_state message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param vtol_state The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.
* @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_extended_sys_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t vtol_state, uint8_t landed_state)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN];
_mav_put_uint8_t(buf, 0, vtol_state);
_mav_put_uint8_t(buf, 1, landed_state);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#else
mavlink_extended_sys_state_t packet;
packet.vtol_state = vtol_state;
packet.landed_state = landed_state;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_EXTENDED_SYS_STATE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
}
/**
* @brief Pack a extended_sys_state message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param vtol_state The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.
* @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_extended_sys_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t vtol_state,uint8_t landed_state)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN];
_mav_put_uint8_t(buf, 0, vtol_state);
_mav_put_uint8_t(buf, 1, landed_state);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#else
mavlink_extended_sys_state_t packet;
packet.vtol_state = vtol_state;
packet.landed_state = landed_state;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_EXTENDED_SYS_STATE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
}
/**
* @brief Encode a extended_sys_state struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param extended_sys_state C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_extended_sys_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_extended_sys_state_t* extended_sys_state)
{
return mavlink_msg_extended_sys_state_pack(system_id, component_id, msg, extended_sys_state->vtol_state, extended_sys_state->landed_state);
}
/**
* @brief Encode a extended_sys_state struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param extended_sys_state C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_extended_sys_state_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_extended_sys_state_t* extended_sys_state)
{
return mavlink_msg_extended_sys_state_pack_chan(system_id, component_id, chan, msg, extended_sys_state->vtol_state, extended_sys_state->landed_state);
}
/**
* @brief Send a extended_sys_state message
* @param chan MAVLink channel to send the message
*
* @param vtol_state The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.
* @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_extended_sys_state_send(mavlink_channel_t chan, uint8_t vtol_state, uint8_t landed_state)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN];
_mav_put_uint8_t(buf, 0, vtol_state);
_mav_put_uint8_t(buf, 1, landed_state);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE, buf, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE, buf, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
#else
mavlink_extended_sys_state_t packet;
packet.vtol_state = vtol_state;
packet.landed_state = landed_state;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE, (const char *)&packet, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE, (const char *)&packet, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_extended_sys_state_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t vtol_state, uint8_t landed_state)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint8_t(buf, 0, vtol_state);
_mav_put_uint8_t(buf, 1, landed_state);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE, buf, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE, buf, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
#else
mavlink_extended_sys_state_t *packet = (mavlink_extended_sys_state_t *)msgbuf;
packet->vtol_state = vtol_state;
packet->landed_state = landed_state;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE, (const char *)packet, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EXTENDED_SYS_STATE, (const char *)packet, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE EXTENDED_SYS_STATE UNPACKING
/**
* @brief Get field vtol_state from extended_sys_state message
*
* @return The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.
*/
static inline uint8_t mavlink_msg_extended_sys_state_get_vtol_state(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 0);
}
/**
* @brief Get field landed_state from extended_sys_state message
*
* @return The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
*/
static inline uint8_t mavlink_msg_extended_sys_state_get_landed_state(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 1);
}
/**
* @brief Decode a extended_sys_state message into a struct
*
* @param msg The message to decode
* @param extended_sys_state C-struct to decode the message contents into
*/
static inline void mavlink_msg_extended_sys_state_decode(const mavlink_message_t* msg, mavlink_extended_sys_state_t* extended_sys_state)
{
#if MAVLINK_NEED_BYTE_SWAP
extended_sys_state->vtol_state = mavlink_msg_extended_sys_state_get_vtol_state(msg);
extended_sys_state->landed_state = mavlink_msg_extended_sys_state_get_landed_state(msg);
#else
memcpy(extended_sys_state, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN);
#endif
}

View File

@ -0,0 +1,273 @@
// MESSAGE FILE_TRANSFER_PROTOCOL PACKING
#define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL 110
typedef struct __mavlink_file_transfer_protocol_t
{
uint8_t target_network; /*< Network ID (0 for broadcast)*/
uint8_t target_system; /*< System ID (0 for broadcast)*/
uint8_t target_component; /*< Component ID (0 for broadcast)*/
uint8_t payload[251]; /*< 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.*/
} mavlink_file_transfer_protocol_t;
#define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN 254
#define MAVLINK_MSG_ID_110_LEN 254
#define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC 84
#define MAVLINK_MSG_ID_110_CRC 84
#define MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN 251
#define MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL { \
"FILE_TRANSFER_PROTOCOL", \
4, \
{ { "target_network", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_file_transfer_protocol_t, target_network) }, \
{ "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_file_transfer_protocol_t, target_system) }, \
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_file_transfer_protocol_t, target_component) }, \
{ "payload", NULL, MAVLINK_TYPE_UINT8_T, 251, 3, offsetof(mavlink_file_transfer_protocol_t, payload) }, \
} \
}
/**
* @brief Pack a file_transfer_protocol message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param target_network Network ID (0 for broadcast)
* @param target_system System ID (0 for broadcast)
* @param target_component Component ID (0 for broadcast)
* @param payload 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.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_file_transfer_protocol_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t target_network, uint8_t target_system, uint8_t target_component, const uint8_t *payload)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
_mav_put_uint8_t(buf, 0, target_network);
_mav_put_uint8_t(buf, 1, target_system);
_mav_put_uint8_t(buf, 2, target_component);
_mav_put_uint8_t_array(buf, 3, payload, 251);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#else
mavlink_file_transfer_protocol_t packet;
packet.target_network = target_network;
packet.target_system = target_system;
packet.target_component = target_component;
mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
}
/**
* @brief Pack a file_transfer_protocol message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param target_network Network ID (0 for broadcast)
* @param target_system System ID (0 for broadcast)
* @param target_component Component ID (0 for broadcast)
* @param payload 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.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_file_transfer_protocol_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t target_network,uint8_t target_system,uint8_t target_component,const uint8_t *payload)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
_mav_put_uint8_t(buf, 0, target_network);
_mav_put_uint8_t(buf, 1, target_system);
_mav_put_uint8_t(buf, 2, target_component);
_mav_put_uint8_t_array(buf, 3, payload, 251);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#else
mavlink_file_transfer_protocol_t packet;
packet.target_network = target_network;
packet.target_system = target_system;
packet.target_component = target_component;
mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
}
/**
* @brief Encode a file_transfer_protocol struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param file_transfer_protocol C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_file_transfer_protocol_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_file_transfer_protocol_t* file_transfer_protocol)
{
return mavlink_msg_file_transfer_protocol_pack(system_id, component_id, msg, file_transfer_protocol->target_network, file_transfer_protocol->target_system, file_transfer_protocol->target_component, file_transfer_protocol->payload);
}
/**
* @brief Encode a file_transfer_protocol struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param file_transfer_protocol C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_file_transfer_protocol_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_file_transfer_protocol_t* file_transfer_protocol)
{
return mavlink_msg_file_transfer_protocol_pack_chan(system_id, component_id, chan, msg, file_transfer_protocol->target_network, file_transfer_protocol->target_system, file_transfer_protocol->target_component, file_transfer_protocol->payload);
}
/**
* @brief Send a file_transfer_protocol message
* @param chan MAVLink channel to send the message
*
* @param target_network Network ID (0 for broadcast)
* @param target_system System ID (0 for broadcast)
* @param target_component Component ID (0 for broadcast)
* @param payload 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.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_file_transfer_protocol_send(mavlink_channel_t chan, uint8_t target_network, uint8_t target_system, uint8_t target_component, const uint8_t *payload)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
_mav_put_uint8_t(buf, 0, target_network);
_mav_put_uint8_t(buf, 1, target_system);
_mav_put_uint8_t(buf, 2, target_component);
_mav_put_uint8_t_array(buf, 3, payload, 251);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
#else
mavlink_file_transfer_protocol_t packet;
packet.target_network = target_network;
packet.target_system = target_system;
packet.target_component = target_component;
mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)&packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)&packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_file_transfer_protocol_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_network, uint8_t target_system, uint8_t target_component, const uint8_t *payload)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint8_t(buf, 0, target_network);
_mav_put_uint8_t(buf, 1, target_system);
_mav_put_uint8_t(buf, 2, target_component);
_mav_put_uint8_t_array(buf, 3, payload, 251);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
#else
mavlink_file_transfer_protocol_t *packet = (mavlink_file_transfer_protocol_t *)msgbuf;
packet->target_network = target_network;
packet->target_system = target_system;
packet->target_component = target_component;
mav_array_memcpy(packet->payload, payload, sizeof(uint8_t)*251);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE FILE_TRANSFER_PROTOCOL UNPACKING
/**
* @brief Get field target_network from file_transfer_protocol message
*
* @return Network ID (0 for broadcast)
*/
static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_network(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 0);
}
/**
* @brief Get field target_system from file_transfer_protocol message
*
* @return System ID (0 for broadcast)
*/
static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_system(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 1);
}
/**
* @brief Get field target_component from file_transfer_protocol message
*
* @return Component ID (0 for broadcast)
*/
static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_component(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 2);
}
/**
* @brief Get field payload from file_transfer_protocol message
*
* @return 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.
*/
static inline uint16_t mavlink_msg_file_transfer_protocol_get_payload(const mavlink_message_t* msg, uint8_t *payload)
{
return _MAV_RETURN_uint8_t_array(msg, payload, 251, 3);
}
/**
* @brief Decode a file_transfer_protocol message into a struct
*
* @param msg The message to decode
* @param file_transfer_protocol C-struct to decode the message contents into
*/
static inline void mavlink_msg_file_transfer_protocol_decode(const mavlink_message_t* msg, mavlink_file_transfer_protocol_t* file_transfer_protocol)
{
#if MAVLINK_NEED_BYTE_SWAP
file_transfer_protocol->target_network = mavlink_msg_file_transfer_protocol_get_target_network(msg);
file_transfer_protocol->target_system = mavlink_msg_file_transfer_protocol_get_target_system(msg);
file_transfer_protocol->target_component = mavlink_msg_file_transfer_protocol_get_target_component(msg);
mavlink_msg_file_transfer_protocol_get_payload(msg, file_transfer_protocol->payload);
#else
memcpy(file_transfer_protocol, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
#endif
}

View File

@ -0,0 +1,445 @@
// MESSAGE FOLLOW_TARGET PACKING
#define MAVLINK_MSG_ID_FOLLOW_TARGET 144
typedef struct __mavlink_follow_target_t
{
uint64_t timestamp; /*< Timestamp in milliseconds since system boot*/
uint64_t custom_state; /*< button states or switches of a tracker device*/
int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/
int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/
float alt; /*< AMSL, in meters*/
float vel[3]; /*< target velocity (0,0,0) for unknown*/
float acc[3]; /*< linear target acceleration (0,0,0) for unknown*/
float attitude_q[4]; /*< (1 0 0 0 for unknown)*/
float rates[3]; /*< (0 0 0 for unknown)*/
float position_cov[3]; /*< eph epv*/
uint8_t est_capabilities; /*< bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)*/
} mavlink_follow_target_t;
#define MAVLINK_MSG_ID_FOLLOW_TARGET_LEN 93
#define MAVLINK_MSG_ID_144_LEN 93
#define MAVLINK_MSG_ID_FOLLOW_TARGET_CRC 127
#define MAVLINK_MSG_ID_144_CRC 127
#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_VEL_LEN 3
#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_ACC_LEN 3
#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_ATTITUDE_Q_LEN 4
#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_RATES_LEN 3
#define MAVLINK_MSG_FOLLOW_TARGET_FIELD_POSITION_COV_LEN 3
#define MAVLINK_MESSAGE_INFO_FOLLOW_TARGET { \
"FOLLOW_TARGET", \
11, \
{ { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_follow_target_t, timestamp) }, \
{ "custom_state", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_follow_target_t, custom_state) }, \
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_follow_target_t, lat) }, \
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_follow_target_t, lon) }, \
{ "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_follow_target_t, alt) }, \
{ "vel", NULL, MAVLINK_TYPE_FLOAT, 3, 28, offsetof(mavlink_follow_target_t, vel) }, \
{ "acc", NULL, MAVLINK_TYPE_FLOAT, 3, 40, offsetof(mavlink_follow_target_t, acc) }, \
{ "attitude_q", NULL, MAVLINK_TYPE_FLOAT, 4, 52, offsetof(mavlink_follow_target_t, attitude_q) }, \
{ "rates", NULL, MAVLINK_TYPE_FLOAT, 3, 68, offsetof(mavlink_follow_target_t, rates) }, \
{ "position_cov", NULL, MAVLINK_TYPE_FLOAT, 3, 80, offsetof(mavlink_follow_target_t, position_cov) }, \
{ "est_capabilities", NULL, MAVLINK_TYPE_UINT8_T, 0, 92, offsetof(mavlink_follow_target_t, est_capabilities) }, \
} \
}
/**
* @brief Pack a follow_target message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param timestamp Timestamp in milliseconds since system boot
* @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt AMSL, in meters
* @param vel target velocity (0,0,0) for unknown
* @param acc linear target acceleration (0,0,0) for unknown
* @param attitude_q (1 0 0 0 for unknown)
* @param rates (0 0 0 for unknown)
* @param position_cov eph epv
* @param custom_state button states or switches of a tracker device
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_follow_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN];
_mav_put_uint64_t(buf, 0, timestamp);
_mav_put_uint64_t(buf, 8, custom_state);
_mav_put_int32_t(buf, 16, lat);
_mav_put_int32_t(buf, 20, lon);
_mav_put_float(buf, 24, alt);
_mav_put_uint8_t(buf, 92, est_capabilities);
_mav_put_float_array(buf, 28, vel, 3);
_mav_put_float_array(buf, 40, acc, 3);
_mav_put_float_array(buf, 52, attitude_q, 4);
_mav_put_float_array(buf, 68, rates, 3);
_mav_put_float_array(buf, 80, position_cov, 3);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#else
mavlink_follow_target_t packet;
packet.timestamp = timestamp;
packet.custom_state = custom_state;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.est_capabilities = est_capabilities;
mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
}
/**
* @brief Pack a follow_target message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param timestamp Timestamp in milliseconds since system boot
* @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt AMSL, in meters
* @param vel target velocity (0,0,0) for unknown
* @param acc linear target acceleration (0,0,0) for unknown
* @param attitude_q (1 0 0 0 for unknown)
* @param rates (0 0 0 for unknown)
* @param position_cov eph epv
* @param custom_state button states or switches of a tracker device
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_follow_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t timestamp,uint8_t est_capabilities,int32_t lat,int32_t lon,float alt,const float *vel,const float *acc,const float *attitude_q,const float *rates,const float *position_cov,uint64_t custom_state)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN];
_mav_put_uint64_t(buf, 0, timestamp);
_mav_put_uint64_t(buf, 8, custom_state);
_mav_put_int32_t(buf, 16, lat);
_mav_put_int32_t(buf, 20, lon);
_mav_put_float(buf, 24, alt);
_mav_put_uint8_t(buf, 92, est_capabilities);
_mav_put_float_array(buf, 28, vel, 3);
_mav_put_float_array(buf, 40, acc, 3);
_mav_put_float_array(buf, 52, attitude_q, 4);
_mav_put_float_array(buf, 68, rates, 3);
_mav_put_float_array(buf, 80, position_cov, 3);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#else
mavlink_follow_target_t packet;
packet.timestamp = timestamp;
packet.custom_state = custom_state;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.est_capabilities = est_capabilities;
mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_FOLLOW_TARGET;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
}
/**
* @brief Encode a follow_target struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param follow_target C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_follow_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_follow_target_t* follow_target)
{
return mavlink_msg_follow_target_pack(system_id, component_id, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
}
/**
* @brief Encode a follow_target struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param follow_target C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_follow_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_follow_target_t* follow_target)
{
return mavlink_msg_follow_target_pack_chan(system_id, component_id, chan, msg, follow_target->timestamp, follow_target->est_capabilities, follow_target->lat, follow_target->lon, follow_target->alt, follow_target->vel, follow_target->acc, follow_target->attitude_q, follow_target->rates, follow_target->position_cov, follow_target->custom_state);
}
/**
* @brief Send a follow_target message
* @param chan MAVLink channel to send the message
*
* @param timestamp Timestamp in milliseconds since system boot
* @param est_capabilities bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt AMSL, in meters
* @param vel target velocity (0,0,0) for unknown
* @param acc linear target acceleration (0,0,0) for unknown
* @param attitude_q (1 0 0 0 for unknown)
* @param rates (0 0 0 for unknown)
* @param position_cov eph epv
* @param custom_state button states or switches of a tracker device
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_follow_target_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_FOLLOW_TARGET_LEN];
_mav_put_uint64_t(buf, 0, timestamp);
_mav_put_uint64_t(buf, 8, custom_state);
_mav_put_int32_t(buf, 16, lat);
_mav_put_int32_t(buf, 20, lon);
_mav_put_float(buf, 24, alt);
_mav_put_uint8_t(buf, 92, est_capabilities);
_mav_put_float_array(buf, 28, vel, 3);
_mav_put_float_array(buf, 40, acc, 3);
_mav_put_float_array(buf, 52, attitude_q, 4);
_mav_put_float_array(buf, 68, rates, 3);
_mav_put_float_array(buf, 80, position_cov, 3);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
#else
mavlink_follow_target_t packet;
packet.timestamp = timestamp;
packet.custom_state = custom_state;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.est_capabilities = est_capabilities;
mav_array_memcpy(packet.vel, vel, sizeof(float)*3);
mav_array_memcpy(packet.acc, acc, sizeof(float)*3);
mav_array_memcpy(packet.attitude_q, attitude_q, sizeof(float)*4);
mav_array_memcpy(packet.rates, rates, sizeof(float)*3);
mav_array_memcpy(packet.position_cov, position_cov, sizeof(float)*3);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)&packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)&packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_FOLLOW_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_follow_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t est_capabilities, int32_t lat, int32_t lon, float alt, const float *vel, const float *acc, const float *attitude_q, const float *rates, const float *position_cov, uint64_t custom_state)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, timestamp);
_mav_put_uint64_t(buf, 8, custom_state);
_mav_put_int32_t(buf, 16, lat);
_mav_put_int32_t(buf, 20, lon);
_mav_put_float(buf, 24, alt);
_mav_put_uint8_t(buf, 92, est_capabilities);
_mav_put_float_array(buf, 28, vel, 3);
_mav_put_float_array(buf, 40, acc, 3);
_mav_put_float_array(buf, 52, attitude_q, 4);
_mav_put_float_array(buf, 68, rates, 3);
_mav_put_float_array(buf, 80, position_cov, 3);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, buf, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
#else
mavlink_follow_target_t *packet = (mavlink_follow_target_t *)msgbuf;
packet->timestamp = timestamp;
packet->custom_state = custom_state;
packet->lat = lat;
packet->lon = lon;
packet->alt = alt;
packet->est_capabilities = est_capabilities;
mav_array_memcpy(packet->vel, vel, sizeof(float)*3);
mav_array_memcpy(packet->acc, acc, sizeof(float)*3);
mav_array_memcpy(packet->attitude_q, attitude_q, sizeof(float)*4);
mav_array_memcpy(packet->rates, rates, sizeof(float)*3);
mav_array_memcpy(packet->position_cov, position_cov, sizeof(float)*3);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN, MAVLINK_MSG_ID_FOLLOW_TARGET_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FOLLOW_TARGET, (const char *)packet, MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE FOLLOW_TARGET UNPACKING
/**
* @brief Get field timestamp from follow_target message
*
* @return Timestamp in milliseconds since system boot
*/
static inline uint64_t mavlink_msg_follow_target_get_timestamp(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field est_capabilities from follow_target message
*
* @return bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3)
*/
static inline uint8_t mavlink_msg_follow_target_get_est_capabilities(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 92);
}
/**
* @brief Get field lat from follow_target message
*
* @return Latitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_follow_target_get_lat(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field lon from follow_target message
*
* @return Longitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_follow_target_get_lon(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 20);
}
/**
* @brief Get field alt from follow_target message
*
* @return AMSL, in meters
*/
static inline float mavlink_msg_follow_target_get_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field vel from follow_target message
*
* @return target velocity (0,0,0) for unknown
*/
static inline uint16_t mavlink_msg_follow_target_get_vel(const mavlink_message_t* msg, float *vel)
{
return _MAV_RETURN_float_array(msg, vel, 3, 28);
}
/**
* @brief Get field acc from follow_target message
*
* @return linear target acceleration (0,0,0) for unknown
*/
static inline uint16_t mavlink_msg_follow_target_get_acc(const mavlink_message_t* msg, float *acc)
{
return _MAV_RETURN_float_array(msg, acc, 3, 40);
}
/**
* @brief Get field attitude_q from follow_target message
*
* @return (1 0 0 0 for unknown)
*/
static inline uint16_t mavlink_msg_follow_target_get_attitude_q(const mavlink_message_t* msg, float *attitude_q)
{
return _MAV_RETURN_float_array(msg, attitude_q, 4, 52);
}
/**
* @brief Get field rates from follow_target message
*
* @return (0 0 0 for unknown)
*/
static inline uint16_t mavlink_msg_follow_target_get_rates(const mavlink_message_t* msg, float *rates)
{
return _MAV_RETURN_float_array(msg, rates, 3, 68);
}
/**
* @brief Get field position_cov from follow_target message
*
* @return eph epv
*/
static inline uint16_t mavlink_msg_follow_target_get_position_cov(const mavlink_message_t* msg, float *position_cov)
{
return _MAV_RETURN_float_array(msg, position_cov, 3, 80);
}
/**
* @brief Get field custom_state from follow_target message
*
* @return button states or switches of a tracker device
*/
static inline uint64_t mavlink_msg_follow_target_get_custom_state(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 8);
}
/**
* @brief Decode a follow_target message into a struct
*
* @param msg The message to decode
* @param follow_target C-struct to decode the message contents into
*/
static inline void mavlink_msg_follow_target_decode(const mavlink_message_t* msg, mavlink_follow_target_t* follow_target)
{
#if MAVLINK_NEED_BYTE_SWAP
follow_target->timestamp = mavlink_msg_follow_target_get_timestamp(msg);
follow_target->custom_state = mavlink_msg_follow_target_get_custom_state(msg);
follow_target->lat = mavlink_msg_follow_target_get_lat(msg);
follow_target->lon = mavlink_msg_follow_target_get_lon(msg);
follow_target->alt = mavlink_msg_follow_target_get_alt(msg);
mavlink_msg_follow_target_get_vel(msg, follow_target->vel);
mavlink_msg_follow_target_get_acc(msg, follow_target->acc);
mavlink_msg_follow_target_get_attitude_q(msg, follow_target->attitude_q);
mavlink_msg_follow_target_get_rates(msg, follow_target->rates);
mavlink_msg_follow_target_get_position_cov(msg, follow_target->position_cov);
follow_target->est_capabilities = mavlink_msg_follow_target_get_est_capabilities(msg);
#else
memcpy(follow_target, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_FOLLOW_TARGET_LEN);
#endif
}

View File

@ -0,0 +1,401 @@
// MESSAGE GLOBAL_POSITION_INT PACKING
#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT 33
typedef struct __mavlink_global_position_int_t
{
uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
int32_t lat; /*< Latitude, expressed as degrees * 1E7*/
int32_t lon; /*< Longitude, expressed as degrees * 1E7*/
int32_t alt; /*< Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well)*/
int32_t relative_alt; /*< Altitude above ground in meters, expressed as * 1000 (millimeters)*/
int16_t vx; /*< Ground X Speed (Latitude, positive north), expressed as m/s * 100*/
int16_t vy; /*< Ground Y Speed (Longitude, positive east), expressed as m/s * 100*/
int16_t vz; /*< Ground Z Speed (Altitude, positive down), expressed as m/s * 100*/
uint16_t hdg; /*< Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
} mavlink_global_position_int_t;
#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN 28
#define MAVLINK_MSG_ID_33_LEN 28
#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC 104
#define MAVLINK_MSG_ID_33_CRC 104
#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT { \
"GLOBAL_POSITION_INT", \
9, \
{ { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_global_position_int_t, time_boot_ms) }, \
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_global_position_int_t, lat) }, \
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_t, lon) }, \
{ "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_t, alt) }, \
{ "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_t, relative_alt) }, \
{ "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_global_position_int_t, vx) }, \
{ "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_global_position_int_t, vy) }, \
{ "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_global_position_int_t, vz) }, \
{ "hdg", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_global_position_int_t, hdg) }, \
} \
}
/**
* @brief Pack a global_position_int message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param alt Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well)
* @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters)
* @param vx Ground X Speed (Latitude, positive north), expressed as m/s * 100
* @param vy Ground Y Speed (Longitude, positive east), expressed as m/s * 100
* @param vz Ground Z Speed (Altitude, positive down), expressed as m/s * 100
* @param hdg Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_global_position_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_int32_t(buf, 4, lat);
_mav_put_int32_t(buf, 8, lon);
_mav_put_int32_t(buf, 12, alt);
_mav_put_int32_t(buf, 16, relative_alt);
_mav_put_int16_t(buf, 20, vx);
_mav_put_int16_t(buf, 22, vy);
_mav_put_int16_t(buf, 24, vz);
_mav_put_uint16_t(buf, 26, hdg);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#else
mavlink_global_position_int_t packet;
packet.time_boot_ms = time_boot_ms;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.relative_alt = relative_alt;
packet.vx = vx;
packet.vy = vy;
packet.vz = vz;
packet.hdg = hdg;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
}
/**
* @brief Pack a global_position_int message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param alt Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well)
* @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters)
* @param vx Ground X Speed (Latitude, positive north), expressed as m/s * 100
* @param vy Ground Y Speed (Longitude, positive east), expressed as m/s * 100
* @param vz Ground Z Speed (Altitude, positive down), expressed as m/s * 100
* @param hdg Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_global_position_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_boot_ms,int32_t lat,int32_t lon,int32_t alt,int32_t relative_alt,int16_t vx,int16_t vy,int16_t vz,uint16_t hdg)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_int32_t(buf, 4, lat);
_mav_put_int32_t(buf, 8, lon);
_mav_put_int32_t(buf, 12, alt);
_mav_put_int32_t(buf, 16, relative_alt);
_mav_put_int16_t(buf, 20, vx);
_mav_put_int16_t(buf, 22, vy);
_mav_put_int16_t(buf, 24, vz);
_mav_put_uint16_t(buf, 26, hdg);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#else
mavlink_global_position_int_t packet;
packet.time_boot_ms = time_boot_ms;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.relative_alt = relative_alt;
packet.vx = vx;
packet.vy = vy;
packet.vz = vz;
packet.hdg = hdg;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
}
/**
* @brief Encode a global_position_int struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param global_position_int C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_global_position_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int)
{
return mavlink_msg_global_position_int_pack(system_id, component_id, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg);
}
/**
* @brief Encode a global_position_int struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param global_position_int C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_global_position_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int)
{
return mavlink_msg_global_position_int_pack_chan(system_id, component_id, chan, msg, global_position_int->time_boot_ms, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->relative_alt, global_position_int->vx, global_position_int->vy, global_position_int->vz, global_position_int->hdg);
}
/**
* @brief Send a global_position_int message
* @param chan MAVLink channel to send the message
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param alt Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well)
* @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters)
* @param vx Ground X Speed (Latitude, positive north), expressed as m/s * 100
* @param vy Ground Y Speed (Longitude, positive east), expressed as m/s * 100
* @param vz Ground Z Speed (Altitude, positive down), expressed as m/s * 100
* @param hdg Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_global_position_int_send(mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN];
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_int32_t(buf, 4, lat);
_mav_put_int32_t(buf, 8, lon);
_mav_put_int32_t(buf, 12, alt);
_mav_put_int32_t(buf, 16, relative_alt);
_mav_put_int16_t(buf, 20, vx);
_mav_put_int16_t(buf, 22, vy);
_mav_put_int16_t(buf, 24, vz);
_mav_put_uint16_t(buf, 26, hdg);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
#else
mavlink_global_position_int_t packet;
packet.time_boot_ms = time_boot_ms;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.relative_alt = relative_alt;
packet.vx = vx;
packet.vy = vy;
packet.vz = vz;
packet.hdg = hdg;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_global_position_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy, int16_t vz, uint16_t hdg)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_boot_ms);
_mav_put_int32_t(buf, 4, lat);
_mav_put_int32_t(buf, 8, lon);
_mav_put_int32_t(buf, 12, alt);
_mav_put_int32_t(buf, 16, relative_alt);
_mav_put_int16_t(buf, 20, vx);
_mav_put_int16_t(buf, 22, vy);
_mav_put_int16_t(buf, 24, vz);
_mav_put_uint16_t(buf, 26, hdg);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
#else
mavlink_global_position_int_t *packet = (mavlink_global_position_int_t *)msgbuf;
packet->time_boot_ms = time_boot_ms;
packet->lat = lat;
packet->lon = lon;
packet->alt = alt;
packet->relative_alt = relative_alt;
packet->vx = vx;
packet->vy = vy;
packet->vz = vz;
packet->hdg = hdg;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GLOBAL_POSITION_INT UNPACKING
/**
* @brief Get field time_boot_ms from global_position_int message
*
* @return Timestamp (milliseconds since system boot)
*/
static inline uint32_t mavlink_msg_global_position_int_get_time_boot_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field lat from global_position_int message
*
* @return Latitude, expressed as degrees * 1E7
*/
static inline int32_t mavlink_msg_global_position_int_get_lat(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 4);
}
/**
* @brief Get field lon from global_position_int message
*
* @return Longitude, expressed as degrees * 1E7
*/
static inline int32_t mavlink_msg_global_position_int_get_lon(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Get field alt from global_position_int message
*
* @return Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well)
*/
static inline int32_t mavlink_msg_global_position_int_get_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 12);
}
/**
* @brief Get field relative_alt from global_position_int message
*
* @return Altitude above ground in meters, expressed as * 1000 (millimeters)
*/
static inline int32_t mavlink_msg_global_position_int_get_relative_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field vx from global_position_int message
*
* @return Ground X Speed (Latitude, positive north), expressed as m/s * 100
*/
static inline int16_t mavlink_msg_global_position_int_get_vx(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 20);
}
/**
* @brief Get field vy from global_position_int message
*
* @return Ground Y Speed (Longitude, positive east), expressed as m/s * 100
*/
static inline int16_t mavlink_msg_global_position_int_get_vy(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 22);
}
/**
* @brief Get field vz from global_position_int message
*
* @return Ground Z Speed (Altitude, positive down), expressed as m/s * 100
*/
static inline int16_t mavlink_msg_global_position_int_get_vz(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 24);
}
/**
* @brief Get field hdg from global_position_int message
*
* @return Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_global_position_int_get_hdg(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 26);
}
/**
* @brief Decode a global_position_int message into a struct
*
* @param msg The message to decode
* @param global_position_int C-struct to decode the message contents into
*/
static inline void mavlink_msg_global_position_int_decode(const mavlink_message_t* msg, mavlink_global_position_int_t* global_position_int)
{
#if MAVLINK_NEED_BYTE_SWAP
global_position_int->time_boot_ms = mavlink_msg_global_position_int_get_time_boot_ms(msg);
global_position_int->lat = mavlink_msg_global_position_int_get_lat(msg);
global_position_int->lon = mavlink_msg_global_position_int_get_lon(msg);
global_position_int->alt = mavlink_msg_global_position_int_get_alt(msg);
global_position_int->relative_alt = mavlink_msg_global_position_int_get_relative_alt(msg);
global_position_int->vx = mavlink_msg_global_position_int_get_vx(msg);
global_position_int->vy = mavlink_msg_global_position_int_get_vy(msg);
global_position_int->vz = mavlink_msg_global_position_int_get_vz(msg);
global_position_int->hdg = mavlink_msg_global_position_int_get_hdg(msg);
#else
memcpy(global_position_int, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN);
#endif
}

View File

@ -0,0 +1,441 @@
// MESSAGE GLOBAL_POSITION_INT_COV PACKING
#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV 63
typedef struct __mavlink_global_position_int_cov_t
{
uint64_t time_utc; /*< Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver.*/
uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
int32_t lat; /*< Latitude, expressed as degrees * 1E7*/
int32_t lon; /*< Longitude, expressed as degrees * 1E7*/
int32_t alt; /*< Altitude in meters, expressed as * 1000 (millimeters), above MSL*/
int32_t relative_alt; /*< Altitude above ground in meters, expressed as * 1000 (millimeters)*/
float vx; /*< Ground X Speed (Latitude), expressed as m/s*/
float vy; /*< Ground Y Speed (Longitude), expressed as m/s*/
float vz; /*< Ground Z Speed (Altitude), expressed as m/s*/
float covariance[36]; /*< Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.)*/
uint8_t estimator_type; /*< Class id of the estimator this estimate originated from.*/
} mavlink_global_position_int_cov_t;
#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN 185
#define MAVLINK_MSG_ID_63_LEN 185
#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC 51
#define MAVLINK_MSG_ID_63_CRC 51
#define MAVLINK_MSG_GLOBAL_POSITION_INT_COV_FIELD_COVARIANCE_LEN 36
#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT_COV { \
"GLOBAL_POSITION_INT_COV", \
11, \
{ { "time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_int_cov_t, time_utc) }, \
{ "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_global_position_int_cov_t, time_boot_ms) }, \
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_global_position_int_cov_t, lat) }, \
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_global_position_int_cov_t, lon) }, \
{ "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_global_position_int_cov_t, alt) }, \
{ "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_global_position_int_cov_t, relative_alt) }, \
{ "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_int_cov_t, vx) }, \
{ "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_global_position_int_cov_t, vy) }, \
{ "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_global_position_int_cov_t, vz) }, \
{ "covariance", NULL, MAVLINK_TYPE_FLOAT, 36, 40, offsetof(mavlink_global_position_int_cov_t, covariance) }, \
{ "estimator_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 184, offsetof(mavlink_global_position_int_cov_t, estimator_type) }, \
} \
}
/**
* @brief Pack a global_position_int_cov message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param time_utc Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver.
* @param estimator_type Class id of the estimator this estimate originated from.
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param alt Altitude in meters, expressed as * 1000 (millimeters), above MSL
* @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters)
* @param vx Ground X Speed (Latitude), expressed as m/s
* @param vy Ground Y Speed (Longitude), expressed as m/s
* @param vz Ground Z Speed (Altitude), expressed as m/s
* @param covariance Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_global_position_int_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN];
_mav_put_uint64_t(buf, 0, time_utc);
_mav_put_uint32_t(buf, 8, time_boot_ms);
_mav_put_int32_t(buf, 12, lat);
_mav_put_int32_t(buf, 16, lon);
_mav_put_int32_t(buf, 20, alt);
_mav_put_int32_t(buf, 24, relative_alt);
_mav_put_float(buf, 28, vx);
_mav_put_float(buf, 32, vy);
_mav_put_float(buf, 36, vz);
_mav_put_uint8_t(buf, 184, estimator_type);
_mav_put_float_array(buf, 40, covariance, 36);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#else
mavlink_global_position_int_cov_t packet;
packet.time_utc = time_utc;
packet.time_boot_ms = time_boot_ms;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.relative_alt = relative_alt;
packet.vx = vx;
packet.vy = vy;
packet.vz = vz;
packet.estimator_type = estimator_type;
mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
}
/**
* @brief Pack a global_position_int_cov message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param time_utc Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver.
* @param estimator_type Class id of the estimator this estimate originated from.
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param alt Altitude in meters, expressed as * 1000 (millimeters), above MSL
* @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters)
* @param vx Ground X Speed (Latitude), expressed as m/s
* @param vy Ground Y Speed (Longitude), expressed as m/s
* @param vz Ground Z Speed (Altitude), expressed as m/s
* @param covariance Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_global_position_int_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_boot_ms,uint64_t time_utc,uint8_t estimator_type,int32_t lat,int32_t lon,int32_t alt,int32_t relative_alt,float vx,float vy,float vz,const float *covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN];
_mav_put_uint64_t(buf, 0, time_utc);
_mav_put_uint32_t(buf, 8, time_boot_ms);
_mav_put_int32_t(buf, 12, lat);
_mav_put_int32_t(buf, 16, lon);
_mav_put_int32_t(buf, 20, alt);
_mav_put_int32_t(buf, 24, relative_alt);
_mav_put_float(buf, 28, vx);
_mav_put_float(buf, 32, vy);
_mav_put_float(buf, 36, vz);
_mav_put_uint8_t(buf, 184, estimator_type);
_mav_put_float_array(buf, 40, covariance, 36);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#else
mavlink_global_position_int_cov_t packet;
packet.time_utc = time_utc;
packet.time_boot_ms = time_boot_ms;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.relative_alt = relative_alt;
packet.vx = vx;
packet.vy = vy;
packet.vz = vz;
packet.estimator_type = estimator_type;
mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
}
/**
* @brief Encode a global_position_int_cov struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param global_position_int_cov C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_global_position_int_cov_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_int_cov_t* global_position_int_cov)
{
return mavlink_msg_global_position_int_cov_pack(system_id, component_id, msg, global_position_int_cov->time_boot_ms, global_position_int_cov->time_utc, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance);
}
/**
* @brief Encode a global_position_int_cov struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param global_position_int_cov C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_global_position_int_cov_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_int_cov_t* global_position_int_cov)
{
return mavlink_msg_global_position_int_cov_pack_chan(system_id, component_id, chan, msg, global_position_int_cov->time_boot_ms, global_position_int_cov->time_utc, global_position_int_cov->estimator_type, global_position_int_cov->lat, global_position_int_cov->lon, global_position_int_cov->alt, global_position_int_cov->relative_alt, global_position_int_cov->vx, global_position_int_cov->vy, global_position_int_cov->vz, global_position_int_cov->covariance);
}
/**
* @brief Send a global_position_int_cov message
* @param chan MAVLink channel to send the message
*
* @param time_boot_ms Timestamp (milliseconds since system boot)
* @param time_utc Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver.
* @param estimator_type Class id of the estimator this estimate originated from.
* @param lat Latitude, expressed as degrees * 1E7
* @param lon Longitude, expressed as degrees * 1E7
* @param alt Altitude in meters, expressed as * 1000 (millimeters), above MSL
* @param relative_alt Altitude above ground in meters, expressed as * 1000 (millimeters)
* @param vx Ground X Speed (Latitude), expressed as m/s
* @param vy Ground Y Speed (Longitude), expressed as m/s
* @param vz Ground Z Speed (Altitude), expressed as m/s
* @param covariance Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_global_position_int_cov_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN];
_mav_put_uint64_t(buf, 0, time_utc);
_mav_put_uint32_t(buf, 8, time_boot_ms);
_mav_put_int32_t(buf, 12, lat);
_mav_put_int32_t(buf, 16, lon);
_mav_put_int32_t(buf, 20, alt);
_mav_put_int32_t(buf, 24, relative_alt);
_mav_put_float(buf, 28, vx);
_mav_put_float(buf, 32, vy);
_mav_put_float(buf, 36, vz);
_mav_put_uint8_t(buf, 184, estimator_type);
_mav_put_float_array(buf, 40, covariance, 36);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
#else
mavlink_global_position_int_cov_t packet;
packet.time_utc = time_utc;
packet.time_boot_ms = time_boot_ms;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.relative_alt = relative_alt;
packet.vx = vx;
packet.vy = vy;
packet.vz = vz;
packet.estimator_type = estimator_type;
mav_array_memcpy(packet.covariance, covariance, sizeof(float)*36);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_global_position_int_cov_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t time_utc, uint8_t estimator_type, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, float vx, float vy, float vz, const float *covariance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_utc);
_mav_put_uint32_t(buf, 8, time_boot_ms);
_mav_put_int32_t(buf, 12, lat);
_mav_put_int32_t(buf, 16, lon);
_mav_put_int32_t(buf, 20, alt);
_mav_put_int32_t(buf, 24, relative_alt);
_mav_put_float(buf, 28, vx);
_mav_put_float(buf, 32, vy);
_mav_put_float(buf, 36, vz);
_mav_put_uint8_t(buf, 184, estimator_type);
_mav_put_float_array(buf, 40, covariance, 36);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
#else
mavlink_global_position_int_cov_t *packet = (mavlink_global_position_int_cov_t *)msgbuf;
packet->time_utc = time_utc;
packet->time_boot_ms = time_boot_ms;
packet->lat = lat;
packet->lon = lon;
packet->alt = alt;
packet->relative_alt = relative_alt;
packet->vx = vx;
packet->vy = vy;
packet->vz = vz;
packet->estimator_type = estimator_type;
mav_array_memcpy(packet->covariance, covariance, sizeof(float)*36);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GLOBAL_POSITION_INT_COV UNPACKING
/**
* @brief Get field time_boot_ms from global_position_int_cov message
*
* @return Timestamp (milliseconds since system boot)
*/
static inline uint32_t mavlink_msg_global_position_int_cov_get_time_boot_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 8);
}
/**
* @brief Get field time_utc from global_position_int_cov message
*
* @return Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver.
*/
static inline uint64_t mavlink_msg_global_position_int_cov_get_time_utc(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field estimator_type from global_position_int_cov message
*
* @return Class id of the estimator this estimate originated from.
*/
static inline uint8_t mavlink_msg_global_position_int_cov_get_estimator_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 184);
}
/**
* @brief Get field lat from global_position_int_cov message
*
* @return Latitude, expressed as degrees * 1E7
*/
static inline int32_t mavlink_msg_global_position_int_cov_get_lat(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 12);
}
/**
* @brief Get field lon from global_position_int_cov message
*
* @return Longitude, expressed as degrees * 1E7
*/
static inline int32_t mavlink_msg_global_position_int_cov_get_lon(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field alt from global_position_int_cov message
*
* @return Altitude in meters, expressed as * 1000 (millimeters), above MSL
*/
static inline int32_t mavlink_msg_global_position_int_cov_get_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 20);
}
/**
* @brief Get field relative_alt from global_position_int_cov message
*
* @return Altitude above ground in meters, expressed as * 1000 (millimeters)
*/
static inline int32_t mavlink_msg_global_position_int_cov_get_relative_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 24);
}
/**
* @brief Get field vx from global_position_int_cov message
*
* @return Ground X Speed (Latitude), expressed as m/s
*/
static inline float mavlink_msg_global_position_int_cov_get_vx(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field vy from global_position_int_cov message
*
* @return Ground Y Speed (Longitude), expressed as m/s
*/
static inline float mavlink_msg_global_position_int_cov_get_vy(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 32);
}
/**
* @brief Get field vz from global_position_int_cov message
*
* @return Ground Z Speed (Altitude), expressed as m/s
*/
static inline float mavlink_msg_global_position_int_cov_get_vz(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 36);
}
/**
* @brief Get field covariance from global_position_int_cov message
*
* @return Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.)
*/
static inline uint16_t mavlink_msg_global_position_int_cov_get_covariance(const mavlink_message_t* msg, float *covariance)
{
return _MAV_RETURN_float_array(msg, covariance, 36, 40);
}
/**
* @brief Decode a global_position_int_cov message into a struct
*
* @param msg The message to decode
* @param global_position_int_cov C-struct to decode the message contents into
*/
static inline void mavlink_msg_global_position_int_cov_decode(const mavlink_message_t* msg, mavlink_global_position_int_cov_t* global_position_int_cov)
{
#if MAVLINK_NEED_BYTE_SWAP
global_position_int_cov->time_utc = mavlink_msg_global_position_int_cov_get_time_utc(msg);
global_position_int_cov->time_boot_ms = mavlink_msg_global_position_int_cov_get_time_boot_ms(msg);
global_position_int_cov->lat = mavlink_msg_global_position_int_cov_get_lat(msg);
global_position_int_cov->lon = mavlink_msg_global_position_int_cov_get_lon(msg);
global_position_int_cov->alt = mavlink_msg_global_position_int_cov_get_alt(msg);
global_position_int_cov->relative_alt = mavlink_msg_global_position_int_cov_get_relative_alt(msg);
global_position_int_cov->vx = mavlink_msg_global_position_int_cov_get_vx(msg);
global_position_int_cov->vy = mavlink_msg_global_position_int_cov_get_vy(msg);
global_position_int_cov->vz = mavlink_msg_global_position_int_cov_get_vz(msg);
mavlink_msg_global_position_int_cov_get_covariance(msg, global_position_int_cov->covariance);
global_position_int_cov->estimator_type = mavlink_msg_global_position_int_cov_get_estimator_type(msg);
#else
memcpy(global_position_int_cov, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_LEN);
#endif
}

View File

@ -0,0 +1,353 @@
// MESSAGE GLOBAL_VISION_POSITION_ESTIMATE PACKING
#define MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE 101
typedef struct __mavlink_global_vision_position_estimate_t
{
uint64_t usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
float x; /*< Global X position*/
float y; /*< Global Y position*/
float z; /*< Global Z position*/
float roll; /*< Roll angle in rad*/
float pitch; /*< Pitch angle in rad*/
float yaw; /*< Yaw angle in rad*/
} mavlink_global_vision_position_estimate_t;
#define MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN 32
#define MAVLINK_MSG_ID_101_LEN 32
#define MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC 102
#define MAVLINK_MSG_ID_101_CRC 102
#define MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE { \
"GLOBAL_VISION_POSITION_ESTIMATE", \
7, \
{ { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_vision_position_estimate_t, usec) }, \
{ "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_global_vision_position_estimate_t, x) }, \
{ "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_global_vision_position_estimate_t, y) }, \
{ "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_global_vision_position_estimate_t, z) }, \
{ "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_global_vision_position_estimate_t, roll) }, \
{ "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_vision_position_estimate_t, pitch) }, \
{ "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_vision_position_estimate_t, yaw) }, \
} \
}
/**
* @brief Pack a global_vision_position_estimate message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param x Global X position
* @param y Global Y position
* @param z Global Z position
* @param roll Roll angle in rad
* @param pitch Pitch angle in rad
* @param yaw Yaw angle in rad
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_global_vision_position_estimate_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN];
_mav_put_uint64_t(buf, 0, usec);
_mav_put_float(buf, 8, x);
_mav_put_float(buf, 12, y);
_mav_put_float(buf, 16, z);
_mav_put_float(buf, 20, roll);
_mav_put_float(buf, 24, pitch);
_mav_put_float(buf, 28, yaw);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#else
mavlink_global_vision_position_estimate_t packet;
packet.usec = usec;
packet.x = x;
packet.y = y;
packet.z = z;
packet.roll = roll;
packet.pitch = pitch;
packet.yaw = yaw;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
}
/**
* @brief Pack a global_vision_position_estimate message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param x Global X position
* @param y Global Y position
* @param z Global Z position
* @param roll Roll angle in rad
* @param pitch Pitch angle in rad
* @param yaw Yaw angle in rad
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_global_vision_position_estimate_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t usec,float x,float y,float z,float roll,float pitch,float yaw)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN];
_mav_put_uint64_t(buf, 0, usec);
_mav_put_float(buf, 8, x);
_mav_put_float(buf, 12, y);
_mav_put_float(buf, 16, z);
_mav_put_float(buf, 20, roll);
_mav_put_float(buf, 24, pitch);
_mav_put_float(buf, 28, yaw);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#else
mavlink_global_vision_position_estimate_t packet;
packet.usec = usec;
packet.x = x;
packet.y = y;
packet.z = z;
packet.roll = roll;
packet.pitch = pitch;
packet.yaw = yaw;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
}
/**
* @brief Encode a global_vision_position_estimate struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param global_vision_position_estimate C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_global_vision_position_estimate_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_vision_position_estimate_t* global_vision_position_estimate)
{
return mavlink_msg_global_vision_position_estimate_pack(system_id, component_id, msg, global_vision_position_estimate->usec, global_vision_position_estimate->x, global_vision_position_estimate->y, global_vision_position_estimate->z, global_vision_position_estimate->roll, global_vision_position_estimate->pitch, global_vision_position_estimate->yaw);
}
/**
* @brief Encode a global_vision_position_estimate struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param global_vision_position_estimate C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_global_vision_position_estimate_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_vision_position_estimate_t* global_vision_position_estimate)
{
return mavlink_msg_global_vision_position_estimate_pack_chan(system_id, component_id, chan, msg, global_vision_position_estimate->usec, global_vision_position_estimate->x, global_vision_position_estimate->y, global_vision_position_estimate->z, global_vision_position_estimate->roll, global_vision_position_estimate->pitch, global_vision_position_estimate->yaw);
}
/**
* @brief Send a global_vision_position_estimate message
* @param chan MAVLink channel to send the message
*
* @param usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param x Global X position
* @param y Global Y position
* @param z Global Z position
* @param roll Roll angle in rad
* @param pitch Pitch angle in rad
* @param yaw Yaw angle in rad
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_global_vision_position_estimate_send(mavlink_channel_t chan, uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN];
_mav_put_uint64_t(buf, 0, usec);
_mav_put_float(buf, 8, x);
_mav_put_float(buf, 12, y);
_mav_put_float(buf, 16, z);
_mav_put_float(buf, 20, roll);
_mav_put_float(buf, 24, pitch);
_mav_put_float(buf, 28, yaw);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, buf, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, buf, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
#else
mavlink_global_vision_position_estimate_t packet;
packet.usec = usec;
packet.x = x;
packet.y = y;
packet.z = z;
packet.roll = roll;
packet.pitch = pitch;
packet.yaw = yaw;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_global_vision_position_estimate_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, usec);
_mav_put_float(buf, 8, x);
_mav_put_float(buf, 12, y);
_mav_put_float(buf, 16, z);
_mav_put_float(buf, 20, roll);
_mav_put_float(buf, 24, pitch);
_mav_put_float(buf, 28, yaw);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, buf, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, buf, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
#else
mavlink_global_vision_position_estimate_t *packet = (mavlink_global_vision_position_estimate_t *)msgbuf;
packet->usec = usec;
packet->x = x;
packet->y = y;
packet->z = z;
packet->roll = roll;
packet->pitch = pitch;
packet->yaw = yaw;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GLOBAL_VISION_POSITION_ESTIMATE UNPACKING
/**
* @brief Get field usec from global_vision_position_estimate message
*
* @return Timestamp (microseconds, synced to UNIX time or since system boot)
*/
static inline uint64_t mavlink_msg_global_vision_position_estimate_get_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field x from global_vision_position_estimate message
*
* @return Global X position
*/
static inline float mavlink_msg_global_vision_position_estimate_get_x(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field y from global_vision_position_estimate message
*
* @return Global Y position
*/
static inline float mavlink_msg_global_vision_position_estimate_get_y(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field z from global_vision_position_estimate message
*
* @return Global Z position
*/
static inline float mavlink_msg_global_vision_position_estimate_get_z(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field roll from global_vision_position_estimate message
*
* @return Roll angle in rad
*/
static inline float mavlink_msg_global_vision_position_estimate_get_roll(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field pitch from global_vision_position_estimate message
*
* @return Pitch angle in rad
*/
static inline float mavlink_msg_global_vision_position_estimate_get_pitch(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field yaw from global_vision_position_estimate message
*
* @return Yaw angle in rad
*/
static inline float mavlink_msg_global_vision_position_estimate_get_yaw(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Decode a global_vision_position_estimate message into a struct
*
* @param msg The message to decode
* @param global_vision_position_estimate C-struct to decode the message contents into
*/
static inline void mavlink_msg_global_vision_position_estimate_decode(const mavlink_message_t* msg, mavlink_global_vision_position_estimate_t* global_vision_position_estimate)
{
#if MAVLINK_NEED_BYTE_SWAP
global_vision_position_estimate->usec = mavlink_msg_global_vision_position_estimate_get_usec(msg);
global_vision_position_estimate->x = mavlink_msg_global_vision_position_estimate_get_x(msg);
global_vision_position_estimate->y = mavlink_msg_global_vision_position_estimate_get_y(msg);
global_vision_position_estimate->z = mavlink_msg_global_vision_position_estimate_get_z(msg);
global_vision_position_estimate->roll = mavlink_msg_global_vision_position_estimate_get_roll(msg);
global_vision_position_estimate->pitch = mavlink_msg_global_vision_position_estimate_get_pitch(msg);
global_vision_position_estimate->yaw = mavlink_msg_global_vision_position_estimate_get_yaw(msg);
#else
memcpy(global_vision_position_estimate, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN);
#endif
}

View File

@ -0,0 +1,473 @@
// MESSAGE GPS2_RAW PACKING
#define MAVLINK_MSG_ID_GPS2_RAW 124
typedef struct __mavlink_gps2_raw_t
{
uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/
int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/
int32_t alt; /*< Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)*/
uint32_t dgps_age; /*< Age of DGPS info*/
uint16_t eph; /*< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX*/
uint16_t epv; /*< GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX*/
uint16_t vel; /*< GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX*/
uint16_t cog; /*< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
uint8_t fix_type; /*< 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.*/
uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/
uint8_t dgps_numch; /*< Number of DGPS satellites*/
} mavlink_gps2_raw_t;
#define MAVLINK_MSG_ID_GPS2_RAW_LEN 35
#define MAVLINK_MSG_ID_124_LEN 35
#define MAVLINK_MSG_ID_GPS2_RAW_CRC 87
#define MAVLINK_MSG_ID_124_CRC 87
#define MAVLINK_MESSAGE_INFO_GPS2_RAW { \
"GPS2_RAW", \
12, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) }, \
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) }, \
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_raw_t, lon) }, \
{ "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_raw_t, alt) }, \
{ "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) }, \
{ "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps2_raw_t, eph) }, \
{ "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps2_raw_t, epv) }, \
{ "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_raw_t, vel) }, \
{ "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_gps2_raw_t, cog) }, \
{ "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) }, \
{ "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_raw_t, satellites_visible) }, \
{ "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) }, \
} \
}
/**
* @brief Pack a gps2_raw message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
* @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
* @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
* @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
* @param satellites_visible Number of satellites visible. If unknown, set to 255
* @param dgps_numch Number of DGPS satellites
* @param dgps_age Age of DGPS info
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint32_t(buf, 20, dgps_age);
_mav_put_uint16_t(buf, 24, eph);
_mav_put_uint16_t(buf, 26, epv);
_mav_put_uint16_t(buf, 28, vel);
_mav_put_uint16_t(buf, 30, cog);
_mav_put_uint8_t(buf, 32, fix_type);
_mav_put_uint8_t(buf, 33, satellites_visible);
_mav_put_uint8_t(buf, 34, dgps_numch);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#else
mavlink_gps2_raw_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.dgps_age = dgps_age;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
packet.dgps_numch = dgps_numch;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS2_RAW;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
}
/**
* @brief Pack a gps2_raw message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
* @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
* @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
* @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
* @param satellites_visible Number of satellites visible. If unknown, set to 255
* @param dgps_numch Number of DGPS satellites
* @param dgps_age Age of DGPS info
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps2_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,uint16_t eph,uint16_t epv,uint16_t vel,uint16_t cog,uint8_t satellites_visible,uint8_t dgps_numch,uint32_t dgps_age)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint32_t(buf, 20, dgps_age);
_mav_put_uint16_t(buf, 24, eph);
_mav_put_uint16_t(buf, 26, epv);
_mav_put_uint16_t(buf, 28, vel);
_mav_put_uint16_t(buf, 30, cog);
_mav_put_uint8_t(buf, 32, fix_type);
_mav_put_uint8_t(buf, 33, satellites_visible);
_mav_put_uint8_t(buf, 34, dgps_numch);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#else
mavlink_gps2_raw_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.dgps_age = dgps_age;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
packet.dgps_numch = dgps_numch;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS2_RAW;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
}
/**
* @brief Encode a gps2_raw struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param gps2_raw C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps2_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps2_raw_t* gps2_raw)
{
return mavlink_msg_gps2_raw_pack(system_id, component_id, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age);
}
/**
* @brief Encode a gps2_raw struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param gps2_raw C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps2_raw_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps2_raw_t* gps2_raw)
{
return mavlink_msg_gps2_raw_pack_chan(system_id, component_id, chan, msg, gps2_raw->time_usec, gps2_raw->fix_type, gps2_raw->lat, gps2_raw->lon, gps2_raw->alt, gps2_raw->eph, gps2_raw->epv, gps2_raw->vel, gps2_raw->cog, gps2_raw->satellites_visible, gps2_raw->dgps_numch, gps2_raw->dgps_age);
}
/**
* @brief Send a gps2_raw message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
* @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
* @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
* @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
* @param satellites_visible Number of satellites visible. If unknown, set to 255
* @param dgps_numch Number of DGPS satellites
* @param dgps_age Age of DGPS info
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps2_raw_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint32_t(buf, 20, dgps_age);
_mav_put_uint16_t(buf, 24, eph);
_mav_put_uint16_t(buf, 26, epv);
_mav_put_uint16_t(buf, 28, vel);
_mav_put_uint16_t(buf, 30, cog);
_mav_put_uint8_t(buf, 32, fix_type);
_mav_put_uint8_t(buf, 33, satellites_visible);
_mav_put_uint8_t(buf, 34, dgps_numch);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, buf, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
#else
mavlink_gps2_raw_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.dgps_age = dgps_age;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
packet.dgps_numch = dgps_numch;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GPS2_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_gps2_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible, uint8_t dgps_numch, uint32_t dgps_age)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint32_t(buf, 20, dgps_age);
_mav_put_uint16_t(buf, 24, eph);
_mav_put_uint16_t(buf, 26, epv);
_mav_put_uint16_t(buf, 28, vel);
_mav_put_uint16_t(buf, 30, cog);
_mav_put_uint8_t(buf, 32, fix_type);
_mav_put_uint8_t(buf, 33, satellites_visible);
_mav_put_uint8_t(buf, 34, dgps_numch);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, buf, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
#else
mavlink_gps2_raw_t *packet = (mavlink_gps2_raw_t *)msgbuf;
packet->time_usec = time_usec;
packet->lat = lat;
packet->lon = lon;
packet->alt = alt;
packet->dgps_age = dgps_age;
packet->eph = eph;
packet->epv = epv;
packet->vel = vel;
packet->cog = cog;
packet->fix_type = fix_type;
packet->satellites_visible = satellites_visible;
packet->dgps_numch = dgps_numch;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)packet, MAVLINK_MSG_ID_GPS2_RAW_LEN, MAVLINK_MSG_ID_GPS2_RAW_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RAW, (const char *)packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GPS2_RAW UNPACKING
/**
* @brief Get field time_usec from gps2_raw message
*
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
*/
static inline uint64_t mavlink_msg_gps2_raw_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field fix_type from gps2_raw message
*
* @return 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.
*/
static inline uint8_t mavlink_msg_gps2_raw_get_fix_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 32);
}
/**
* @brief Get field lat from gps2_raw message
*
* @return Latitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_gps2_raw_get_lat(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Get field lon from gps2_raw message
*
* @return Longitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_gps2_raw_get_lon(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 12);
}
/**
* @brief Get field alt from gps2_raw message
*
* @return Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
*/
static inline int32_t mavlink_msg_gps2_raw_get_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field eph from gps2_raw message
*
* @return GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_gps2_raw_get_eph(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 24);
}
/**
* @brief Get field epv from gps2_raw message
*
* @return GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_gps2_raw_get_epv(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 26);
}
/**
* @brief Get field vel from gps2_raw message
*
* @return GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_gps2_raw_get_vel(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 28);
}
/**
* @brief Get field cog from gps2_raw message
*
* @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_gps2_raw_get_cog(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 30);
}
/**
* @brief Get field satellites_visible from gps2_raw message
*
* @return Number of satellites visible. If unknown, set to 255
*/
static inline uint8_t mavlink_msg_gps2_raw_get_satellites_visible(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 33);
}
/**
* @brief Get field dgps_numch from gps2_raw message
*
* @return Number of DGPS satellites
*/
static inline uint8_t mavlink_msg_gps2_raw_get_dgps_numch(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 34);
}
/**
* @brief Get field dgps_age from gps2_raw message
*
* @return Age of DGPS info
*/
static inline uint32_t mavlink_msg_gps2_raw_get_dgps_age(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 20);
}
/**
* @brief Decode a gps2_raw message into a struct
*
* @param msg The message to decode
* @param gps2_raw C-struct to decode the message contents into
*/
static inline void mavlink_msg_gps2_raw_decode(const mavlink_message_t* msg, mavlink_gps2_raw_t* gps2_raw)
{
#if MAVLINK_NEED_BYTE_SWAP
gps2_raw->time_usec = mavlink_msg_gps2_raw_get_time_usec(msg);
gps2_raw->lat = mavlink_msg_gps2_raw_get_lat(msg);
gps2_raw->lon = mavlink_msg_gps2_raw_get_lon(msg);
gps2_raw->alt = mavlink_msg_gps2_raw_get_alt(msg);
gps2_raw->dgps_age = mavlink_msg_gps2_raw_get_dgps_age(msg);
gps2_raw->eph = mavlink_msg_gps2_raw_get_eph(msg);
gps2_raw->epv = mavlink_msg_gps2_raw_get_epv(msg);
gps2_raw->vel = mavlink_msg_gps2_raw_get_vel(msg);
gps2_raw->cog = mavlink_msg_gps2_raw_get_cog(msg);
gps2_raw->fix_type = mavlink_msg_gps2_raw_get_fix_type(msg);
gps2_raw->satellites_visible = mavlink_msg_gps2_raw_get_satellites_visible(msg);
gps2_raw->dgps_numch = mavlink_msg_gps2_raw_get_dgps_numch(msg);
#else
memcpy(gps2_raw, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS2_RAW_LEN);
#endif
}

View File

@ -0,0 +1,497 @@
// MESSAGE GPS2_RTK PACKING
#define MAVLINK_MSG_ID_GPS2_RTK 128
typedef struct __mavlink_gps2_rtk_t
{
uint32_t time_last_baseline_ms; /*< Time since boot of last baseline message received in ms.*/
uint32_t tow; /*< GPS Time of Week of last baseline*/
int32_t baseline_a_mm; /*< Current baseline in ECEF x or NED north component in mm.*/
int32_t baseline_b_mm; /*< Current baseline in ECEF y or NED east component in mm.*/
int32_t baseline_c_mm; /*< Current baseline in ECEF z or NED down component in mm.*/
uint32_t accuracy; /*< Current estimate of baseline accuracy.*/
int32_t iar_num_hypotheses; /*< Current number of integer ambiguity hypotheses.*/
uint16_t wn; /*< GPS Week Number of last baseline*/
uint8_t rtk_receiver_id; /*< Identification of connected RTK receiver.*/
uint8_t rtk_health; /*< GPS-specific health report for RTK data.*/
uint8_t rtk_rate; /*< Rate of baseline messages being received by GPS, in HZ*/
uint8_t nsats; /*< Current number of sats used for RTK calculation.*/
uint8_t baseline_coords_type; /*< Coordinate system of baseline. 0 == ECEF, 1 == NED*/
} mavlink_gps2_rtk_t;
#define MAVLINK_MSG_ID_GPS2_RTK_LEN 35
#define MAVLINK_MSG_ID_128_LEN 35
#define MAVLINK_MSG_ID_GPS2_RTK_CRC 226
#define MAVLINK_MSG_ID_128_CRC 226
#define MAVLINK_MESSAGE_INFO_GPS2_RTK { \
"GPS2_RTK", \
13, \
{ { "time_last_baseline_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gps2_rtk_t, time_last_baseline_ms) }, \
{ "tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gps2_rtk_t, tow) }, \
{ "baseline_a_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_rtk_t, baseline_a_mm) }, \
{ "baseline_b_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_rtk_t, baseline_b_mm) }, \
{ "baseline_c_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_rtk_t, baseline_c_mm) }, \
{ "accuracy", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_rtk_t, accuracy) }, \
{ "iar_num_hypotheses", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_gps2_rtk_t, iar_num_hypotheses) }, \
{ "wn", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_rtk_t, wn) }, \
{ "rtk_receiver_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_gps2_rtk_t, rtk_receiver_id) }, \
{ "rtk_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_gps2_rtk_t, rtk_health) }, \
{ "rtk_rate", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_rtk_t, rtk_rate) }, \
{ "nsats", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_rtk_t, nsats) }, \
{ "baseline_coords_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_rtk_t, baseline_coords_type) }, \
} \
}
/**
* @brief Pack a gps2_rtk message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_last_baseline_ms Time since boot of last baseline message received in ms.
* @param rtk_receiver_id Identification of connected RTK receiver.
* @param wn GPS Week Number of last baseline
* @param tow GPS Time of Week of last baseline
* @param rtk_health GPS-specific health report for RTK data.
* @param rtk_rate Rate of baseline messages being received by GPS, in HZ
* @param nsats Current number of sats used for RTK calculation.
* @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
* @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
* @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
* @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
* @param accuracy Current estimate of baseline accuracy.
* @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps2_rtk_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS2_RTK_LEN];
_mav_put_uint32_t(buf, 0, time_last_baseline_ms);
_mav_put_uint32_t(buf, 4, tow);
_mav_put_int32_t(buf, 8, baseline_a_mm);
_mav_put_int32_t(buf, 12, baseline_b_mm);
_mav_put_int32_t(buf, 16, baseline_c_mm);
_mav_put_uint32_t(buf, 20, accuracy);
_mav_put_int32_t(buf, 24, iar_num_hypotheses);
_mav_put_uint16_t(buf, 28, wn);
_mav_put_uint8_t(buf, 30, rtk_receiver_id);
_mav_put_uint8_t(buf, 31, rtk_health);
_mav_put_uint8_t(buf, 32, rtk_rate);
_mav_put_uint8_t(buf, 33, nsats);
_mav_put_uint8_t(buf, 34, baseline_coords_type);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#else
mavlink_gps2_rtk_t packet;
packet.time_last_baseline_ms = time_last_baseline_ms;
packet.tow = tow;
packet.baseline_a_mm = baseline_a_mm;
packet.baseline_b_mm = baseline_b_mm;
packet.baseline_c_mm = baseline_c_mm;
packet.accuracy = accuracy;
packet.iar_num_hypotheses = iar_num_hypotheses;
packet.wn = wn;
packet.rtk_receiver_id = rtk_receiver_id;
packet.rtk_health = rtk_health;
packet.rtk_rate = rtk_rate;
packet.nsats = nsats;
packet.baseline_coords_type = baseline_coords_type;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS2_RTK;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
}
/**
* @brief Pack a gps2_rtk message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_last_baseline_ms Time since boot of last baseline message received in ms.
* @param rtk_receiver_id Identification of connected RTK receiver.
* @param wn GPS Week Number of last baseline
* @param tow GPS Time of Week of last baseline
* @param rtk_health GPS-specific health report for RTK data.
* @param rtk_rate Rate of baseline messages being received by GPS, in HZ
* @param nsats Current number of sats used for RTK calculation.
* @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
* @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
* @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
* @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
* @param accuracy Current estimate of baseline accuracy.
* @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps2_rtk_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_last_baseline_ms,uint8_t rtk_receiver_id,uint16_t wn,uint32_t tow,uint8_t rtk_health,uint8_t rtk_rate,uint8_t nsats,uint8_t baseline_coords_type,int32_t baseline_a_mm,int32_t baseline_b_mm,int32_t baseline_c_mm,uint32_t accuracy,int32_t iar_num_hypotheses)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS2_RTK_LEN];
_mav_put_uint32_t(buf, 0, time_last_baseline_ms);
_mav_put_uint32_t(buf, 4, tow);
_mav_put_int32_t(buf, 8, baseline_a_mm);
_mav_put_int32_t(buf, 12, baseline_b_mm);
_mav_put_int32_t(buf, 16, baseline_c_mm);
_mav_put_uint32_t(buf, 20, accuracy);
_mav_put_int32_t(buf, 24, iar_num_hypotheses);
_mav_put_uint16_t(buf, 28, wn);
_mav_put_uint8_t(buf, 30, rtk_receiver_id);
_mav_put_uint8_t(buf, 31, rtk_health);
_mav_put_uint8_t(buf, 32, rtk_rate);
_mav_put_uint8_t(buf, 33, nsats);
_mav_put_uint8_t(buf, 34, baseline_coords_type);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#else
mavlink_gps2_rtk_t packet;
packet.time_last_baseline_ms = time_last_baseline_ms;
packet.tow = tow;
packet.baseline_a_mm = baseline_a_mm;
packet.baseline_b_mm = baseline_b_mm;
packet.baseline_c_mm = baseline_c_mm;
packet.accuracy = accuracy;
packet.iar_num_hypotheses = iar_num_hypotheses;
packet.wn = wn;
packet.rtk_receiver_id = rtk_receiver_id;
packet.rtk_health = rtk_health;
packet.rtk_rate = rtk_rate;
packet.nsats = nsats;
packet.baseline_coords_type = baseline_coords_type;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS2_RTK;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
}
/**
* @brief Encode a gps2_rtk struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param gps2_rtk C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps2_rtk_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps2_rtk_t* gps2_rtk)
{
return mavlink_msg_gps2_rtk_pack(system_id, component_id, msg, gps2_rtk->time_last_baseline_ms, gps2_rtk->rtk_receiver_id, gps2_rtk->wn, gps2_rtk->tow, gps2_rtk->rtk_health, gps2_rtk->rtk_rate, gps2_rtk->nsats, gps2_rtk->baseline_coords_type, gps2_rtk->baseline_a_mm, gps2_rtk->baseline_b_mm, gps2_rtk->baseline_c_mm, gps2_rtk->accuracy, gps2_rtk->iar_num_hypotheses);
}
/**
* @brief Encode a gps2_rtk struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param gps2_rtk C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps2_rtk_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps2_rtk_t* gps2_rtk)
{
return mavlink_msg_gps2_rtk_pack_chan(system_id, component_id, chan, msg, gps2_rtk->time_last_baseline_ms, gps2_rtk->rtk_receiver_id, gps2_rtk->wn, gps2_rtk->tow, gps2_rtk->rtk_health, gps2_rtk->rtk_rate, gps2_rtk->nsats, gps2_rtk->baseline_coords_type, gps2_rtk->baseline_a_mm, gps2_rtk->baseline_b_mm, gps2_rtk->baseline_c_mm, gps2_rtk->accuracy, gps2_rtk->iar_num_hypotheses);
}
/**
* @brief Send a gps2_rtk message
* @param chan MAVLink channel to send the message
*
* @param time_last_baseline_ms Time since boot of last baseline message received in ms.
* @param rtk_receiver_id Identification of connected RTK receiver.
* @param wn GPS Week Number of last baseline
* @param tow GPS Time of Week of last baseline
* @param rtk_health GPS-specific health report for RTK data.
* @param rtk_rate Rate of baseline messages being received by GPS, in HZ
* @param nsats Current number of sats used for RTK calculation.
* @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
* @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
* @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
* @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
* @param accuracy Current estimate of baseline accuracy.
* @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps2_rtk_send(mavlink_channel_t chan, uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS2_RTK_LEN];
_mav_put_uint32_t(buf, 0, time_last_baseline_ms);
_mav_put_uint32_t(buf, 4, tow);
_mav_put_int32_t(buf, 8, baseline_a_mm);
_mav_put_int32_t(buf, 12, baseline_b_mm);
_mav_put_int32_t(buf, 16, baseline_c_mm);
_mav_put_uint32_t(buf, 20, accuracy);
_mav_put_int32_t(buf, 24, iar_num_hypotheses);
_mav_put_uint16_t(buf, 28, wn);
_mav_put_uint8_t(buf, 30, rtk_receiver_id);
_mav_put_uint8_t(buf, 31, rtk_health);
_mav_put_uint8_t(buf, 32, rtk_rate);
_mav_put_uint8_t(buf, 33, nsats);
_mav_put_uint8_t(buf, 34, baseline_coords_type);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
#else
mavlink_gps2_rtk_t packet;
packet.time_last_baseline_ms = time_last_baseline_ms;
packet.tow = tow;
packet.baseline_a_mm = baseline_a_mm;
packet.baseline_b_mm = baseline_b_mm;
packet.baseline_c_mm = baseline_c_mm;
packet.accuracy = accuracy;
packet.iar_num_hypotheses = iar_num_hypotheses;
packet.wn = wn;
packet.rtk_receiver_id = rtk_receiver_id;
packet.rtk_health = rtk_health;
packet.rtk_rate = rtk_rate;
packet.nsats = nsats;
packet.baseline_coords_type = baseline_coords_type;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)&packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GPS2_RTK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_gps2_rtk_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_last_baseline_ms);
_mav_put_uint32_t(buf, 4, tow);
_mav_put_int32_t(buf, 8, baseline_a_mm);
_mav_put_int32_t(buf, 12, baseline_b_mm);
_mav_put_int32_t(buf, 16, baseline_c_mm);
_mav_put_uint32_t(buf, 20, accuracy);
_mav_put_int32_t(buf, 24, iar_num_hypotheses);
_mav_put_uint16_t(buf, 28, wn);
_mav_put_uint8_t(buf, 30, rtk_receiver_id);
_mav_put_uint8_t(buf, 31, rtk_health);
_mav_put_uint8_t(buf, 32, rtk_rate);
_mav_put_uint8_t(buf, 33, nsats);
_mav_put_uint8_t(buf, 34, baseline_coords_type);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, buf, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
#else
mavlink_gps2_rtk_t *packet = (mavlink_gps2_rtk_t *)msgbuf;
packet->time_last_baseline_ms = time_last_baseline_ms;
packet->tow = tow;
packet->baseline_a_mm = baseline_a_mm;
packet->baseline_b_mm = baseline_b_mm;
packet->baseline_c_mm = baseline_c_mm;
packet->accuracy = accuracy;
packet->iar_num_hypotheses = iar_num_hypotheses;
packet->wn = wn;
packet->rtk_receiver_id = rtk_receiver_id;
packet->rtk_health = rtk_health;
packet->rtk_rate = rtk_rate;
packet->nsats = nsats;
packet->baseline_coords_type = baseline_coords_type;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)packet, MAVLINK_MSG_ID_GPS2_RTK_LEN, MAVLINK_MSG_ID_GPS2_RTK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS2_RTK, (const char *)packet, MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GPS2_RTK UNPACKING
/**
* @brief Get field time_last_baseline_ms from gps2_rtk message
*
* @return Time since boot of last baseline message received in ms.
*/
static inline uint32_t mavlink_msg_gps2_rtk_get_time_last_baseline_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field rtk_receiver_id from gps2_rtk message
*
* @return Identification of connected RTK receiver.
*/
static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_receiver_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 30);
}
/**
* @brief Get field wn from gps2_rtk message
*
* @return GPS Week Number of last baseline
*/
static inline uint16_t mavlink_msg_gps2_rtk_get_wn(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 28);
}
/**
* @brief Get field tow from gps2_rtk message
*
* @return GPS Time of Week of last baseline
*/
static inline uint32_t mavlink_msg_gps2_rtk_get_tow(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 4);
}
/**
* @brief Get field rtk_health from gps2_rtk message
*
* @return GPS-specific health report for RTK data.
*/
static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_health(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 31);
}
/**
* @brief Get field rtk_rate from gps2_rtk message
*
* @return Rate of baseline messages being received by GPS, in HZ
*/
static inline uint8_t mavlink_msg_gps2_rtk_get_rtk_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 32);
}
/**
* @brief Get field nsats from gps2_rtk message
*
* @return Current number of sats used for RTK calculation.
*/
static inline uint8_t mavlink_msg_gps2_rtk_get_nsats(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 33);
}
/**
* @brief Get field baseline_coords_type from gps2_rtk message
*
* @return Coordinate system of baseline. 0 == ECEF, 1 == NED
*/
static inline uint8_t mavlink_msg_gps2_rtk_get_baseline_coords_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 34);
}
/**
* @brief Get field baseline_a_mm from gps2_rtk message
*
* @return Current baseline in ECEF x or NED north component in mm.
*/
static inline int32_t mavlink_msg_gps2_rtk_get_baseline_a_mm(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Get field baseline_b_mm from gps2_rtk message
*
* @return Current baseline in ECEF y or NED east component in mm.
*/
static inline int32_t mavlink_msg_gps2_rtk_get_baseline_b_mm(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 12);
}
/**
* @brief Get field baseline_c_mm from gps2_rtk message
*
* @return Current baseline in ECEF z or NED down component in mm.
*/
static inline int32_t mavlink_msg_gps2_rtk_get_baseline_c_mm(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field accuracy from gps2_rtk message
*
* @return Current estimate of baseline accuracy.
*/
static inline uint32_t mavlink_msg_gps2_rtk_get_accuracy(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 20);
}
/**
* @brief Get field iar_num_hypotheses from gps2_rtk message
*
* @return Current number of integer ambiguity hypotheses.
*/
static inline int32_t mavlink_msg_gps2_rtk_get_iar_num_hypotheses(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 24);
}
/**
* @brief Decode a gps2_rtk message into a struct
*
* @param msg The message to decode
* @param gps2_rtk C-struct to decode the message contents into
*/
static inline void mavlink_msg_gps2_rtk_decode(const mavlink_message_t* msg, mavlink_gps2_rtk_t* gps2_rtk)
{
#if MAVLINK_NEED_BYTE_SWAP
gps2_rtk->time_last_baseline_ms = mavlink_msg_gps2_rtk_get_time_last_baseline_ms(msg);
gps2_rtk->tow = mavlink_msg_gps2_rtk_get_tow(msg);
gps2_rtk->baseline_a_mm = mavlink_msg_gps2_rtk_get_baseline_a_mm(msg);
gps2_rtk->baseline_b_mm = mavlink_msg_gps2_rtk_get_baseline_b_mm(msg);
gps2_rtk->baseline_c_mm = mavlink_msg_gps2_rtk_get_baseline_c_mm(msg);
gps2_rtk->accuracy = mavlink_msg_gps2_rtk_get_accuracy(msg);
gps2_rtk->iar_num_hypotheses = mavlink_msg_gps2_rtk_get_iar_num_hypotheses(msg);
gps2_rtk->wn = mavlink_msg_gps2_rtk_get_wn(msg);
gps2_rtk->rtk_receiver_id = mavlink_msg_gps2_rtk_get_rtk_receiver_id(msg);
gps2_rtk->rtk_health = mavlink_msg_gps2_rtk_get_rtk_health(msg);
gps2_rtk->rtk_rate = mavlink_msg_gps2_rtk_get_rtk_rate(msg);
gps2_rtk->nsats = mavlink_msg_gps2_rtk_get_nsats(msg);
gps2_rtk->baseline_coords_type = mavlink_msg_gps2_rtk_get_baseline_coords_type(msg);
#else
memcpy(gps2_rtk, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS2_RTK_LEN);
#endif
}

View File

@ -0,0 +1,257 @@
// MESSAGE GPS_GLOBAL_ORIGIN PACKING
#define MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN 49
typedef struct __mavlink_gps_global_origin_t
{
int32_t latitude; /*< Latitude (WGS84), in degrees * 1E7*/
int32_t longitude; /*< Longitude (WGS84), in degrees * 1E7*/
int32_t altitude; /*< Altitude (AMSL), in meters * 1000 (positive for up)*/
} mavlink_gps_global_origin_t;
#define MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN 12
#define MAVLINK_MSG_ID_49_LEN 12
#define MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC 39
#define MAVLINK_MSG_ID_49_CRC 39
#define MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN { \
"GPS_GLOBAL_ORIGIN", \
3, \
{ { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_gps_global_origin_t, latitude) }, \
{ "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_gps_global_origin_t, longitude) }, \
{ "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_global_origin_t, altitude) }, \
} \
}
/**
* @brief Pack a gps_global_origin message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param latitude Latitude (WGS84), in degrees * 1E7
* @param longitude Longitude (WGS84), in degrees * 1E7
* @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_global_origin_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
int32_t latitude, int32_t longitude, int32_t altitude)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN];
_mav_put_int32_t(buf, 0, latitude);
_mav_put_int32_t(buf, 4, longitude);
_mav_put_int32_t(buf, 8, altitude);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#else
mavlink_gps_global_origin_t packet;
packet.latitude = latitude;
packet.longitude = longitude;
packet.altitude = altitude;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
}
/**
* @brief Pack a gps_global_origin message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param latitude Latitude (WGS84), in degrees * 1E7
* @param longitude Longitude (WGS84), in degrees * 1E7
* @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_global_origin_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
int32_t latitude,int32_t longitude,int32_t altitude)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN];
_mav_put_int32_t(buf, 0, latitude);
_mav_put_int32_t(buf, 4, longitude);
_mav_put_int32_t(buf, 8, altitude);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#else
mavlink_gps_global_origin_t packet;
packet.latitude = latitude;
packet.longitude = longitude;
packet.altitude = altitude;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
}
/**
* @brief Encode a gps_global_origin struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param gps_global_origin C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_global_origin_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_global_origin_t* gps_global_origin)
{
return mavlink_msg_gps_global_origin_pack(system_id, component_id, msg, gps_global_origin->latitude, gps_global_origin->longitude, gps_global_origin->altitude);
}
/**
* @brief Encode a gps_global_origin struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param gps_global_origin C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_global_origin_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_global_origin_t* gps_global_origin)
{
return mavlink_msg_gps_global_origin_pack_chan(system_id, component_id, chan, msg, gps_global_origin->latitude, gps_global_origin->longitude, gps_global_origin->altitude);
}
/**
* @brief Send a gps_global_origin message
* @param chan MAVLink channel to send the message
*
* @param latitude Latitude (WGS84), in degrees * 1E7
* @param longitude Longitude (WGS84), in degrees * 1E7
* @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps_global_origin_send(mavlink_channel_t chan, int32_t latitude, int32_t longitude, int32_t altitude)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN];
_mav_put_int32_t(buf, 0, latitude);
_mav_put_int32_t(buf, 4, longitude);
_mav_put_int32_t(buf, 8, altitude);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
#else
mavlink_gps_global_origin_t packet;
packet.latitude = latitude;
packet.longitude = longitude;
packet.altitude = altitude;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, (const char *)&packet, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, (const char *)&packet, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_gps_global_origin_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int32_t latitude, int32_t longitude, int32_t altitude)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_int32_t(buf, 0, latitude);
_mav_put_int32_t(buf, 4, longitude);
_mav_put_int32_t(buf, 8, altitude);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
#else
mavlink_gps_global_origin_t *packet = (mavlink_gps_global_origin_t *)msgbuf;
packet->latitude = latitude;
packet->longitude = longitude;
packet->altitude = altitude;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, (const char *)packet, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN, (const char *)packet, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GPS_GLOBAL_ORIGIN UNPACKING
/**
* @brief Get field latitude from gps_global_origin message
*
* @return Latitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_gps_global_origin_get_latitude(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 0);
}
/**
* @brief Get field longitude from gps_global_origin message
*
* @return Longitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_gps_global_origin_get_longitude(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 4);
}
/**
* @brief Get field altitude from gps_global_origin message
*
* @return Altitude (AMSL), in meters * 1000 (positive for up)
*/
static inline int32_t mavlink_msg_gps_global_origin_get_altitude(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Decode a gps_global_origin message into a struct
*
* @param msg The message to decode
* @param gps_global_origin C-struct to decode the message contents into
*/
static inline void mavlink_msg_gps_global_origin_decode(const mavlink_message_t* msg, mavlink_gps_global_origin_t* gps_global_origin)
{
#if MAVLINK_NEED_BYTE_SWAP
gps_global_origin->latitude = mavlink_msg_gps_global_origin_get_latitude(msg);
gps_global_origin->longitude = mavlink_msg_gps_global_origin_get_longitude(msg);
gps_global_origin->altitude = mavlink_msg_gps_global_origin_get_altitude(msg);
#else
memcpy(gps_global_origin, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN);
#endif
}

View File

@ -0,0 +1,273 @@
// MESSAGE GPS_INJECT_DATA PACKING
#define MAVLINK_MSG_ID_GPS_INJECT_DATA 123
typedef struct __mavlink_gps_inject_data_t
{
uint8_t target_system; /*< System ID*/
uint8_t target_component; /*< Component ID*/
uint8_t len; /*< data length*/
uint8_t data[110]; /*< raw data (110 is enough for 12 satellites of RTCMv2)*/
} mavlink_gps_inject_data_t;
#define MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN 113
#define MAVLINK_MSG_ID_123_LEN 113
#define MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC 250
#define MAVLINK_MSG_ID_123_CRC 250
#define MAVLINK_MSG_GPS_INJECT_DATA_FIELD_DATA_LEN 110
#define MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA { \
"GPS_INJECT_DATA", \
4, \
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_inject_data_t, target_system) }, \
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gps_inject_data_t, target_component) }, \
{ "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gps_inject_data_t, len) }, \
{ "data", NULL, MAVLINK_TYPE_UINT8_T, 110, 3, offsetof(mavlink_gps_inject_data_t, data) }, \
} \
}
/**
* @brief Pack a gps_inject_data message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param target_system System ID
* @param target_component Component ID
* @param len data length
* @param data raw data (110 is enough for 12 satellites of RTCMv2)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_inject_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t target_system, uint8_t target_component, uint8_t len, const uint8_t *data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, target_component);
_mav_put_uint8_t(buf, 2, len);
_mav_put_uint8_t_array(buf, 3, data, 110);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#else
mavlink_gps_inject_data_t packet;
packet.target_system = target_system;
packet.target_component = target_component;
packet.len = len;
mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
}
/**
* @brief Pack a gps_inject_data message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System ID
* @param target_component Component ID
* @param len data length
* @param data raw data (110 is enough for 12 satellites of RTCMv2)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_inject_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t target_component,uint8_t len,const uint8_t *data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, target_component);
_mav_put_uint8_t(buf, 2, len);
_mav_put_uint8_t_array(buf, 3, data, 110);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#else
mavlink_gps_inject_data_t packet;
packet.target_system = target_system;
packet.target_component = target_component;
packet.len = len;
mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
}
/**
* @brief Encode a gps_inject_data struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param gps_inject_data C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_inject_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_inject_data_t* gps_inject_data)
{
return mavlink_msg_gps_inject_data_pack(system_id, component_id, msg, gps_inject_data->target_system, gps_inject_data->target_component, gps_inject_data->len, gps_inject_data->data);
}
/**
* @brief Encode a gps_inject_data struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param gps_inject_data C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_inject_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_inject_data_t* gps_inject_data)
{
return mavlink_msg_gps_inject_data_pack_chan(system_id, component_id, chan, msg, gps_inject_data->target_system, gps_inject_data->target_component, gps_inject_data->len, gps_inject_data->data);
}
/**
* @brief Send a gps_inject_data message
* @param chan MAVLink channel to send the message
*
* @param target_system System ID
* @param target_component Component ID
* @param len data length
* @param data raw data (110 is enough for 12 satellites of RTCMv2)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps_inject_data_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t len, const uint8_t *data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, target_component);
_mav_put_uint8_t(buf, 2, len);
_mav_put_uint8_t_array(buf, 3, data, 110);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
#else
mavlink_gps_inject_data_t packet;
packet.target_system = target_system;
packet.target_component = target_component;
packet.len = len;
mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)&packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)&packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_gps_inject_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t len, const uint8_t *data)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, target_component);
_mav_put_uint8_t(buf, 2, len);
_mav_put_uint8_t_array(buf, 3, data, 110);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
#else
mavlink_gps_inject_data_t *packet = (mavlink_gps_inject_data_t *)msgbuf;
packet->target_system = target_system;
packet->target_component = target_component;
packet->len = len;
mav_array_memcpy(packet->data, data, sizeof(uint8_t)*110);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GPS_INJECT_DATA UNPACKING
/**
* @brief Get field target_system from gps_inject_data message
*
* @return System ID
*/
static inline uint8_t mavlink_msg_gps_inject_data_get_target_system(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 0);
}
/**
* @brief Get field target_component from gps_inject_data message
*
* @return Component ID
*/
static inline uint8_t mavlink_msg_gps_inject_data_get_target_component(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 1);
}
/**
* @brief Get field len from gps_inject_data message
*
* @return data length
*/
static inline uint8_t mavlink_msg_gps_inject_data_get_len(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 2);
}
/**
* @brief Get field data from gps_inject_data message
*
* @return raw data (110 is enough for 12 satellites of RTCMv2)
*/
static inline uint16_t mavlink_msg_gps_inject_data_get_data(const mavlink_message_t* msg, uint8_t *data)
{
return _MAV_RETURN_uint8_t_array(msg, data, 110, 3);
}
/**
* @brief Decode a gps_inject_data message into a struct
*
* @param msg The message to decode
* @param gps_inject_data C-struct to decode the message contents into
*/
static inline void mavlink_msg_gps_inject_data_decode(const mavlink_message_t* msg, mavlink_gps_inject_data_t* gps_inject_data)
{
#if MAVLINK_NEED_BYTE_SWAP
gps_inject_data->target_system = mavlink_msg_gps_inject_data_get_target_system(msg);
gps_inject_data->target_component = mavlink_msg_gps_inject_data_get_target_component(msg);
gps_inject_data->len = mavlink_msg_gps_inject_data_get_len(msg);
mavlink_msg_gps_inject_data_get_data(msg, gps_inject_data->data);
#else
memcpy(gps_inject_data, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
#endif
}

View File

@ -0,0 +1,425 @@
// MESSAGE GPS_RAW_INT PACKING
#define MAVLINK_MSG_ID_GPS_RAW_INT 24
typedef struct __mavlink_gps_raw_int_t
{
uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/
int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/
int32_t alt; /*< 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.*/
uint16_t eph; /*< GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX*/
uint16_t epv; /*< GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX*/
uint16_t vel; /*< GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX*/
uint16_t cog; /*< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
uint8_t fix_type; /*< 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.*/
uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/
} mavlink_gps_raw_int_t;
#define MAVLINK_MSG_ID_GPS_RAW_INT_LEN 30
#define MAVLINK_MSG_ID_24_LEN 30
#define MAVLINK_MSG_ID_GPS_RAW_INT_CRC 24
#define MAVLINK_MSG_ID_24_CRC 24
#define MAVLINK_MESSAGE_INFO_GPS_RAW_INT { \
"GPS_RAW_INT", \
10, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_raw_int_t, time_usec) }, \
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_raw_int_t, lat) }, \
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_raw_int_t, lon) }, \
{ "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_raw_int_t, alt) }, \
{ "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_gps_raw_int_t, eph) }, \
{ "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_gps_raw_int_t, epv) }, \
{ "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps_raw_int_t, vel) }, \
{ "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps_raw_int_t, cog) }, \
{ "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_gps_raw_int_t, fix_type) }, \
{ "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_gps_raw_int_t, satellites_visible) }, \
} \
}
/**
* @brief Pack a gps_raw_int message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt 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.
* @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX
* @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX
* @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
* @param satellites_visible Number of satellites visible. If unknown, set to 255
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_raw_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint16_t(buf, 20, eph);
_mav_put_uint16_t(buf, 22, epv);
_mav_put_uint16_t(buf, 24, vel);
_mav_put_uint16_t(buf, 26, cog);
_mav_put_uint8_t(buf, 28, fix_type);
_mav_put_uint8_t(buf, 29, satellites_visible);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#else
mavlink_gps_raw_int_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
}
/**
* @brief Pack a gps_raw_int message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt 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.
* @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX
* @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX
* @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
* @param satellites_visible Number of satellites visible. If unknown, set to 255
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_raw_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,uint16_t eph,uint16_t epv,uint16_t vel,uint16_t cog,uint8_t satellites_visible)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint16_t(buf, 20, eph);
_mav_put_uint16_t(buf, 22, epv);
_mav_put_uint16_t(buf, 24, vel);
_mav_put_uint16_t(buf, 26, cog);
_mav_put_uint8_t(buf, 28, fix_type);
_mav_put_uint8_t(buf, 29, satellites_visible);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#else
mavlink_gps_raw_int_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
}
/**
* @brief Encode a gps_raw_int struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param gps_raw_int C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_raw_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
{
return mavlink_msg_gps_raw_int_pack(system_id, component_id, msg, gps_raw_int->time_usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->vel, gps_raw_int->cog, gps_raw_int->satellites_visible);
}
/**
* @brief Encode a gps_raw_int struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param gps_raw_int C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_raw_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
{
return mavlink_msg_gps_raw_int_pack_chan(system_id, component_id, chan, msg, gps_raw_int->time_usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->vel, gps_raw_int->cog, gps_raw_int->satellites_visible);
}
/**
* @brief Send a gps_raw_int message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt 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.
* @param eph GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX
* @param epv GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX
* @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
* @param satellites_visible Number of satellites visible. If unknown, set to 255
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps_raw_int_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint16_t(buf, 20, eph);
_mav_put_uint16_t(buf, 22, epv);
_mav_put_uint16_t(buf, 24, vel);
_mav_put_uint16_t(buf, 26, cog);
_mav_put_uint8_t(buf, 28, fix_type);
_mav_put_uint8_t(buf, 29, satellites_visible);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
#else
mavlink_gps_raw_int_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)&packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)&packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GPS_RAW_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_gps_raw_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, uint16_t cog, uint8_t satellites_visible)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint16_t(buf, 20, eph);
_mav_put_uint16_t(buf, 22, epv);
_mav_put_uint16_t(buf, 24, vel);
_mav_put_uint16_t(buf, 26, cog);
_mav_put_uint8_t(buf, 28, fix_type);
_mav_put_uint8_t(buf, 29, satellites_visible);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
#else
mavlink_gps_raw_int_t *packet = (mavlink_gps_raw_int_t *)msgbuf;
packet->time_usec = time_usec;
packet->lat = lat;
packet->lon = lon;
packet->alt = alt;
packet->eph = eph;
packet->epv = epv;
packet->vel = vel;
packet->cog = cog;
packet->fix_type = fix_type;
packet->satellites_visible = satellites_visible;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GPS_RAW_INT UNPACKING
/**
* @brief Get field time_usec from gps_raw_int message
*
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
*/
static inline uint64_t mavlink_msg_gps_raw_int_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field fix_type from gps_raw_int message
*
* @return 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.
*/
static inline uint8_t mavlink_msg_gps_raw_int_get_fix_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 28);
}
/**
* @brief Get field lat from gps_raw_int message
*
* @return Latitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_gps_raw_int_get_lat(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Get field lon from gps_raw_int message
*
* @return Longitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_gps_raw_int_get_lon(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 12);
}
/**
* @brief Get field alt from gps_raw_int message
*
* @return 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.
*/
static inline int32_t mavlink_msg_gps_raw_int_get_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field eph from gps_raw_int message
*
* @return GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_gps_raw_int_get_eph(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 20);
}
/**
* @brief Get field epv from gps_raw_int message
*
* @return GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_gps_raw_int_get_epv(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 22);
}
/**
* @brief Get field vel from gps_raw_int message
*
* @return GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_gps_raw_int_get_vel(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 24);
}
/**
* @brief Get field cog from gps_raw_int message
*
* @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
*/
static inline uint16_t mavlink_msg_gps_raw_int_get_cog(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 26);
}
/**
* @brief Get field satellites_visible from gps_raw_int message
*
* @return Number of satellites visible. If unknown, set to 255
*/
static inline uint8_t mavlink_msg_gps_raw_int_get_satellites_visible(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 29);
}
/**
* @brief Decode a gps_raw_int message into a struct
*
* @param msg The message to decode
* @param gps_raw_int C-struct to decode the message contents into
*/
static inline void mavlink_msg_gps_raw_int_decode(const mavlink_message_t* msg, mavlink_gps_raw_int_t* gps_raw_int)
{
#if MAVLINK_NEED_BYTE_SWAP
gps_raw_int->time_usec = mavlink_msg_gps_raw_int_get_time_usec(msg);
gps_raw_int->lat = mavlink_msg_gps_raw_int_get_lat(msg);
gps_raw_int->lon = mavlink_msg_gps_raw_int_get_lon(msg);
gps_raw_int->alt = mavlink_msg_gps_raw_int_get_alt(msg);
gps_raw_int->eph = mavlink_msg_gps_raw_int_get_eph(msg);
gps_raw_int->epv = mavlink_msg_gps_raw_int_get_epv(msg);
gps_raw_int->vel = mavlink_msg_gps_raw_int_get_vel(msg);
gps_raw_int->cog = mavlink_msg_gps_raw_int_get_cog(msg);
gps_raw_int->fix_type = mavlink_msg_gps_raw_int_get_fix_type(msg);
gps_raw_int->satellites_visible = mavlink_msg_gps_raw_int_get_satellites_visible(msg);
#else
memcpy(gps_raw_int, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
#endif
}

View File

@ -0,0 +1,497 @@
// MESSAGE GPS_RTK PACKING
#define MAVLINK_MSG_ID_GPS_RTK 127
typedef struct __mavlink_gps_rtk_t
{
uint32_t time_last_baseline_ms; /*< Time since boot of last baseline message received in ms.*/
uint32_t tow; /*< GPS Time of Week of last baseline*/
int32_t baseline_a_mm; /*< Current baseline in ECEF x or NED north component in mm.*/
int32_t baseline_b_mm; /*< Current baseline in ECEF y or NED east component in mm.*/
int32_t baseline_c_mm; /*< Current baseline in ECEF z or NED down component in mm.*/
uint32_t accuracy; /*< Current estimate of baseline accuracy.*/
int32_t iar_num_hypotheses; /*< Current number of integer ambiguity hypotheses.*/
uint16_t wn; /*< GPS Week Number of last baseline*/
uint8_t rtk_receiver_id; /*< Identification of connected RTK receiver.*/
uint8_t rtk_health; /*< GPS-specific health report for RTK data.*/
uint8_t rtk_rate; /*< Rate of baseline messages being received by GPS, in HZ*/
uint8_t nsats; /*< Current number of sats used for RTK calculation.*/
uint8_t baseline_coords_type; /*< Coordinate system of baseline. 0 == ECEF, 1 == NED*/
} mavlink_gps_rtk_t;
#define MAVLINK_MSG_ID_GPS_RTK_LEN 35
#define MAVLINK_MSG_ID_127_LEN 35
#define MAVLINK_MSG_ID_GPS_RTK_CRC 25
#define MAVLINK_MSG_ID_127_CRC 25
#define MAVLINK_MESSAGE_INFO_GPS_RTK { \
"GPS_RTK", \
13, \
{ { "time_last_baseline_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gps_rtk_t, time_last_baseline_ms) }, \
{ "tow", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gps_rtk_t, tow) }, \
{ "baseline_a_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_rtk_t, baseline_a_mm) }, \
{ "baseline_b_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_rtk_t, baseline_b_mm) }, \
{ "baseline_c_mm", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_rtk_t, baseline_c_mm) }, \
{ "accuracy", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps_rtk_t, accuracy) }, \
{ "iar_num_hypotheses", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_gps_rtk_t, iar_num_hypotheses) }, \
{ "wn", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps_rtk_t, wn) }, \
{ "rtk_receiver_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_gps_rtk_t, rtk_receiver_id) }, \
{ "rtk_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_gps_rtk_t, rtk_health) }, \
{ "rtk_rate", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps_rtk_t, rtk_rate) }, \
{ "nsats", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps_rtk_t, nsats) }, \
{ "baseline_coords_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps_rtk_t, baseline_coords_type) }, \
} \
}
/**
* @brief Pack a gps_rtk message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_last_baseline_ms Time since boot of last baseline message received in ms.
* @param rtk_receiver_id Identification of connected RTK receiver.
* @param wn GPS Week Number of last baseline
* @param tow GPS Time of Week of last baseline
* @param rtk_health GPS-specific health report for RTK data.
* @param rtk_rate Rate of baseline messages being received by GPS, in HZ
* @param nsats Current number of sats used for RTK calculation.
* @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
* @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
* @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
* @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
* @param accuracy Current estimate of baseline accuracy.
* @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_rtk_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_RTK_LEN];
_mav_put_uint32_t(buf, 0, time_last_baseline_ms);
_mav_put_uint32_t(buf, 4, tow);
_mav_put_int32_t(buf, 8, baseline_a_mm);
_mav_put_int32_t(buf, 12, baseline_b_mm);
_mav_put_int32_t(buf, 16, baseline_c_mm);
_mav_put_uint32_t(buf, 20, accuracy);
_mav_put_int32_t(buf, 24, iar_num_hypotheses);
_mav_put_uint16_t(buf, 28, wn);
_mav_put_uint8_t(buf, 30, rtk_receiver_id);
_mav_put_uint8_t(buf, 31, rtk_health);
_mav_put_uint8_t(buf, 32, rtk_rate);
_mav_put_uint8_t(buf, 33, nsats);
_mav_put_uint8_t(buf, 34, baseline_coords_type);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RTK_LEN);
#else
mavlink_gps_rtk_t packet;
packet.time_last_baseline_ms = time_last_baseline_ms;
packet.tow = tow;
packet.baseline_a_mm = baseline_a_mm;
packet.baseline_b_mm = baseline_b_mm;
packet.baseline_c_mm = baseline_c_mm;
packet.accuracy = accuracy;
packet.iar_num_hypotheses = iar_num_hypotheses;
packet.wn = wn;
packet.rtk_receiver_id = rtk_receiver_id;
packet.rtk_health = rtk_health;
packet.rtk_rate = rtk_rate;
packet.nsats = nsats;
packet.baseline_coords_type = baseline_coords_type;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_RTK;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
}
/**
* @brief Pack a gps_rtk message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_last_baseline_ms Time since boot of last baseline message received in ms.
* @param rtk_receiver_id Identification of connected RTK receiver.
* @param wn GPS Week Number of last baseline
* @param tow GPS Time of Week of last baseline
* @param rtk_health GPS-specific health report for RTK data.
* @param rtk_rate Rate of baseline messages being received by GPS, in HZ
* @param nsats Current number of sats used for RTK calculation.
* @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
* @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
* @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
* @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
* @param accuracy Current estimate of baseline accuracy.
* @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_rtk_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t time_last_baseline_ms,uint8_t rtk_receiver_id,uint16_t wn,uint32_t tow,uint8_t rtk_health,uint8_t rtk_rate,uint8_t nsats,uint8_t baseline_coords_type,int32_t baseline_a_mm,int32_t baseline_b_mm,int32_t baseline_c_mm,uint32_t accuracy,int32_t iar_num_hypotheses)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_RTK_LEN];
_mav_put_uint32_t(buf, 0, time_last_baseline_ms);
_mav_put_uint32_t(buf, 4, tow);
_mav_put_int32_t(buf, 8, baseline_a_mm);
_mav_put_int32_t(buf, 12, baseline_b_mm);
_mav_put_int32_t(buf, 16, baseline_c_mm);
_mav_put_uint32_t(buf, 20, accuracy);
_mav_put_int32_t(buf, 24, iar_num_hypotheses);
_mav_put_uint16_t(buf, 28, wn);
_mav_put_uint8_t(buf, 30, rtk_receiver_id);
_mav_put_uint8_t(buf, 31, rtk_health);
_mav_put_uint8_t(buf, 32, rtk_rate);
_mav_put_uint8_t(buf, 33, nsats);
_mav_put_uint8_t(buf, 34, baseline_coords_type);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RTK_LEN);
#else
mavlink_gps_rtk_t packet;
packet.time_last_baseline_ms = time_last_baseline_ms;
packet.tow = tow;
packet.baseline_a_mm = baseline_a_mm;
packet.baseline_b_mm = baseline_b_mm;
packet.baseline_c_mm = baseline_c_mm;
packet.accuracy = accuracy;
packet.iar_num_hypotheses = iar_num_hypotheses;
packet.wn = wn;
packet.rtk_receiver_id = rtk_receiver_id;
packet.rtk_health = rtk_health;
packet.rtk_rate = rtk_rate;
packet.nsats = nsats;
packet.baseline_coords_type = baseline_coords_type;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_RTK;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
}
/**
* @brief Encode a gps_rtk struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param gps_rtk C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_rtk_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_rtk_t* gps_rtk)
{
return mavlink_msg_gps_rtk_pack(system_id, component_id, msg, gps_rtk->time_last_baseline_ms, gps_rtk->rtk_receiver_id, gps_rtk->wn, gps_rtk->tow, gps_rtk->rtk_health, gps_rtk->rtk_rate, gps_rtk->nsats, gps_rtk->baseline_coords_type, gps_rtk->baseline_a_mm, gps_rtk->baseline_b_mm, gps_rtk->baseline_c_mm, gps_rtk->accuracy, gps_rtk->iar_num_hypotheses);
}
/**
* @brief Encode a gps_rtk struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param gps_rtk C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_rtk_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_rtk_t* gps_rtk)
{
return mavlink_msg_gps_rtk_pack_chan(system_id, component_id, chan, msg, gps_rtk->time_last_baseline_ms, gps_rtk->rtk_receiver_id, gps_rtk->wn, gps_rtk->tow, gps_rtk->rtk_health, gps_rtk->rtk_rate, gps_rtk->nsats, gps_rtk->baseline_coords_type, gps_rtk->baseline_a_mm, gps_rtk->baseline_b_mm, gps_rtk->baseline_c_mm, gps_rtk->accuracy, gps_rtk->iar_num_hypotheses);
}
/**
* @brief Send a gps_rtk message
* @param chan MAVLink channel to send the message
*
* @param time_last_baseline_ms Time since boot of last baseline message received in ms.
* @param rtk_receiver_id Identification of connected RTK receiver.
* @param wn GPS Week Number of last baseline
* @param tow GPS Time of Week of last baseline
* @param rtk_health GPS-specific health report for RTK data.
* @param rtk_rate Rate of baseline messages being received by GPS, in HZ
* @param nsats Current number of sats used for RTK calculation.
* @param baseline_coords_type Coordinate system of baseline. 0 == ECEF, 1 == NED
* @param baseline_a_mm Current baseline in ECEF x or NED north component in mm.
* @param baseline_b_mm Current baseline in ECEF y or NED east component in mm.
* @param baseline_c_mm Current baseline in ECEF z or NED down component in mm.
* @param accuracy Current estimate of baseline accuracy.
* @param iar_num_hypotheses Current number of integer ambiguity hypotheses.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps_rtk_send(mavlink_channel_t chan, uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_RTK_LEN];
_mav_put_uint32_t(buf, 0, time_last_baseline_ms);
_mav_put_uint32_t(buf, 4, tow);
_mav_put_int32_t(buf, 8, baseline_a_mm);
_mav_put_int32_t(buf, 12, baseline_b_mm);
_mav_put_int32_t(buf, 16, baseline_c_mm);
_mav_put_uint32_t(buf, 20, accuracy);
_mav_put_int32_t(buf, 24, iar_num_hypotheses);
_mav_put_uint16_t(buf, 28, wn);
_mav_put_uint8_t(buf, 30, rtk_receiver_id);
_mav_put_uint8_t(buf, 31, rtk_health);
_mav_put_uint8_t(buf, 32, rtk_rate);
_mav_put_uint8_t(buf, 33, nsats);
_mav_put_uint8_t(buf, 34, baseline_coords_type);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, buf, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, buf, MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
#else
mavlink_gps_rtk_t packet;
packet.time_last_baseline_ms = time_last_baseline_ms;
packet.tow = tow;
packet.baseline_a_mm = baseline_a_mm;
packet.baseline_b_mm = baseline_b_mm;
packet.baseline_c_mm = baseline_c_mm;
packet.accuracy = accuracy;
packet.iar_num_hypotheses = iar_num_hypotheses;
packet.wn = wn;
packet.rtk_receiver_id = rtk_receiver_id;
packet.rtk_health = rtk_health;
packet.rtk_rate = rtk_rate;
packet.nsats = nsats;
packet.baseline_coords_type = baseline_coords_type;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, (const char *)&packet, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, (const char *)&packet, MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GPS_RTK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_gps_rtk_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_last_baseline_ms, uint8_t rtk_receiver_id, uint16_t wn, uint32_t tow, uint8_t rtk_health, uint8_t rtk_rate, uint8_t nsats, uint8_t baseline_coords_type, int32_t baseline_a_mm, int32_t baseline_b_mm, int32_t baseline_c_mm, uint32_t accuracy, int32_t iar_num_hypotheses)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, time_last_baseline_ms);
_mav_put_uint32_t(buf, 4, tow);
_mav_put_int32_t(buf, 8, baseline_a_mm);
_mav_put_int32_t(buf, 12, baseline_b_mm);
_mav_put_int32_t(buf, 16, baseline_c_mm);
_mav_put_uint32_t(buf, 20, accuracy);
_mav_put_int32_t(buf, 24, iar_num_hypotheses);
_mav_put_uint16_t(buf, 28, wn);
_mav_put_uint8_t(buf, 30, rtk_receiver_id);
_mav_put_uint8_t(buf, 31, rtk_health);
_mav_put_uint8_t(buf, 32, rtk_rate);
_mav_put_uint8_t(buf, 33, nsats);
_mav_put_uint8_t(buf, 34, baseline_coords_type);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, buf, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, buf, MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
#else
mavlink_gps_rtk_t *packet = (mavlink_gps_rtk_t *)msgbuf;
packet->time_last_baseline_ms = time_last_baseline_ms;
packet->tow = tow;
packet->baseline_a_mm = baseline_a_mm;
packet->baseline_b_mm = baseline_b_mm;
packet->baseline_c_mm = baseline_c_mm;
packet->accuracy = accuracy;
packet->iar_num_hypotheses = iar_num_hypotheses;
packet->wn = wn;
packet->rtk_receiver_id = rtk_receiver_id;
packet->rtk_health = rtk_health;
packet->rtk_rate = rtk_rate;
packet->nsats = nsats;
packet->baseline_coords_type = baseline_coords_type;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, (const char *)packet, MAVLINK_MSG_ID_GPS_RTK_LEN, MAVLINK_MSG_ID_GPS_RTK_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTK, (const char *)packet, MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GPS_RTK UNPACKING
/**
* @brief Get field time_last_baseline_ms from gps_rtk message
*
* @return Time since boot of last baseline message received in ms.
*/
static inline uint32_t mavlink_msg_gps_rtk_get_time_last_baseline_ms(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field rtk_receiver_id from gps_rtk message
*
* @return Identification of connected RTK receiver.
*/
static inline uint8_t mavlink_msg_gps_rtk_get_rtk_receiver_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 30);
}
/**
* @brief Get field wn from gps_rtk message
*
* @return GPS Week Number of last baseline
*/
static inline uint16_t mavlink_msg_gps_rtk_get_wn(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 28);
}
/**
* @brief Get field tow from gps_rtk message
*
* @return GPS Time of Week of last baseline
*/
static inline uint32_t mavlink_msg_gps_rtk_get_tow(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 4);
}
/**
* @brief Get field rtk_health from gps_rtk message
*
* @return GPS-specific health report for RTK data.
*/
static inline uint8_t mavlink_msg_gps_rtk_get_rtk_health(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 31);
}
/**
* @brief Get field rtk_rate from gps_rtk message
*
* @return Rate of baseline messages being received by GPS, in HZ
*/
static inline uint8_t mavlink_msg_gps_rtk_get_rtk_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 32);
}
/**
* @brief Get field nsats from gps_rtk message
*
* @return Current number of sats used for RTK calculation.
*/
static inline uint8_t mavlink_msg_gps_rtk_get_nsats(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 33);
}
/**
* @brief Get field baseline_coords_type from gps_rtk message
*
* @return Coordinate system of baseline. 0 == ECEF, 1 == NED
*/
static inline uint8_t mavlink_msg_gps_rtk_get_baseline_coords_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 34);
}
/**
* @brief Get field baseline_a_mm from gps_rtk message
*
* @return Current baseline in ECEF x or NED north component in mm.
*/
static inline int32_t mavlink_msg_gps_rtk_get_baseline_a_mm(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Get field baseline_b_mm from gps_rtk message
*
* @return Current baseline in ECEF y or NED east component in mm.
*/
static inline int32_t mavlink_msg_gps_rtk_get_baseline_b_mm(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 12);
}
/**
* @brief Get field baseline_c_mm from gps_rtk message
*
* @return Current baseline in ECEF z or NED down component in mm.
*/
static inline int32_t mavlink_msg_gps_rtk_get_baseline_c_mm(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field accuracy from gps_rtk message
*
* @return Current estimate of baseline accuracy.
*/
static inline uint32_t mavlink_msg_gps_rtk_get_accuracy(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 20);
}
/**
* @brief Get field iar_num_hypotheses from gps_rtk message
*
* @return Current number of integer ambiguity hypotheses.
*/
static inline int32_t mavlink_msg_gps_rtk_get_iar_num_hypotheses(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 24);
}
/**
* @brief Decode a gps_rtk message into a struct
*
* @param msg The message to decode
* @param gps_rtk C-struct to decode the message contents into
*/
static inline void mavlink_msg_gps_rtk_decode(const mavlink_message_t* msg, mavlink_gps_rtk_t* gps_rtk)
{
#if MAVLINK_NEED_BYTE_SWAP
gps_rtk->time_last_baseline_ms = mavlink_msg_gps_rtk_get_time_last_baseline_ms(msg);
gps_rtk->tow = mavlink_msg_gps_rtk_get_tow(msg);
gps_rtk->baseline_a_mm = mavlink_msg_gps_rtk_get_baseline_a_mm(msg);
gps_rtk->baseline_b_mm = mavlink_msg_gps_rtk_get_baseline_b_mm(msg);
gps_rtk->baseline_c_mm = mavlink_msg_gps_rtk_get_baseline_c_mm(msg);
gps_rtk->accuracy = mavlink_msg_gps_rtk_get_accuracy(msg);
gps_rtk->iar_num_hypotheses = mavlink_msg_gps_rtk_get_iar_num_hypotheses(msg);
gps_rtk->wn = mavlink_msg_gps_rtk_get_wn(msg);
gps_rtk->rtk_receiver_id = mavlink_msg_gps_rtk_get_rtk_receiver_id(msg);
gps_rtk->rtk_health = mavlink_msg_gps_rtk_get_rtk_health(msg);
gps_rtk->rtk_rate = mavlink_msg_gps_rtk_get_rtk_rate(msg);
gps_rtk->nsats = mavlink_msg_gps_rtk_get_nsats(msg);
gps_rtk->baseline_coords_type = mavlink_msg_gps_rtk_get_baseline_coords_type(msg);
#else
memcpy(gps_rtk, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS_RTK_LEN);
#endif
}

View File

@ -0,0 +1,325 @@
// MESSAGE GPS_STATUS PACKING
#define MAVLINK_MSG_ID_GPS_STATUS 25
typedef struct __mavlink_gps_status_t
{
uint8_t satellites_visible; /*< Number of satellites visible*/
uint8_t satellite_prn[20]; /*< Global satellite ID*/
uint8_t satellite_used[20]; /*< 0: Satellite not used, 1: used for localization*/
uint8_t satellite_elevation[20]; /*< Elevation (0: right on top of receiver, 90: on the horizon) of satellite*/
uint8_t satellite_azimuth[20]; /*< Direction of satellite, 0: 0 deg, 255: 360 deg.*/
uint8_t satellite_snr[20]; /*< Signal to noise ratio of satellite*/
} mavlink_gps_status_t;
#define MAVLINK_MSG_ID_GPS_STATUS_LEN 101
#define MAVLINK_MSG_ID_25_LEN 101
#define MAVLINK_MSG_ID_GPS_STATUS_CRC 23
#define MAVLINK_MSG_ID_25_CRC 23
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_PRN_LEN 20
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_USED_LEN 20
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_ELEVATION_LEN 20
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_AZIMUTH_LEN 20
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_SNR_LEN 20
#define MAVLINK_MESSAGE_INFO_GPS_STATUS { \
"GPS_STATUS", \
6, \
{ { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_status_t, satellites_visible) }, \
{ "satellite_prn", NULL, MAVLINK_TYPE_UINT8_T, 20, 1, offsetof(mavlink_gps_status_t, satellite_prn) }, \
{ "satellite_used", NULL, MAVLINK_TYPE_UINT8_T, 20, 21, offsetof(mavlink_gps_status_t, satellite_used) }, \
{ "satellite_elevation", NULL, MAVLINK_TYPE_UINT8_T, 20, 41, offsetof(mavlink_gps_status_t, satellite_elevation) }, \
{ "satellite_azimuth", NULL, MAVLINK_TYPE_UINT8_T, 20, 61, offsetof(mavlink_gps_status_t, satellite_azimuth) }, \
{ "satellite_snr", NULL, MAVLINK_TYPE_UINT8_T, 20, 81, offsetof(mavlink_gps_status_t, satellite_snr) }, \
} \
}
/**
* @brief Pack a gps_status message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param satellites_visible Number of satellites visible
* @param satellite_prn Global satellite ID
* @param satellite_used 0: Satellite not used, 1: used for localization
* @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
* @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
* @param satellite_snr Signal to noise ratio of satellite
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_STATUS_LEN];
_mav_put_uint8_t(buf, 0, satellites_visible);
_mav_put_uint8_t_array(buf, 1, satellite_prn, 20);
_mav_put_uint8_t_array(buf, 21, satellite_used, 20);
_mav_put_uint8_t_array(buf, 41, satellite_elevation, 20);
_mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20);
_mav_put_uint8_t_array(buf, 81, satellite_snr, 20);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#else
mavlink_gps_status_t packet;
packet.satellites_visible = satellites_visible;
mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_STATUS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
}
/**
* @brief Pack a gps_status message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param satellites_visible Number of satellites visible
* @param satellite_prn Global satellite ID
* @param satellite_used 0: Satellite not used, 1: used for localization
* @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
* @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
* @param satellite_snr Signal to noise ratio of satellite
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t satellites_visible,const uint8_t *satellite_prn,const uint8_t *satellite_used,const uint8_t *satellite_elevation,const uint8_t *satellite_azimuth,const uint8_t *satellite_snr)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_STATUS_LEN];
_mav_put_uint8_t(buf, 0, satellites_visible);
_mav_put_uint8_t_array(buf, 1, satellite_prn, 20);
_mav_put_uint8_t_array(buf, 21, satellite_used, 20);
_mav_put_uint8_t_array(buf, 41, satellite_elevation, 20);
_mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20);
_mav_put_uint8_t_array(buf, 81, satellite_snr, 20);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#else
mavlink_gps_status_t packet;
packet.satellites_visible = satellites_visible;
mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_GPS_STATUS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
}
/**
* @brief Encode a gps_status struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param gps_status C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status)
{
return mavlink_msg_gps_status_pack(system_id, component_id, msg, gps_status->satellites_visible, gps_status->satellite_prn, gps_status->satellite_used, gps_status->satellite_elevation, gps_status->satellite_azimuth, gps_status->satellite_snr);
}
/**
* @brief Encode a gps_status struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param gps_status C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_gps_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status)
{
return mavlink_msg_gps_status_pack_chan(system_id, component_id, chan, msg, gps_status->satellites_visible, gps_status->satellite_prn, gps_status->satellite_used, gps_status->satellite_elevation, gps_status->satellite_azimuth, gps_status->satellite_snr);
}
/**
* @brief Send a gps_status message
* @param chan MAVLink channel to send the message
*
* @param satellites_visible Number of satellites visible
* @param satellite_prn Global satellite ID
* @param satellite_used 0: Satellite not used, 1: used for localization
* @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
* @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
* @param satellite_snr Signal to noise ratio of satellite
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_GPS_STATUS_LEN];
_mav_put_uint8_t(buf, 0, satellites_visible);
_mav_put_uint8_t_array(buf, 1, satellite_prn, 20);
_mav_put_uint8_t_array(buf, 21, satellite_used, 20);
_mav_put_uint8_t_array(buf, 41, satellite_elevation, 20);
_mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20);
_mav_put_uint8_t_array(buf, 81, satellite_snr, 20);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, buf, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, buf, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
#else
mavlink_gps_status_t packet;
packet.satellites_visible = satellites_visible;
mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20);
mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_GPS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_gps_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint8_t(buf, 0, satellites_visible);
_mav_put_uint8_t_array(buf, 1, satellite_prn, 20);
_mav_put_uint8_t_array(buf, 21, satellite_used, 20);
_mav_put_uint8_t_array(buf, 41, satellite_elevation, 20);
_mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20);
_mav_put_uint8_t_array(buf, 81, satellite_snr, 20);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, buf, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, buf, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
#else
mavlink_gps_status_t *packet = (mavlink_gps_status_t *)msgbuf;
packet->satellites_visible = satellites_visible;
mav_array_memcpy(packet->satellite_prn, satellite_prn, sizeof(uint8_t)*20);
mav_array_memcpy(packet->satellite_used, satellite_used, sizeof(uint8_t)*20);
mav_array_memcpy(packet->satellite_elevation, satellite_elevation, sizeof(uint8_t)*20);
mav_array_memcpy(packet->satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20);
mav_array_memcpy(packet->satellite_snr, satellite_snr, sizeof(uint8_t)*20);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)packet, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)packet, MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE GPS_STATUS UNPACKING
/**
* @brief Get field satellites_visible from gps_status message
*
* @return Number of satellites visible
*/
static inline uint8_t mavlink_msg_gps_status_get_satellites_visible(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 0);
}
/**
* @brief Get field satellite_prn from gps_status message
*
* @return Global satellite ID
*/
static inline uint16_t mavlink_msg_gps_status_get_satellite_prn(const mavlink_message_t* msg, uint8_t *satellite_prn)
{
return _MAV_RETURN_uint8_t_array(msg, satellite_prn, 20, 1);
}
/**
* @brief Get field satellite_used from gps_status message
*
* @return 0: Satellite not used, 1: used for localization
*/
static inline uint16_t mavlink_msg_gps_status_get_satellite_used(const mavlink_message_t* msg, uint8_t *satellite_used)
{
return _MAV_RETURN_uint8_t_array(msg, satellite_used, 20, 21);
}
/**
* @brief Get field satellite_elevation from gps_status message
*
* @return Elevation (0: right on top of receiver, 90: on the horizon) of satellite
*/
static inline uint16_t mavlink_msg_gps_status_get_satellite_elevation(const mavlink_message_t* msg, uint8_t *satellite_elevation)
{
return _MAV_RETURN_uint8_t_array(msg, satellite_elevation, 20, 41);
}
/**
* @brief Get field satellite_azimuth from gps_status message
*
* @return Direction of satellite, 0: 0 deg, 255: 360 deg.
*/
static inline uint16_t mavlink_msg_gps_status_get_satellite_azimuth(const mavlink_message_t* msg, uint8_t *satellite_azimuth)
{
return _MAV_RETURN_uint8_t_array(msg, satellite_azimuth, 20, 61);
}
/**
* @brief Get field satellite_snr from gps_status message
*
* @return Signal to noise ratio of satellite
*/
static inline uint16_t mavlink_msg_gps_status_get_satellite_snr(const mavlink_message_t* msg, uint8_t *satellite_snr)
{
return _MAV_RETURN_uint8_t_array(msg, satellite_snr, 20, 81);
}
/**
* @brief Decode a gps_status message into a struct
*
* @param msg The message to decode
* @param gps_status C-struct to decode the message contents into
*/
static inline void mavlink_msg_gps_status_decode(const mavlink_message_t* msg, mavlink_gps_status_t* gps_status)
{
#if MAVLINK_NEED_BYTE_SWAP
gps_status->satellites_visible = mavlink_msg_gps_status_get_satellites_visible(msg);
mavlink_msg_gps_status_get_satellite_prn(msg, gps_status->satellite_prn);
mavlink_msg_gps_status_get_satellite_used(msg, gps_status->satellite_used);
mavlink_msg_gps_status_get_satellite_elevation(msg, gps_status->satellite_elevation);
mavlink_msg_gps_status_get_satellite_azimuth(msg, gps_status->satellite_azimuth);
mavlink_msg_gps_status_get_satellite_snr(msg, gps_status->satellite_snr);
#else
memcpy(gps_status, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS_STATUS_LEN);
#endif
}

View File

@ -0,0 +1,326 @@
// MESSAGE HEARTBEAT PACKING
#define MAVLINK_MSG_ID_HEARTBEAT 0
typedef struct __mavlink_heartbeat_t
{
uint32_t custom_mode; /*< A bitfield for use for autopilot-specific flags.*/
uint8_t type; /*< Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)*/
uint8_t autopilot; /*< Autopilot type / class. defined in MAV_AUTOPILOT ENUM*/
uint8_t base_mode; /*< System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h*/
uint8_t system_status; /*< System status flag, see MAV_STATE ENUM*/
uint8_t mavlink_version; /*< MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version*/
} mavlink_heartbeat_t;
#define MAVLINK_MSG_ID_HEARTBEAT_LEN 9
#define MAVLINK_MSG_ID_0_LEN 9
#define MAVLINK_MSG_ID_HEARTBEAT_CRC 50
#define MAVLINK_MSG_ID_0_CRC 50
#define MAVLINK_MESSAGE_INFO_HEARTBEAT { \
"HEARTBEAT", \
6, \
{ { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_heartbeat_t, custom_mode) }, \
{ "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_heartbeat_t, type) }, \
{ "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_heartbeat_t, autopilot) }, \
{ "base_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_heartbeat_t, base_mode) }, \
{ "system_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_heartbeat_t, system_status) }, \
{ "mavlink_version", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_heartbeat_t, mavlink_version) }, \
} \
}
/**
* @brief Pack a heartbeat message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
* @param autopilot Autopilot type / class. defined in MAV_AUTOPILOT ENUM
* @param base_mode System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h
* @param custom_mode A bitfield for use for autopilot-specific flags.
* @param system_status System status flag, see MAV_STATE ENUM
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_heartbeat_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t type, uint8_t autopilot, uint8_t base_mode, uint32_t custom_mode, uint8_t system_status)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HEARTBEAT_LEN];
_mav_put_uint32_t(buf, 0, custom_mode);
_mav_put_uint8_t(buf, 4, type);
_mav_put_uint8_t(buf, 5, autopilot);
_mav_put_uint8_t(buf, 6, base_mode);
_mav_put_uint8_t(buf, 7, system_status);
_mav_put_uint8_t(buf, 8, 3);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#else
mavlink_heartbeat_t packet;
packet.custom_mode = custom_mode;
packet.type = type;
packet.autopilot = autopilot;
packet.base_mode = base_mode;
packet.system_status = system_status;
packet.mavlink_version = 3;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
}
/**
* @brief Pack a heartbeat message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
* @param autopilot Autopilot type / class. defined in MAV_AUTOPILOT ENUM
* @param base_mode System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h
* @param custom_mode A bitfield for use for autopilot-specific flags.
* @param system_status System status flag, see MAV_STATE ENUM
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_heartbeat_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t type,uint8_t autopilot,uint8_t base_mode,uint32_t custom_mode,uint8_t system_status)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HEARTBEAT_LEN];
_mav_put_uint32_t(buf, 0, custom_mode);
_mav_put_uint8_t(buf, 4, type);
_mav_put_uint8_t(buf, 5, autopilot);
_mav_put_uint8_t(buf, 6, base_mode);
_mav_put_uint8_t(buf, 7, system_status);
_mav_put_uint8_t(buf, 8, 3);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#else
mavlink_heartbeat_t packet;
packet.custom_mode = custom_mode;
packet.type = type;
packet.autopilot = autopilot;
packet.base_mode = base_mode;
packet.system_status = system_status;
packet.mavlink_version = 3;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
}
/**
* @brief Encode a heartbeat struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param heartbeat C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_heartbeat_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_heartbeat_t* heartbeat)
{
return mavlink_msg_heartbeat_pack(system_id, component_id, msg, heartbeat->type, heartbeat->autopilot, heartbeat->base_mode, heartbeat->custom_mode, heartbeat->system_status);
}
/**
* @brief Encode a heartbeat struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param heartbeat C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_heartbeat_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_heartbeat_t* heartbeat)
{
return mavlink_msg_heartbeat_pack_chan(system_id, component_id, chan, msg, heartbeat->type, heartbeat->autopilot, heartbeat->base_mode, heartbeat->custom_mode, heartbeat->system_status);
}
/**
* @brief Send a heartbeat message
* @param chan MAVLink channel to send the message
*
* @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
* @param autopilot Autopilot type / class. defined in MAV_AUTOPILOT ENUM
* @param base_mode System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h
* @param custom_mode A bitfield for use for autopilot-specific flags.
* @param system_status System status flag, see MAV_STATE ENUM
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_heartbeat_send(mavlink_channel_t chan, uint8_t type, uint8_t autopilot, uint8_t base_mode, uint32_t custom_mode, uint8_t system_status)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HEARTBEAT_LEN];
_mav_put_uint32_t(buf, 0, custom_mode);
_mav_put_uint8_t(buf, 4, type);
_mav_put_uint8_t(buf, 5, autopilot);
_mav_put_uint8_t(buf, 6, base_mode);
_mav_put_uint8_t(buf, 7, system_status);
_mav_put_uint8_t(buf, 8, 3);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, buf, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, buf, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
#else
mavlink_heartbeat_t packet;
packet.custom_mode = custom_mode;
packet.type = type;
packet.autopilot = autopilot;
packet.base_mode = base_mode;
packet.system_status = system_status;
packet.mavlink_version = 3;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, (const char *)&packet, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, (const char *)&packet, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_HEARTBEAT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_heartbeat_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, uint8_t autopilot, uint8_t base_mode, uint32_t custom_mode, uint8_t system_status)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint32_t(buf, 0, custom_mode);
_mav_put_uint8_t(buf, 4, type);
_mav_put_uint8_t(buf, 5, autopilot);
_mav_put_uint8_t(buf, 6, base_mode);
_mav_put_uint8_t(buf, 7, system_status);
_mav_put_uint8_t(buf, 8, 3);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, buf, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, buf, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
#else
mavlink_heartbeat_t *packet = (mavlink_heartbeat_t *)msgbuf;
packet->custom_mode = custom_mode;
packet->type = type;
packet->autopilot = autopilot;
packet->base_mode = base_mode;
packet->system_status = system_status;
packet->mavlink_version = 3;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, (const char *)packet, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, (const char *)packet, MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE HEARTBEAT UNPACKING
/**
* @brief Get field type from heartbeat message
*
* @return Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
*/
static inline uint8_t mavlink_msg_heartbeat_get_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 4);
}
/**
* @brief Get field autopilot from heartbeat message
*
* @return Autopilot type / class. defined in MAV_AUTOPILOT ENUM
*/
static inline uint8_t mavlink_msg_heartbeat_get_autopilot(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 5);
}
/**
* @brief Get field base_mode from heartbeat message
*
* @return System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h
*/
static inline uint8_t mavlink_msg_heartbeat_get_base_mode(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 6);
}
/**
* @brief Get field custom_mode from heartbeat message
*
* @return A bitfield for use for autopilot-specific flags.
*/
static inline uint32_t mavlink_msg_heartbeat_get_custom_mode(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field system_status from heartbeat message
*
* @return System status flag, see MAV_STATE ENUM
*/
static inline uint8_t mavlink_msg_heartbeat_get_system_status(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 7);
}
/**
* @brief Get field mavlink_version from heartbeat message
*
* @return MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version
*/
static inline uint8_t mavlink_msg_heartbeat_get_mavlink_version(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 8);
}
/**
* @brief Decode a heartbeat message into a struct
*
* @param msg The message to decode
* @param heartbeat C-struct to decode the message contents into
*/
static inline void mavlink_msg_heartbeat_decode(const mavlink_message_t* msg, mavlink_heartbeat_t* heartbeat)
{
#if MAVLINK_NEED_BYTE_SWAP
heartbeat->custom_mode = mavlink_msg_heartbeat_get_custom_mode(msg);
heartbeat->type = mavlink_msg_heartbeat_get_type(msg);
heartbeat->autopilot = mavlink_msg_heartbeat_get_autopilot(msg);
heartbeat->base_mode = mavlink_msg_heartbeat_get_base_mode(msg);
heartbeat->system_status = mavlink_msg_heartbeat_get_system_status(msg);
heartbeat->mavlink_version = mavlink_msg_heartbeat_get_mavlink_version(msg);
#else
memcpy(heartbeat, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HEARTBEAT_LEN);
#endif
}

View File

@ -0,0 +1,545 @@
// MESSAGE HIGHRES_IMU PACKING
#define MAVLINK_MSG_ID_HIGHRES_IMU 105
typedef struct __mavlink_highres_imu_t
{
uint64_t time_usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
float xacc; /*< X acceleration (m/s^2)*/
float yacc; /*< Y acceleration (m/s^2)*/
float zacc; /*< Z acceleration (m/s^2)*/
float xgyro; /*< Angular speed around X axis (rad / sec)*/
float ygyro; /*< Angular speed around Y axis (rad / sec)*/
float zgyro; /*< Angular speed around Z axis (rad / sec)*/
float xmag; /*< X Magnetic field (Gauss)*/
float ymag; /*< Y Magnetic field (Gauss)*/
float zmag; /*< Z Magnetic field (Gauss)*/
float abs_pressure; /*< Absolute pressure in millibar*/
float diff_pressure; /*< Differential pressure in millibar*/
float pressure_alt; /*< Altitude calculated from pressure*/
float temperature; /*< Temperature in degrees celsius*/
uint16_t fields_updated; /*< Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature*/
} mavlink_highres_imu_t;
#define MAVLINK_MSG_ID_HIGHRES_IMU_LEN 62
#define MAVLINK_MSG_ID_105_LEN 62
#define MAVLINK_MSG_ID_HIGHRES_IMU_CRC 93
#define MAVLINK_MSG_ID_105_CRC 93
#define MAVLINK_MESSAGE_INFO_HIGHRES_IMU { \
"HIGHRES_IMU", \
15, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) }, \
{ "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) }, \
{ "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) }, \
{ "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) }, \
{ "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) }, \
{ "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) }, \
{ "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) }, \
{ "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) }, \
{ "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) }, \
{ "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) }, \
{ "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) }, \
{ "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) }, \
{ "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) }, \
{ "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) }, \
{ "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) }, \
} \
}
/**
* @brief Pack a highres_imu message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param xacc X acceleration (m/s^2)
* @param yacc Y acceleration (m/s^2)
* @param zacc Z acceleration (m/s^2)
* @param xgyro Angular speed around X axis (rad / sec)
* @param ygyro Angular speed around Y axis (rad / sec)
* @param zgyro Angular speed around Z axis (rad / sec)
* @param xmag X Magnetic field (Gauss)
* @param ymag Y Magnetic field (Gauss)
* @param zmag Z Magnetic field (Gauss)
* @param abs_pressure Absolute pressure in millibar
* @param diff_pressure Differential pressure in millibar
* @param pressure_alt Altitude calculated from pressure
* @param temperature Temperature in degrees celsius
* @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, xacc);
_mav_put_float(buf, 12, yacc);
_mav_put_float(buf, 16, zacc);
_mav_put_float(buf, 20, xgyro);
_mav_put_float(buf, 24, ygyro);
_mav_put_float(buf, 28, zgyro);
_mav_put_float(buf, 32, xmag);
_mav_put_float(buf, 36, ymag);
_mav_put_float(buf, 40, zmag);
_mav_put_float(buf, 44, abs_pressure);
_mav_put_float(buf, 48, diff_pressure);
_mav_put_float(buf, 52, pressure_alt);
_mav_put_float(buf, 56, temperature);
_mav_put_uint16_t(buf, 60, fields_updated);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#else
mavlink_highres_imu_t packet;
packet.time_usec = time_usec;
packet.xacc = xacc;
packet.yacc = yacc;
packet.zacc = zacc;
packet.xgyro = xgyro;
packet.ygyro = ygyro;
packet.zgyro = zgyro;
packet.xmag = xmag;
packet.ymag = ymag;
packet.zmag = zmag;
packet.abs_pressure = abs_pressure;
packet.diff_pressure = diff_pressure;
packet.pressure_alt = pressure_alt;
packet.temperature = temperature;
packet.fields_updated = fields_updated;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
}
/**
* @brief Pack a highres_imu message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param xacc X acceleration (m/s^2)
* @param yacc Y acceleration (m/s^2)
* @param zacc Z acceleration (m/s^2)
* @param xgyro Angular speed around X axis (rad / sec)
* @param ygyro Angular speed around Y axis (rad / sec)
* @param zgyro Angular speed around Z axis (rad / sec)
* @param xmag X Magnetic field (Gauss)
* @param ymag Y Magnetic field (Gauss)
* @param zmag Z Magnetic field (Gauss)
* @param abs_pressure Absolute pressure in millibar
* @param diff_pressure Differential pressure in millibar
* @param pressure_alt Altitude calculated from pressure
* @param temperature Temperature in degrees celsius
* @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_highres_imu_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float xmag,float ymag,float zmag,float abs_pressure,float diff_pressure,float pressure_alt,float temperature,uint16_t fields_updated)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, xacc);
_mav_put_float(buf, 12, yacc);
_mav_put_float(buf, 16, zacc);
_mav_put_float(buf, 20, xgyro);
_mav_put_float(buf, 24, ygyro);
_mav_put_float(buf, 28, zgyro);
_mav_put_float(buf, 32, xmag);
_mav_put_float(buf, 36, ymag);
_mav_put_float(buf, 40, zmag);
_mav_put_float(buf, 44, abs_pressure);
_mav_put_float(buf, 48, diff_pressure);
_mav_put_float(buf, 52, pressure_alt);
_mav_put_float(buf, 56, temperature);
_mav_put_uint16_t(buf, 60, fields_updated);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#else
mavlink_highres_imu_t packet;
packet.time_usec = time_usec;
packet.xacc = xacc;
packet.yacc = yacc;
packet.zacc = zacc;
packet.xgyro = xgyro;
packet.ygyro = ygyro;
packet.zgyro = zgyro;
packet.xmag = xmag;
packet.ymag = ymag;
packet.zmag = zmag;
packet.abs_pressure = abs_pressure;
packet.diff_pressure = diff_pressure;
packet.pressure_alt = pressure_alt;
packet.temperature = temperature;
packet.fields_updated = fields_updated;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
}
/**
* @brief Encode a highres_imu struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param highres_imu C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_highres_imu_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
{
return mavlink_msg_highres_imu_pack(system_id, component_id, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated);
}
/**
* @brief Encode a highres_imu struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param highres_imu C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_highres_imu_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
{
return mavlink_msg_highres_imu_pack_chan(system_id, component_id, chan, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated);
}
/**
* @brief Send a highres_imu message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param xacc X acceleration (m/s^2)
* @param yacc Y acceleration (m/s^2)
* @param zacc Z acceleration (m/s^2)
* @param xgyro Angular speed around X axis (rad / sec)
* @param ygyro Angular speed around Y axis (rad / sec)
* @param zgyro Angular speed around Z axis (rad / sec)
* @param xmag X Magnetic field (Gauss)
* @param ymag Y Magnetic field (Gauss)
* @param zmag Z Magnetic field (Gauss)
* @param abs_pressure Absolute pressure in millibar
* @param diff_pressure Differential pressure in millibar
* @param pressure_alt Altitude calculated from pressure
* @param temperature Temperature in degrees celsius
* @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_highres_imu_send(mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, xacc);
_mav_put_float(buf, 12, yacc);
_mav_put_float(buf, 16, zacc);
_mav_put_float(buf, 20, xgyro);
_mav_put_float(buf, 24, ygyro);
_mav_put_float(buf, 28, zgyro);
_mav_put_float(buf, 32, xmag);
_mav_put_float(buf, 36, ymag);
_mav_put_float(buf, 40, zmag);
_mav_put_float(buf, 44, abs_pressure);
_mav_put_float(buf, 48, diff_pressure);
_mav_put_float(buf, 52, pressure_alt);
_mav_put_float(buf, 56, temperature);
_mav_put_uint16_t(buf, 60, fields_updated);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
#else
mavlink_highres_imu_t packet;
packet.time_usec = time_usec;
packet.xacc = xacc;
packet.yacc = yacc;
packet.zacc = zacc;
packet.xgyro = xgyro;
packet.ygyro = ygyro;
packet.zgyro = zgyro;
packet.xmag = xmag;
packet.ymag = ymag;
packet.zmag = zmag;
packet.abs_pressure = abs_pressure;
packet.diff_pressure = diff_pressure;
packet.pressure_alt = pressure_alt;
packet.temperature = temperature;
packet.fields_updated = fields_updated;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)&packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)&packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_HIGHRES_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_highres_imu_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, xacc);
_mav_put_float(buf, 12, yacc);
_mav_put_float(buf, 16, zacc);
_mav_put_float(buf, 20, xgyro);
_mav_put_float(buf, 24, ygyro);
_mav_put_float(buf, 28, zgyro);
_mav_put_float(buf, 32, xmag);
_mav_put_float(buf, 36, ymag);
_mav_put_float(buf, 40, zmag);
_mav_put_float(buf, 44, abs_pressure);
_mav_put_float(buf, 48, diff_pressure);
_mav_put_float(buf, 52, pressure_alt);
_mav_put_float(buf, 56, temperature);
_mav_put_uint16_t(buf, 60, fields_updated);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
#else
mavlink_highres_imu_t *packet = (mavlink_highres_imu_t *)msgbuf;
packet->time_usec = time_usec;
packet->xacc = xacc;
packet->yacc = yacc;
packet->zacc = zacc;
packet->xgyro = xgyro;
packet->ygyro = ygyro;
packet->zgyro = zgyro;
packet->xmag = xmag;
packet->ymag = ymag;
packet->zmag = zmag;
packet->abs_pressure = abs_pressure;
packet->diff_pressure = diff_pressure;
packet->pressure_alt = pressure_alt;
packet->temperature = temperature;
packet->fields_updated = fields_updated;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE HIGHRES_IMU UNPACKING
/**
* @brief Get field time_usec from highres_imu message
*
* @return Timestamp (microseconds, synced to UNIX time or since system boot)
*/
static inline uint64_t mavlink_msg_highres_imu_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field xacc from highres_imu message
*
* @return X acceleration (m/s^2)
*/
static inline float mavlink_msg_highres_imu_get_xacc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field yacc from highres_imu message
*
* @return Y acceleration (m/s^2)
*/
static inline float mavlink_msg_highres_imu_get_yacc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field zacc from highres_imu message
*
* @return Z acceleration (m/s^2)
*/
static inline float mavlink_msg_highres_imu_get_zacc(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field xgyro from highres_imu message
*
* @return Angular speed around X axis (rad / sec)
*/
static inline float mavlink_msg_highres_imu_get_xgyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field ygyro from highres_imu message
*
* @return Angular speed around Y axis (rad / sec)
*/
static inline float mavlink_msg_highres_imu_get_ygyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field zgyro from highres_imu message
*
* @return Angular speed around Z axis (rad / sec)
*/
static inline float mavlink_msg_highres_imu_get_zgyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field xmag from highres_imu message
*
* @return X Magnetic field (Gauss)
*/
static inline float mavlink_msg_highres_imu_get_xmag(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 32);
}
/**
* @brief Get field ymag from highres_imu message
*
* @return Y Magnetic field (Gauss)
*/
static inline float mavlink_msg_highres_imu_get_ymag(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 36);
}
/**
* @brief Get field zmag from highres_imu message
*
* @return Z Magnetic field (Gauss)
*/
static inline float mavlink_msg_highres_imu_get_zmag(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 40);
}
/**
* @brief Get field abs_pressure from highres_imu message
*
* @return Absolute pressure in millibar
*/
static inline float mavlink_msg_highres_imu_get_abs_pressure(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 44);
}
/**
* @brief Get field diff_pressure from highres_imu message
*
* @return Differential pressure in millibar
*/
static inline float mavlink_msg_highres_imu_get_diff_pressure(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 48);
}
/**
* @brief Get field pressure_alt from highres_imu message
*
* @return Altitude calculated from pressure
*/
static inline float mavlink_msg_highres_imu_get_pressure_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 52);
}
/**
* @brief Get field temperature from highres_imu message
*
* @return Temperature in degrees celsius
*/
static inline float mavlink_msg_highres_imu_get_temperature(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 56);
}
/**
* @brief Get field fields_updated from highres_imu message
*
* @return Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
*/
static inline uint16_t mavlink_msg_highres_imu_get_fields_updated(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 60);
}
/**
* @brief Decode a highres_imu message into a struct
*
* @param msg The message to decode
* @param highres_imu C-struct to decode the message contents into
*/
static inline void mavlink_msg_highres_imu_decode(const mavlink_message_t* msg, mavlink_highres_imu_t* highres_imu)
{
#if MAVLINK_NEED_BYTE_SWAP
highres_imu->time_usec = mavlink_msg_highres_imu_get_time_usec(msg);
highres_imu->xacc = mavlink_msg_highres_imu_get_xacc(msg);
highres_imu->yacc = mavlink_msg_highres_imu_get_yacc(msg);
highres_imu->zacc = mavlink_msg_highres_imu_get_zacc(msg);
highres_imu->xgyro = mavlink_msg_highres_imu_get_xgyro(msg);
highres_imu->ygyro = mavlink_msg_highres_imu_get_ygyro(msg);
highres_imu->zgyro = mavlink_msg_highres_imu_get_zgyro(msg);
highres_imu->xmag = mavlink_msg_highres_imu_get_xmag(msg);
highres_imu->ymag = mavlink_msg_highres_imu_get_ymag(msg);
highres_imu->zmag = mavlink_msg_highres_imu_get_zmag(msg);
highres_imu->abs_pressure = mavlink_msg_highres_imu_get_abs_pressure(msg);
highres_imu->diff_pressure = mavlink_msg_highres_imu_get_diff_pressure(msg);
highres_imu->pressure_alt = mavlink_msg_highres_imu_get_pressure_alt(msg);
highres_imu->temperature = mavlink_msg_highres_imu_get_temperature(msg);
highres_imu->fields_updated = mavlink_msg_highres_imu_get_fields_updated(msg);
#else
memcpy(highres_imu, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
#endif
}

View File

@ -0,0 +1,449 @@
// MESSAGE HIL_CONTROLS PACKING
#define MAVLINK_MSG_ID_HIL_CONTROLS 91
typedef struct __mavlink_hil_controls_t
{
uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
float roll_ailerons; /*< Control output -1 .. 1*/
float pitch_elevator; /*< Control output -1 .. 1*/
float yaw_rudder; /*< Control output -1 .. 1*/
float throttle; /*< Throttle 0 .. 1*/
float aux1; /*< Aux 1, -1 .. 1*/
float aux2; /*< Aux 2, -1 .. 1*/
float aux3; /*< Aux 3, -1 .. 1*/
float aux4; /*< Aux 4, -1 .. 1*/
uint8_t mode; /*< System mode (MAV_MODE)*/
uint8_t nav_mode; /*< Navigation mode (MAV_NAV_MODE)*/
} mavlink_hil_controls_t;
#define MAVLINK_MSG_ID_HIL_CONTROLS_LEN 42
#define MAVLINK_MSG_ID_91_LEN 42
#define MAVLINK_MSG_ID_HIL_CONTROLS_CRC 63
#define MAVLINK_MSG_ID_91_CRC 63
#define MAVLINK_MESSAGE_INFO_HIL_CONTROLS { \
"HIL_CONTROLS", \
11, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_controls_t, time_usec) }, \
{ "roll_ailerons", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_controls_t, roll_ailerons) }, \
{ "pitch_elevator", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_controls_t, pitch_elevator) }, \
{ "yaw_rudder", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_controls_t, yaw_rudder) }, \
{ "throttle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_controls_t, throttle) }, \
{ "aux1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_controls_t, aux1) }, \
{ "aux2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_controls_t, aux2) }, \
{ "aux3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_controls_t, aux3) }, \
{ "aux4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_controls_t, aux4) }, \
{ "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_hil_controls_t, mode) }, \
{ "nav_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_hil_controls_t, nav_mode) }, \
} \
}
/**
* @brief Pack a hil_controls message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param roll_ailerons Control output -1 .. 1
* @param pitch_elevator Control output -1 .. 1
* @param yaw_rudder Control output -1 .. 1
* @param throttle Throttle 0 .. 1
* @param aux1 Aux 1, -1 .. 1
* @param aux2 Aux 2, -1 .. 1
* @param aux3 Aux 3, -1 .. 1
* @param aux4 Aux 4, -1 .. 1
* @param mode System mode (MAV_MODE)
* @param nav_mode Navigation mode (MAV_NAV_MODE)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_hil_controls_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, roll_ailerons);
_mav_put_float(buf, 12, pitch_elevator);
_mav_put_float(buf, 16, yaw_rudder);
_mav_put_float(buf, 20, throttle);
_mav_put_float(buf, 24, aux1);
_mav_put_float(buf, 28, aux2);
_mav_put_float(buf, 32, aux3);
_mav_put_float(buf, 36, aux4);
_mav_put_uint8_t(buf, 40, mode);
_mav_put_uint8_t(buf, 41, nav_mode);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#else
mavlink_hil_controls_t packet;
packet.time_usec = time_usec;
packet.roll_ailerons = roll_ailerons;
packet.pitch_elevator = pitch_elevator;
packet.yaw_rudder = yaw_rudder;
packet.throttle = throttle;
packet.aux1 = aux1;
packet.aux2 = aux2;
packet.aux3 = aux3;
packet.aux4 = aux4;
packet.mode = mode;
packet.nav_mode = nav_mode;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
}
/**
* @brief Pack a hil_controls message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param roll_ailerons Control output -1 .. 1
* @param pitch_elevator Control output -1 .. 1
* @param yaw_rudder Control output -1 .. 1
* @param throttle Throttle 0 .. 1
* @param aux1 Aux 1, -1 .. 1
* @param aux2 Aux 2, -1 .. 1
* @param aux3 Aux 3, -1 .. 1
* @param aux4 Aux 4, -1 .. 1
* @param mode System mode (MAV_MODE)
* @param nav_mode Navigation mode (MAV_NAV_MODE)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_hil_controls_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,float roll_ailerons,float pitch_elevator,float yaw_rudder,float throttle,float aux1,float aux2,float aux3,float aux4,uint8_t mode,uint8_t nav_mode)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, roll_ailerons);
_mav_put_float(buf, 12, pitch_elevator);
_mav_put_float(buf, 16, yaw_rudder);
_mav_put_float(buf, 20, throttle);
_mav_put_float(buf, 24, aux1);
_mav_put_float(buf, 28, aux2);
_mav_put_float(buf, 32, aux3);
_mav_put_float(buf, 36, aux4);
_mav_put_uint8_t(buf, 40, mode);
_mav_put_uint8_t(buf, 41, nav_mode);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#else
mavlink_hil_controls_t packet;
packet.time_usec = time_usec;
packet.roll_ailerons = roll_ailerons;
packet.pitch_elevator = pitch_elevator;
packet.yaw_rudder = yaw_rudder;
packet.throttle = throttle;
packet.aux1 = aux1;
packet.aux2 = aux2;
packet.aux3 = aux3;
packet.aux4 = aux4;
packet.mode = mode;
packet.nav_mode = nav_mode;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
}
/**
* @brief Encode a hil_controls struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param hil_controls C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_hil_controls_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
{
return mavlink_msg_hil_controls_pack(system_id, component_id, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
}
/**
* @brief Encode a hil_controls struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param hil_controls C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_hil_controls_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
{
return mavlink_msg_hil_controls_pack_chan(system_id, component_id, chan, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
}
/**
* @brief Send a hil_controls message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param roll_ailerons Control output -1 .. 1
* @param pitch_elevator Control output -1 .. 1
* @param yaw_rudder Control output -1 .. 1
* @param throttle Throttle 0 .. 1
* @param aux1 Aux 1, -1 .. 1
* @param aux2 Aux 2, -1 .. 1
* @param aux3 Aux 3, -1 .. 1
* @param aux4 Aux 4, -1 .. 1
* @param mode System mode (MAV_MODE)
* @param nav_mode Navigation mode (MAV_NAV_MODE)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_hil_controls_send(mavlink_channel_t chan, uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, roll_ailerons);
_mav_put_float(buf, 12, pitch_elevator);
_mav_put_float(buf, 16, yaw_rudder);
_mav_put_float(buf, 20, throttle);
_mav_put_float(buf, 24, aux1);
_mav_put_float(buf, 28, aux2);
_mav_put_float(buf, 32, aux3);
_mav_put_float(buf, 36, aux4);
_mav_put_uint8_t(buf, 40, mode);
_mav_put_uint8_t(buf, 41, nav_mode);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
#else
mavlink_hil_controls_t packet;
packet.time_usec = time_usec;
packet.roll_ailerons = roll_ailerons;
packet.pitch_elevator = pitch_elevator;
packet.yaw_rudder = yaw_rudder;
packet.throttle = throttle;
packet.aux1 = aux1;
packet.aux2 = aux2;
packet.aux3 = aux3;
packet.aux4 = aux4;
packet.mode = mode;
packet.nav_mode = nav_mode;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)&packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)&packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_HIL_CONTROLS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_hil_controls_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_float(buf, 8, roll_ailerons);
_mav_put_float(buf, 12, pitch_elevator);
_mav_put_float(buf, 16, yaw_rudder);
_mav_put_float(buf, 20, throttle);
_mav_put_float(buf, 24, aux1);
_mav_put_float(buf, 28, aux2);
_mav_put_float(buf, 32, aux3);
_mav_put_float(buf, 36, aux4);
_mav_put_uint8_t(buf, 40, mode);
_mav_put_uint8_t(buf, 41, nav_mode);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
#else
mavlink_hil_controls_t *packet = (mavlink_hil_controls_t *)msgbuf;
packet->time_usec = time_usec;
packet->roll_ailerons = roll_ailerons;
packet->pitch_elevator = pitch_elevator;
packet->yaw_rudder = yaw_rudder;
packet->throttle = throttle;
packet->aux1 = aux1;
packet->aux2 = aux2;
packet->aux3 = aux3;
packet->aux4 = aux4;
packet->mode = mode;
packet->nav_mode = nav_mode;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE HIL_CONTROLS UNPACKING
/**
* @brief Get field time_usec from hil_controls message
*
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
*/
static inline uint64_t mavlink_msg_hil_controls_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field roll_ailerons from hil_controls message
*
* @return Control output -1 .. 1
*/
static inline float mavlink_msg_hil_controls_get_roll_ailerons(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 8);
}
/**
* @brief Get field pitch_elevator from hil_controls message
*
* @return Control output -1 .. 1
*/
static inline float mavlink_msg_hil_controls_get_pitch_elevator(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field yaw_rudder from hil_controls message
*
* @return Control output -1 .. 1
*/
static inline float mavlink_msg_hil_controls_get_yaw_rudder(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field throttle from hil_controls message
*
* @return Throttle 0 .. 1
*/
static inline float mavlink_msg_hil_controls_get_throttle(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field aux1 from hil_controls message
*
* @return Aux 1, -1 .. 1
*/
static inline float mavlink_msg_hil_controls_get_aux1(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field aux2 from hil_controls message
*
* @return Aux 2, -1 .. 1
*/
static inline float mavlink_msg_hil_controls_get_aux2(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field aux3 from hil_controls message
*
* @return Aux 3, -1 .. 1
*/
static inline float mavlink_msg_hil_controls_get_aux3(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 32);
}
/**
* @brief Get field aux4 from hil_controls message
*
* @return Aux 4, -1 .. 1
*/
static inline float mavlink_msg_hil_controls_get_aux4(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 36);
}
/**
* @brief Get field mode from hil_controls message
*
* @return System mode (MAV_MODE)
*/
static inline uint8_t mavlink_msg_hil_controls_get_mode(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 40);
}
/**
* @brief Get field nav_mode from hil_controls message
*
* @return Navigation mode (MAV_NAV_MODE)
*/
static inline uint8_t mavlink_msg_hil_controls_get_nav_mode(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 41);
}
/**
* @brief Decode a hil_controls message into a struct
*
* @param msg The message to decode
* @param hil_controls C-struct to decode the message contents into
*/
static inline void mavlink_msg_hil_controls_decode(const mavlink_message_t* msg, mavlink_hil_controls_t* hil_controls)
{
#if MAVLINK_NEED_BYTE_SWAP
hil_controls->time_usec = mavlink_msg_hil_controls_get_time_usec(msg);
hil_controls->roll_ailerons = mavlink_msg_hil_controls_get_roll_ailerons(msg);
hil_controls->pitch_elevator = mavlink_msg_hil_controls_get_pitch_elevator(msg);
hil_controls->yaw_rudder = mavlink_msg_hil_controls_get_yaw_rudder(msg);
hil_controls->throttle = mavlink_msg_hil_controls_get_throttle(msg);
hil_controls->aux1 = mavlink_msg_hil_controls_get_aux1(msg);
hil_controls->aux2 = mavlink_msg_hil_controls_get_aux2(msg);
hil_controls->aux3 = mavlink_msg_hil_controls_get_aux3(msg);
hil_controls->aux4 = mavlink_msg_hil_controls_get_aux4(msg);
hil_controls->mode = mavlink_msg_hil_controls_get_mode(msg);
hil_controls->nav_mode = mavlink_msg_hil_controls_get_nav_mode(msg);
#else
memcpy(hil_controls, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
#endif
}

View File

@ -0,0 +1,497 @@
// MESSAGE HIL_GPS PACKING
#define MAVLINK_MSG_ID_HIL_GPS 113
typedef struct __mavlink_hil_gps_t
{
uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/
int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/
int32_t alt; /*< Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)*/
uint16_t eph; /*< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535*/
uint16_t epv; /*< GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535*/
uint16_t vel; /*< GPS ground speed (m/s * 100). If unknown, set to: 65535*/
int16_t vn; /*< GPS velocity in cm/s in NORTH direction in earth-fixed NED frame*/
int16_t ve; /*< GPS velocity in cm/s in EAST direction in earth-fixed NED frame*/
int16_t vd; /*< GPS velocity in cm/s in DOWN direction in earth-fixed NED frame*/
uint16_t cog; /*< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535*/
uint8_t fix_type; /*< 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.*/
uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/
} mavlink_hil_gps_t;
#define MAVLINK_MSG_ID_HIL_GPS_LEN 36
#define MAVLINK_MSG_ID_113_LEN 36
#define MAVLINK_MSG_ID_HIL_GPS_CRC 124
#define MAVLINK_MSG_ID_113_CRC 124
#define MAVLINK_MESSAGE_INFO_HIL_GPS { \
"HIL_GPS", \
13, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_gps_t, time_usec) }, \
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_hil_gps_t, lat) }, \
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_hil_gps_t, lon) }, \
{ "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_hil_gps_t, alt) }, \
{ "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_hil_gps_t, eph) }, \
{ "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_hil_gps_t, epv) }, \
{ "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_hil_gps_t, vel) }, \
{ "vn", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_hil_gps_t, vn) }, \
{ "ve", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_hil_gps_t, ve) }, \
{ "vd", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_hil_gps_t, vd) }, \
{ "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_hil_gps_t, cog) }, \
{ "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_hil_gps_t, fix_type) }, \
{ "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_hil_gps_t, satellites_visible) }, \
} \
}
/**
* @brief Pack a hil_gps message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
* @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
* @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535
* @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535
* @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame
* @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame
* @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
* @param satellites_visible Number of satellites visible. If unknown, set to 255
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_hil_gps_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_GPS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint16_t(buf, 20, eph);
_mav_put_uint16_t(buf, 22, epv);
_mav_put_uint16_t(buf, 24, vel);
_mav_put_int16_t(buf, 26, vn);
_mav_put_int16_t(buf, 28, ve);
_mav_put_int16_t(buf, 30, vd);
_mav_put_uint16_t(buf, 32, cog);
_mav_put_uint8_t(buf, 34, fix_type);
_mav_put_uint8_t(buf, 35, satellites_visible);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
#else
mavlink_hil_gps_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.vn = vn;
packet.ve = ve;
packet.vd = vd;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIL_GPS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
}
/**
* @brief Pack a hil_gps message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
* @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
* @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535
* @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535
* @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame
* @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame
* @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
* @param satellites_visible Number of satellites visible. If unknown, set to 255
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_hil_gps_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,uint16_t eph,uint16_t epv,uint16_t vel,int16_t vn,int16_t ve,int16_t vd,uint16_t cog,uint8_t satellites_visible)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_GPS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint16_t(buf, 20, eph);
_mav_put_uint16_t(buf, 22, epv);
_mav_put_uint16_t(buf, 24, vel);
_mav_put_int16_t(buf, 26, vn);
_mav_put_int16_t(buf, 28, ve);
_mav_put_int16_t(buf, 30, vd);
_mav_put_uint16_t(buf, 32, cog);
_mav_put_uint8_t(buf, 34, fix_type);
_mav_put_uint8_t(buf, 35, satellites_visible);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
#else
mavlink_hil_gps_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.vn = vn;
packet.ve = ve;
packet.vd = vd;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIL_GPS;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
}
/**
* @brief Encode a hil_gps struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param hil_gps C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_hil_gps_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps)
{
return mavlink_msg_hil_gps_pack(system_id, component_id, msg, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible);
}
/**
* @brief Encode a hil_gps struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param hil_gps C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_hil_gps_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps)
{
return mavlink_msg_hil_gps_pack_chan(system_id, component_id, chan, msg, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible);
}
/**
* @brief Send a hil_gps message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param fix_type 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.
* @param lat Latitude (WGS84), in degrees * 1E7
* @param lon Longitude (WGS84), in degrees * 1E7
* @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
* @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
* @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535
* @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535
* @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame
* @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame
* @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame
* @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
* @param satellites_visible Number of satellites visible. If unknown, set to 255
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_hil_gps_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_GPS_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint16_t(buf, 20, eph);
_mav_put_uint16_t(buf, 22, epv);
_mav_put_uint16_t(buf, 24, vel);
_mav_put_int16_t(buf, 26, vn);
_mav_put_int16_t(buf, 28, ve);
_mav_put_int16_t(buf, 30, vd);
_mav_put_uint16_t(buf, 32, cog);
_mav_put_uint8_t(buf, 34, fix_type);
_mav_put_uint8_t(buf, 35, satellites_visible);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
#else
mavlink_hil_gps_t packet;
packet.time_usec = time_usec;
packet.lat = lat;
packet.lon = lon;
packet.alt = alt;
packet.eph = eph;
packet.epv = epv;
packet.vel = vel;
packet.vn = vn;
packet.ve = ve;
packet.vd = vd;
packet.cog = cog;
packet.fix_type = fix_type;
packet.satellites_visible = satellites_visible;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)&packet, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)&packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_HIL_GPS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_hil_gps_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_int32_t(buf, 8, lat);
_mav_put_int32_t(buf, 12, lon);
_mav_put_int32_t(buf, 16, alt);
_mav_put_uint16_t(buf, 20, eph);
_mav_put_uint16_t(buf, 22, epv);
_mav_put_uint16_t(buf, 24, vel);
_mav_put_int16_t(buf, 26, vn);
_mav_put_int16_t(buf, 28, ve);
_mav_put_int16_t(buf, 30, vd);
_mav_put_uint16_t(buf, 32, cog);
_mav_put_uint8_t(buf, 34, fix_type);
_mav_put_uint8_t(buf, 35, satellites_visible);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
#else
mavlink_hil_gps_t *packet = (mavlink_hil_gps_t *)msgbuf;
packet->time_usec = time_usec;
packet->lat = lat;
packet->lon = lon;
packet->alt = alt;
packet->eph = eph;
packet->epv = epv;
packet->vel = vel;
packet->vn = vn;
packet->ve = ve;
packet->vd = vd;
packet->cog = cog;
packet->fix_type = fix_type;
packet->satellites_visible = satellites_visible;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)packet, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)packet, MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE HIL_GPS UNPACKING
/**
* @brief Get field time_usec from hil_gps message
*
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
*/
static inline uint64_t mavlink_msg_hil_gps_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field fix_type from hil_gps message
*
* @return 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.
*/
static inline uint8_t mavlink_msg_hil_gps_get_fix_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 34);
}
/**
* @brief Get field lat from hil_gps message
*
* @return Latitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_hil_gps_get_lat(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Get field lon from hil_gps message
*
* @return Longitude (WGS84), in degrees * 1E7
*/
static inline int32_t mavlink_msg_hil_gps_get_lon(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 12);
}
/**
* @brief Get field alt from hil_gps message
*
* @return Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
*/
static inline int32_t mavlink_msg_hil_gps_get_alt(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 16);
}
/**
* @brief Get field eph from hil_gps message
*
* @return GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535
*/
static inline uint16_t mavlink_msg_hil_gps_get_eph(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 20);
}
/**
* @brief Get field epv from hil_gps message
*
* @return GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535
*/
static inline uint16_t mavlink_msg_hil_gps_get_epv(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 22);
}
/**
* @brief Get field vel from hil_gps message
*
* @return GPS ground speed (m/s * 100). If unknown, set to: 65535
*/
static inline uint16_t mavlink_msg_hil_gps_get_vel(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 24);
}
/**
* @brief Get field vn from hil_gps message
*
* @return GPS velocity in cm/s in NORTH direction in earth-fixed NED frame
*/
static inline int16_t mavlink_msg_hil_gps_get_vn(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 26);
}
/**
* @brief Get field ve from hil_gps message
*
* @return GPS velocity in cm/s in EAST direction in earth-fixed NED frame
*/
static inline int16_t mavlink_msg_hil_gps_get_ve(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 28);
}
/**
* @brief Get field vd from hil_gps message
*
* @return GPS velocity in cm/s in DOWN direction in earth-fixed NED frame
*/
static inline int16_t mavlink_msg_hil_gps_get_vd(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 30);
}
/**
* @brief Get field cog from hil_gps message
*
* @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535
*/
static inline uint16_t mavlink_msg_hil_gps_get_cog(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 32);
}
/**
* @brief Get field satellites_visible from hil_gps message
*
* @return Number of satellites visible. If unknown, set to 255
*/
static inline uint8_t mavlink_msg_hil_gps_get_satellites_visible(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 35);
}
/**
* @brief Decode a hil_gps message into a struct
*
* @param msg The message to decode
* @param hil_gps C-struct to decode the message contents into
*/
static inline void mavlink_msg_hil_gps_decode(const mavlink_message_t* msg, mavlink_hil_gps_t* hil_gps)
{
#if MAVLINK_NEED_BYTE_SWAP
hil_gps->time_usec = mavlink_msg_hil_gps_get_time_usec(msg);
hil_gps->lat = mavlink_msg_hil_gps_get_lat(msg);
hil_gps->lon = mavlink_msg_hil_gps_get_lon(msg);
hil_gps->alt = mavlink_msg_hil_gps_get_alt(msg);
hil_gps->eph = mavlink_msg_hil_gps_get_eph(msg);
hil_gps->epv = mavlink_msg_hil_gps_get_epv(msg);
hil_gps->vel = mavlink_msg_hil_gps_get_vel(msg);
hil_gps->vn = mavlink_msg_hil_gps_get_vn(msg);
hil_gps->ve = mavlink_msg_hil_gps_get_ve(msg);
hil_gps->vd = mavlink_msg_hil_gps_get_vd(msg);
hil_gps->cog = mavlink_msg_hil_gps_get_cog(msg);
hil_gps->fix_type = mavlink_msg_hil_gps_get_fix_type(msg);
hil_gps->satellites_visible = mavlink_msg_hil_gps_get_satellites_visible(msg);
#else
memcpy(hil_gps, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_GPS_LEN);
#endif
}

View File

@ -0,0 +1,473 @@
// MESSAGE HIL_OPTICAL_FLOW PACKING
#define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW 114
typedef struct __mavlink_hil_optical_flow_t
{
uint64_t time_usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
uint32_t integration_time_us; /*< Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.*/
float integrated_x; /*< 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.)*/
float integrated_y; /*< 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.)*/
float integrated_xgyro; /*< RH rotation around X axis (rad)*/
float integrated_ygyro; /*< RH rotation around Y axis (rad)*/
float integrated_zgyro; /*< RH rotation around Z axis (rad)*/
uint32_t time_delta_distance_us; /*< Time in microseconds since the distance was sampled.*/
float distance; /*< Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance.*/
int16_t temperature; /*< Temperature * 100 in centi-degrees Celsius*/
uint8_t sensor_id; /*< Sensor ID*/
uint8_t quality; /*< Optical flow quality / confidence. 0: no valid flow, 255: maximum quality*/
} mavlink_hil_optical_flow_t;
#define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN 44
#define MAVLINK_MSG_ID_114_LEN 44
#define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC 237
#define MAVLINK_MSG_ID_114_CRC 237
#define MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW { \
"HIL_OPTICAL_FLOW", \
12, \
{ { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_optical_flow_t, time_usec) }, \
{ "integration_time_us", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_hil_optical_flow_t, integration_time_us) }, \
{ "integrated_x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_optical_flow_t, integrated_x) }, \
{ "integrated_y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_optical_flow_t, integrated_y) }, \
{ "integrated_xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_optical_flow_t, integrated_xgyro) }, \
{ "integrated_ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_optical_flow_t, integrated_ygyro) }, \
{ "integrated_zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_optical_flow_t, integrated_zgyro) }, \
{ "time_delta_distance_us", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_hil_optical_flow_t, time_delta_distance_us) }, \
{ "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_optical_flow_t, distance) }, \
{ "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_hil_optical_flow_t, temperature) }, \
{ "sensor_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_hil_optical_flow_t, sensor_id) }, \
{ "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_hil_optical_flow_t, quality) }, \
} \
}
/**
* @brief Pack a hil_optical_flow message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param sensor_id Sensor ID
* @param integration_time_us Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
* @param integrated_x 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.)
* @param integrated_y 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.)
* @param integrated_xgyro RH rotation around X axis (rad)
* @param integrated_ygyro RH rotation around Y axis (rad)
* @param integrated_zgyro RH rotation around Z axis (rad)
* @param temperature Temperature * 100 in centi-degrees Celsius
* @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
* @param time_delta_distance_us Time in microseconds since the distance was sampled.
* @param distance Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_hil_optical_flow_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint32_t(buf, 8, integration_time_us);
_mav_put_float(buf, 12, integrated_x);
_mav_put_float(buf, 16, integrated_y);
_mav_put_float(buf, 20, integrated_xgyro);
_mav_put_float(buf, 24, integrated_ygyro);
_mav_put_float(buf, 28, integrated_zgyro);
_mav_put_uint32_t(buf, 32, time_delta_distance_us);
_mav_put_float(buf, 36, distance);
_mav_put_int16_t(buf, 40, temperature);
_mav_put_uint8_t(buf, 42, sensor_id);
_mav_put_uint8_t(buf, 43, quality);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#else
mavlink_hil_optical_flow_t packet;
packet.time_usec = time_usec;
packet.integration_time_us = integration_time_us;
packet.integrated_x = integrated_x;
packet.integrated_y = integrated_y;
packet.integrated_xgyro = integrated_xgyro;
packet.integrated_ygyro = integrated_ygyro;
packet.integrated_zgyro = integrated_zgyro;
packet.time_delta_distance_us = time_delta_distance_us;
packet.distance = distance;
packet.temperature = temperature;
packet.sensor_id = sensor_id;
packet.quality = quality;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
#else
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
}
/**
* @brief Pack a hil_optical_flow message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param sensor_id Sensor ID
* @param integration_time_us Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
* @param integrated_x 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.)
* @param integrated_y 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.)
* @param integrated_xgyro RH rotation around X axis (rad)
* @param integrated_ygyro RH rotation around Y axis (rad)
* @param integrated_zgyro RH rotation around Z axis (rad)
* @param temperature Temperature * 100 in centi-degrees Celsius
* @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
* @param time_delta_distance_us Time in microseconds since the distance was sampled.
* @param distance Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_hil_optical_flow_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint64_t time_usec,uint8_t sensor_id,uint32_t integration_time_us,float integrated_x,float integrated_y,float integrated_xgyro,float integrated_ygyro,float integrated_zgyro,int16_t temperature,uint8_t quality,uint32_t time_delta_distance_us,float distance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint32_t(buf, 8, integration_time_us);
_mav_put_float(buf, 12, integrated_x);
_mav_put_float(buf, 16, integrated_y);
_mav_put_float(buf, 20, integrated_xgyro);
_mav_put_float(buf, 24, integrated_ygyro);
_mav_put_float(buf, 28, integrated_zgyro);
_mav_put_uint32_t(buf, 32, time_delta_distance_us);
_mav_put_float(buf, 36, distance);
_mav_put_int16_t(buf, 40, temperature);
_mav_put_uint8_t(buf, 42, sensor_id);
_mav_put_uint8_t(buf, 43, quality);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#else
mavlink_hil_optical_flow_t packet;
packet.time_usec = time_usec;
packet.integration_time_us = integration_time_us;
packet.integrated_x = integrated_x;
packet.integrated_y = integrated_y;
packet.integrated_xgyro = integrated_xgyro;
packet.integrated_ygyro = integrated_ygyro;
packet.integrated_zgyro = integrated_zgyro;
packet.time_delta_distance_us = time_delta_distance_us;
packet.distance = distance;
packet.temperature = temperature;
packet.sensor_id = sensor_id;
packet.quality = quality;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW;
#if MAVLINK_CRC_EXTRA
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
#else
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
}
/**
* @brief Encode a hil_optical_flow struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param hil_optical_flow C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_hil_optical_flow_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_optical_flow_t* hil_optical_flow)
{
return mavlink_msg_hil_optical_flow_pack(system_id, component_id, msg, hil_optical_flow->time_usec, hil_optical_flow->sensor_id, hil_optical_flow->integration_time_us, hil_optical_flow->integrated_x, hil_optical_flow->integrated_y, hil_optical_flow->integrated_xgyro, hil_optical_flow->integrated_ygyro, hil_optical_flow->integrated_zgyro, hil_optical_flow->temperature, hil_optical_flow->quality, hil_optical_flow->time_delta_distance_us, hil_optical_flow->distance);
}
/**
* @brief Encode a hil_optical_flow struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param hil_optical_flow C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_hil_optical_flow_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_optical_flow_t* hil_optical_flow)
{
return mavlink_msg_hil_optical_flow_pack_chan(system_id, component_id, chan, msg, hil_optical_flow->time_usec, hil_optical_flow->sensor_id, hil_optical_flow->integration_time_us, hil_optical_flow->integrated_x, hil_optical_flow->integrated_y, hil_optical_flow->integrated_xgyro, hil_optical_flow->integrated_ygyro, hil_optical_flow->integrated_zgyro, hil_optical_flow->temperature, hil_optical_flow->quality, hil_optical_flow->time_delta_distance_us, hil_optical_flow->distance);
}
/**
* @brief Send a hil_optical_flow message
* @param chan MAVLink channel to send the message
*
* @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
* @param sensor_id Sensor ID
* @param integration_time_us Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
* @param integrated_x 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.)
* @param integrated_y 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.)
* @param integrated_xgyro RH rotation around X axis (rad)
* @param integrated_ygyro RH rotation around Y axis (rad)
* @param integrated_zgyro RH rotation around Z axis (rad)
* @param temperature Temperature * 100 in centi-degrees Celsius
* @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
* @param time_delta_distance_us Time in microseconds since the distance was sampled.
* @param distance Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_hil_optical_flow_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint32_t(buf, 8, integration_time_us);
_mav_put_float(buf, 12, integrated_x);
_mav_put_float(buf, 16, integrated_y);
_mav_put_float(buf, 20, integrated_xgyro);
_mav_put_float(buf, 24, integrated_ygyro);
_mav_put_float(buf, 28, integrated_zgyro);
_mav_put_uint32_t(buf, 32, time_delta_distance_us);
_mav_put_float(buf, 36, distance);
_mav_put_int16_t(buf, 40, temperature);
_mav_put_uint8_t(buf, 42, sensor_id);
_mav_put_uint8_t(buf, 43, quality);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
#else
mavlink_hil_optical_flow_t packet;
packet.time_usec = time_usec;
packet.integration_time_us = integration_time_us;
packet.integrated_x = integrated_x;
packet.integrated_y = integrated_y;
packet.integrated_xgyro = integrated_xgyro;
packet.integrated_ygyro = integrated_ygyro;
packet.integrated_zgyro = integrated_zgyro;
packet.time_delta_distance_us = time_delta_distance_us;
packet.distance = distance;
packet.temperature = temperature;
packet.sensor_id = sensor_id;
packet.quality = quality;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (const char *)&packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (const char *)&packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
#endif
}
#if MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_hil_optical_flow_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint64_t(buf, 0, time_usec);
_mav_put_uint32_t(buf, 8, integration_time_us);
_mav_put_float(buf, 12, integrated_x);
_mav_put_float(buf, 16, integrated_y);
_mav_put_float(buf, 20, integrated_xgyro);
_mav_put_float(buf, 24, integrated_ygyro);
_mav_put_float(buf, 28, integrated_zgyro);
_mav_put_uint32_t(buf, 32, time_delta_distance_us);
_mav_put_float(buf, 36, distance);
_mav_put_int16_t(buf, 40, temperature);
_mav_put_uint8_t(buf, 42, sensor_id);
_mav_put_uint8_t(buf, 43, quality);
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
#else
mavlink_hil_optical_flow_t *packet = (mavlink_hil_optical_flow_t *)msgbuf;
packet->time_usec = time_usec;
packet->integration_time_us = integration_time_us;
packet->integrated_x = integrated_x;
packet->integrated_y = integrated_y;
packet->integrated_xgyro = integrated_xgyro;
packet->integrated_ygyro = integrated_ygyro;
packet->integrated_zgyro = integrated_zgyro;
packet->time_delta_distance_us = time_delta_distance_us;
packet->distance = distance;
packet->temperature = temperature;
packet->sensor_id = sensor_id;
packet->quality = quality;
#if MAVLINK_CRC_EXTRA
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (const char *)packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (const char *)packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
#endif
}
#endif
#endif
// MESSAGE HIL_OPTICAL_FLOW UNPACKING
/**
* @brief Get field time_usec from hil_optical_flow message
*
* @return Timestamp (microseconds, synced to UNIX time or since system boot)
*/
static inline uint64_t mavlink_msg_hil_optical_flow_get_time_usec(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint64_t(msg, 0);
}
/**
* @brief Get field sensor_id from hil_optical_flow message
*
* @return Sensor ID
*/
static inline uint8_t mavlink_msg_hil_optical_flow_get_sensor_id(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 42);
}
/**
* @brief Get field integration_time_us from hil_optical_flow message
*
* @return Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
*/
static inline uint32_t mavlink_msg_hil_optical_flow_get_integration_time_us(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 8);
}
/**
* @brief Get field integrated_x from hil_optical_flow message
*
* @return 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.)
*/
static inline float mavlink_msg_hil_optical_flow_get_integrated_x(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 12);
}
/**
* @brief Get field integrated_y from hil_optical_flow message
*
* @return 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.)
*/
static inline float mavlink_msg_hil_optical_flow_get_integrated_y(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 16);
}
/**
* @brief Get field integrated_xgyro from hil_optical_flow message
*
* @return RH rotation around X axis (rad)
*/
static inline float mavlink_msg_hil_optical_flow_get_integrated_xgyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 20);
}
/**
* @brief Get field integrated_ygyro from hil_optical_flow message
*
* @return RH rotation around Y axis (rad)
*/
static inline float mavlink_msg_hil_optical_flow_get_integrated_ygyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 24);
}
/**
* @brief Get field integrated_zgyro from hil_optical_flow message
*
* @return RH rotation around Z axis (rad)
*/
static inline float mavlink_msg_hil_optical_flow_get_integrated_zgyro(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 28);
}
/**
* @brief Get field temperature from hil_optical_flow message
*
* @return Temperature * 100 in centi-degrees Celsius
*/
static inline int16_t mavlink_msg_hil_optical_flow_get_temperature(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 40);
}
/**
* @brief Get field quality from hil_optical_flow message
*
* @return Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
*/
static inline uint8_t mavlink_msg_hil_optical_flow_get_quality(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 43);
}
/**
* @brief Get field time_delta_distance_us from hil_optical_flow message
*
* @return Time in microseconds since the distance was sampled.
*/
static inline uint32_t mavlink_msg_hil_optical_flow_get_time_delta_distance_us(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 32);
}
/**
* @brief Get field distance from hil_optical_flow message
*
* @return Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance.
*/
static inline float mavlink_msg_hil_optical_flow_get_distance(const mavlink_message_t* msg)
{
return _MAV_RETURN_float(msg, 36);
}
/**
* @brief Decode a hil_optical_flow message into a struct
*
* @param msg The message to decode
* @param hil_optical_flow C-struct to decode the message contents into
*/
static inline void mavlink_msg_hil_optical_flow_decode(const mavlink_message_t* msg, mavlink_hil_optical_flow_t* hil_optical_flow)
{
#if MAVLINK_NEED_BYTE_SWAP
hil_optical_flow->time_usec = mavlink_msg_hil_optical_flow_get_time_usec(msg);
hil_optical_flow->integration_time_us = mavlink_msg_hil_optical_flow_get_integration_time_us(msg);
hil_optical_flow->integrated_x = mavlink_msg_hil_optical_flow_get_integrated_x(msg);
hil_optical_flow->integrated_y = mavlink_msg_hil_optical_flow_get_integrated_y(msg);
hil_optical_flow->integrated_xgyro = mavlink_msg_hil_optical_flow_get_integrated_xgyro(msg);
hil_optical_flow->integrated_ygyro = mavlink_msg_hil_optical_flow_get_integrated_ygyro(msg);
hil_optical_flow->integrated_zgyro = mavlink_msg_hil_optical_flow_get_integrated_zgyro(msg);
hil_optical_flow->time_delta_distance_us = mavlink_msg_hil_optical_flow_get_time_delta_distance_us(msg);
hil_optical_flow->distance = mavlink_msg_hil_optical_flow_get_distance(msg);
hil_optical_flow->temperature = mavlink_msg_hil_optical_flow_get_temperature(msg);
hil_optical_flow->sensor_id = mavlink_msg_hil_optical_flow_get_sensor_id(msg);
hil_optical_flow->quality = mavlink_msg_hil_optical_flow_get_quality(msg);
#else
memcpy(hil_optical_flow, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
#endif
}

Some files were not shown because too many files have changed in this diff Show More