diff --git a/.github/workflows/rotors_tests.yml b/.github/workflows/rotors_tests.yml new file mode 100644 index 0000000000..a62525a90f --- /dev/null +++ b/.github/workflows/rotors_tests.yml @@ -0,0 +1,55 @@ +name: RotorS PX4 Build Test + +on: + push: + branches: + - 'master' + pull_request: + branches: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + container: + - 'px4io/px4-dev-simulation-bionic:2020-11-18' # Gazebo 9 + container: + image: ${{ matrix.container }} + options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined + steps: + - uses: actions/checkout@v1 + with: + token: ${{ secrets.ACCESS_TOKEN }} + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::set-output name=timestamp::${current_date}") + - name: ccache cache files + uses: actions/cache@v2 + with: + path: ~/.ccache + key: rotors_tests-RelWithDebInfo-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + restore-keys: rotors_tests-RelWithDebInfo-ccache- + - name: setup ccache + run: | + mkdir -p ~/.ccache + echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf + echo "compression = true" >> ~/.ccache/ccache.conf + echo "compression_level = 5" >> ~/.ccache/ccache.conf + echo "max_size = 100M" >> ~/.ccache/ccache.conf + ccache -s + ccache -z + - name: Install glog + run: apt update && apt install -y libgoogle-glog-dev libyaml-cpp-dev + - name: Build PX4 RotorS + env: + PX4_CMAKE_BUILD_TYPE: RelWithDebInfo + DONT_RUN: 1 + run: make px4_sitl rotors + - name: ccache post-run px4/firmware + run: ccache -s diff --git a/.gitmodules b/.gitmodules index 482fd774ce..b50ff76b1c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -63,3 +63,6 @@ [submodule "src/drivers/uavcannode_gps_demo/libcanard"] path = src/drivers/uavcannode_gps_demo/libcanard url = https://github.com/UAVCAN/libcanard +[submodule "Tools/rotors_simulator"] + path = Tools/rotors_simulator + url = https://github.com/ethz-asl/rotors_simulator.git diff --git a/Tools/rotors_simulator b/Tools/rotors_simulator new file mode 160000 index 0000000000..06fb8b271e --- /dev/null +++ b/Tools/rotors_simulator @@ -0,0 +1 @@ +Subproject commit 06fb8b271ea0f17c7f3c344a2c074a408524cd8f diff --git a/platforms/posix/cmake/sitl_target.cmake b/platforms/posix/cmake/sitl_target.cmake index 0257cbd344..ad1a680cf1 100644 --- a/platforms/posix/cmake/sitl_target.cmake +++ b/platforms/posix/cmake/sitl_target.cmake @@ -85,11 +85,29 @@ ExternalProject_Add(jsbsim_bridge BUILD_ALWAYS 1 ) +px4_add_git_submodule(TARGET git_rotors PATH "${PX4_SOURCE_DIR}/Tools/rotors_simulator") +ExternalProject_Add(rotors_simulator + SOURCE_DIR ${PX4_SOURCE_DIR}/Tools/rotors_simulator/rotors_gazebo_plugins + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DNO_ROS=true + BINARY_DIR ${PX4_BINARY_DIR}/build_rotors + INSTALL_COMMAND "" + DEPENDS + git_rotors + USES_TERMINAL_CONFIGURE true + USES_TERMINAL_BUILD true + EXCLUDE_FROM_ALL true + BUILD_ALWAYS 1 + BUILD_COMMAND ${CMAKE_COMMAND} --build -- -j1 +) + # create targets for each viewer/model/debugger combination set(viewers none jmavsim gazebo + rotors ) set(debuggers @@ -178,6 +196,8 @@ foreach(viewer ${viewers}) add_dependencies(${_targ_name} px4 sitl_gazebo) elseif(viewer STREQUAL "jmavsim") add_dependencies(${_targ_name} px4 git_jmavsim) + elseif(viewer STREQUAL "rotors") + add_dependencies(${_targ_name} px4 rotors_simulator) endif() else() if(viewer STREQUAL "gazebo")