Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Commit

Permalink
update Mavlink usage to match PX4
Browse files Browse the repository at this point in the history
 - PX4 now generates mavlink headers in the build directory
  • Loading branch information
dagar committed Nov 6, 2021
1 parent ad0b484 commit 0ea4dbe
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: submodule update
run: git submodule update --init --recursive
- name: Install latest mavlink
run: git clone --depth 1 https://github.com/mavlink/c_library_v2.git /usr/local/include/mavlink/v2.0 && rm -rf /usr/local/include/mavlink/v2.0/.git
run: git clone --depth 1 https://github.com/mavlink/c_library_v2.git /usr/local/include/mavlink && rm -rf /usr/local/include/mavlink/.git
- name: Install ignition Gazebo
run: apt update && apt install -y ignition-edifice
- name: Cmake Build
Expand Down
17 changes: 13 additions & 4 deletions cmake/FindMAVLink.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@
# macros
include(FindPackageHandleStandardArgs)

# Check for ROS_DISTRO
find_program(ROSVERSION rosversion)
execute_process(COMMAND ${ROSVERSION} -d
OUTPUT_VARIABLE ROS_DISTRO
OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(_MAVLINK_EXTRA_SEARCH_HINTS
${CMAKE_SOURCE_DIR}/mavlink/
../../mavlink/
../mavlink/
${CATKIN_DEVEL_PREFIX}/
${CMAKE_CURRENT_BINARY_DIR}/../mavlink/
)

set(_MAVLINK_EXTRA_SEARCH_PATHS
Expand All @@ -21,16 +30,16 @@ set(_MAVLINK_EXTRA_SEARCH_PATHS

# look for in the hints first
find_path(_MAVLINK_INCLUDE_DIR
NAMES mavlink/v1.0/mavlink_types.h mavlink/v2.0/mavlink_types.h
NAMES mavlink_types.h
PATH_SUFFIXES include
HINTS ${_MAVLINK_EXTRA_SEARCH_HINTS}
NO_DEFAULT_PATH
)

# look for in the hard-coded paths
find_path(_MAVLINK_INCLUDE_DIR
NAMES mavlink/v1.0/mavlink_types.h mavlink/v2.0/mavlink_types.h
PATH_SUFFIXES include
NAMES mavlink_types.h
PATH_SUFFIXES include/mavlink
PATHS ${_MAVLINK_EXTRA_SEARCH_PATHS}
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
Expand All @@ -39,7 +48,7 @@ find_path(_MAVLINK_INCLUDE_DIR
)

# look specifically for the ROS version if no other was found
find_path(_MAVLINK_INCLUDE_DIRca
find_path(_MAVLINK_INCLUDE_DIR
NAMES mavlink/v1.0/mavlink_types.h mavlink/v2.0/mavlink_types.h
PATH_SUFFIXES include
PATHS /opt/ros/${ROS_DISTRO}/
Expand Down
2 changes: 1 addition & 1 deletion include/gazebo_mavlink_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

#include <common.h>

#include <mavlink/v2.0/common/mavlink.h>
#include <common/mavlink.h>
#include "msgbuffer.h"
#include "mavlink_interface.h"

Expand Down
2 changes: 1 addition & 1 deletion include/mavlink_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

#include <Eigen/Eigen>

#include <mavlink/v2.0/common/mavlink.h>
#include <common/mavlink.h>
#include "msgbuffer.h"

static const uint32_t kDefaultMavlinkUdpPort = 14560;
Expand Down
2 changes: 1 addition & 1 deletion include/msgbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#pragma once

#include <cassert>
#include "mavlink/v2.0/common/mavlink.h"
#include <common/mavlink.h>

/**
* @brief Message buffer for internal use in libmavconn
Expand Down

0 comments on commit 0ea4dbe

Please sign in to comment.