Skip to content

Commit

Permalink
Always enable mavlink passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVautherin committed Sep 10, 2020
1 parent f2ff514 commit 815f492
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 33 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
with:
submodules: recursive
- name: configure
run: cmake -DCMAKE_BUILD_TYPE=Release -DSUPERBUILD=ON -DENABLE_MAVLINK_PASSTHROUGH=1 -DBUILD_BACKEND=ON -j 2 -Bbuild/release -H.
run: cmake -DCMAKE_BUILD_TYPE=Release -DSUPERBUILD=ON -DBUILD_BACKEND=ON -j 2 -Bbuild/release -H.
- name: build
run: cmake --build build/release -j 2
- name: install
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
with:
submodules: recursive
- name: configure
run: cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BACKEND=OFF -DBUILD_SHARED_LIBS=ON -DENABLE_MAVLINK_PASSTHROUGH=1 -DCMAKE_INSTALL_PREFIX=install -Bbuild/release -H.
run: cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BACKEND=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -Bbuild/release -H.
- name: build
run: cmake --build build/release --target install -- -j2
- name: Package
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
with:
submodules: recursive
- name: configure
run: cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BACKEND=OFF -DBUILD_SHARED_LIBS=ON -DENABLE_MAVLINK_PASSTHROUGH=1 -DCMAKE_INSTALL_PREFIX=install -Bbuild/release -H.
run: cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BACKEND=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -Bbuild/release -H.
- name: build
run: cmake --build build/release --target install -- -j2
- name: Package
Expand Down
1 change: 0 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

override_dh_auto_configure:
dh_auto_configure -O--buildsystem=cmake -O--builddirectory=build -- \
-DENABLE_MAVLINK_PASSTHROUGH=1 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTS=OFF \
Expand Down
13 changes: 3 additions & 10 deletions src/integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTESTING")
# `make test` does not show output, but `make check` does
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose)

if (ENABLE_MAVLINK_PASSTHROUGH)
set(additional_sources
mavlink_passthrough.cpp
mission_transfer_lossy.cpp)
set(additional_libs "mavsdk_mavlink_passthrough")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_MAVLINK_PASSTHROUGH")
endif()

# This includes all GTests that run integration tests
add_executable(integration_tests_runner
../core/unittests_main.cpp
Expand Down Expand Up @@ -61,7 +53,8 @@ add_executable(integration_tests_runner
telemetry_health.cpp
telemetry_modes.cpp
telemetry_sync.cpp
${additional_sources}
mavlink_passthrough.cpp
mission_transfer_lossy.cpp
)

include_directories(
Expand Down Expand Up @@ -89,7 +82,7 @@ target_link_libraries(integration_tests_runner
mavsdk_geofence
mavsdk_param
mavsdk_ftp
${additional_libs}
mavsdk_mavlink_passthrough
gtest
gtest_main
gmock
Expand Down
8 changes: 0 additions & 8 deletions src/integration_tests/ftp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
#include "system.h"
#include "plugins/ftp/ftp.h"

#ifdef ENABLE_MAVLINK_PASSTHROUGH
#include <random>
#include "plugins/mavlink_passthrough/mavlink_passthrough.h"
static std::default_random_engine random_engine;
static std::uniform_real_distribution<> distribution(0.0, 1.0);
#endif

using namespace mavsdk;

Expand Down Expand Up @@ -196,7 +194,6 @@ TEST(FtpTest, DownloadFile)
// Reset server in case there are stale open sessions
reset_server(ftp);

#ifdef ENABLE_MAVLINK_PASSTHROUGH
auto mavlink_passthrough = std::make_shared<MavlinkPassthrough>(system);
mavlink_passthrough->intercept_incoming_messages_async([this](mavlink_message_t& message) {
if (message.msgid != MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL) {
Expand All @@ -210,7 +207,6 @@ TEST(FtpTest, DownloadFile)
}
return (distribution(random_engine) > 0.01);
});
#endif

test_download(ftp, "/dataman", ".");
remove("dataman");
Expand All @@ -230,7 +226,6 @@ TEST(FtpTest, UploadFiles)
// Reset server in case there are stale open sessions
reset_server(ftp);

#ifdef ENABLE_MAVLINK_PASSTHROUGH
auto mavlink_passthrough = std::make_shared<MavlinkPassthrough>(system);
mavlink_passthrough->intercept_incoming_messages_async([this](mavlink_message_t& message) {
if (message.msgid != MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL) {
Expand All @@ -244,7 +239,6 @@ TEST(FtpTest, UploadFiles)
}
return (distribution(random_engine) > 0.1);
});
#endif

test_create_directory(ftp, "/test");

Expand Down Expand Up @@ -297,7 +291,6 @@ TEST(FtpTest, TestServer)
ASSERT_EQ(ret, ConnectionResult::Success);
System& system_cc = mavsdk_cc.system();

#ifdef ENABLE_MAVLINK_PASSTHROUGH
auto mavlink_passthrough_cc = std::make_shared<MavlinkPassthrough>(system_cc);
mavlink_passthrough_cc->intercept_incoming_messages_async([this](mavlink_message_t& message) {
if (message.msgid != MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL) {
Expand All @@ -311,7 +304,6 @@ TEST(FtpTest, TestServer)
}
return (distribution(random_engine) > 0.1);
});
#endif

auto ftp_server = std::make_shared<Ftp>(system_cc);
ftp_server->set_root_directory(".");
Expand Down
8 changes: 2 additions & 6 deletions src/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ add_subdirectory(gimbal)
add_subdirectory(info)
add_subdirectory(log_files)
add_subdirectory(ftp)
add_subdirectory(manual_control)
add_subdirectory(mavlink_passthrough)
add_subdirectory(mission)
add_subdirectory(mission_raw)
add_subdirectory(mocap)
Expand All @@ -21,11 +23,5 @@ add_subdirectory(shell)
add_subdirectory(telemetry)
add_subdirectory(tune)
add_subdirectory(failure)
add_subdirectory(manual_control)

if (ENABLE_MAVLINK_PASSTHROUGH)
message(STATUS "Include MAVLink passthrough plugin")
add_subdirectory(mavlink_passthrough)
endif()

set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES} PARENT_SCOPE)
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ class MavlinkPassthroughImpl;
* "With great power comes great responsibility." - This plugin allows
* you to send and receive MAVLink messages. There is no checking or
* safe-guards, you're on your own, and you have been warned.
*
* @note This plugin is not included in the build by default. To add it
* `make ENABLE_MAVLINK_PASSTHROUGH=1` is required.
*/
class MavlinkPassthrough : public PluginBase {
public:
Expand Down
2 changes: 1 addition & 1 deletion tools/generate_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if [ "$skip_checks" = false ]; then
fi

# Build and install locally.
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_MAVLINK_PASSTHROUGH=1 -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -B${BUILD_DIR} -H.;
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -B${BUILD_DIR} -H.;
make -C${BUILD_DIR} install -j4;

return_result=0
Expand Down
2 changes: 1 addition & 1 deletion tools/run-sitl-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ fi
PX4_FIRMWARE_DIR=$1
NPROCS=$(nproc --all)

cmake -DCMAKE_BUILD_TYPE=Debug -DASAN=ON -DUBSAN=ON -DLSAN=ON -DBUILD_BACKEND=OFF -DBUILD_SHARED_LIBS=ON -DENABLE_MAVLINK_PASSTHROUGH=1 -j $NPROCS -Bbuild/debug -H.;
cmake -DCMAKE_BUILD_TYPE=Debug -DASAN=ON -DUBSAN=ON -DLSAN=ON -DBUILD_BACKEND=OFF -DBUILD_SHARED_LIBS=ON -j $NPROCS -Bbuild/debug -H.;
cmake --build build/debug -- -j $NPROCS;
PX4_SIM_SPEED_FACTOR=10 AUTOSTART_SITL=1 PX4_FIRMWARE_DIR=$PX4_FIRMWARE_DIR HEADLESS=1 build/debug/src/integration_tests/integration_tests_runner --gtest_filter="SitlTest.*"

0 comments on commit 815f492

Please sign in to comment.