From 67d2e44317c172bacb851a84115d3e2f8f21752a Mon Sep 17 00:00:00 2001 From: haitomatic Date: Wed, 24 Apr 2024 12:26:56 +0000 Subject: [PATCH] Update readme and change from sitl to hitl for mavlink plugin name --- .github/workflows/build_test.yml | 34 ---------- .github/workflows/firmware_build_test.yml | 76 ----------------------- CMakeLists.txt | 10 +-- README.md | 54 ++++++++-------- setup.bash | 2 +- 5 files changed, 32 insertions(+), 144 deletions(-) delete mode 100644 .github/workflows/build_test.yml delete mode 100644 .github/workflows/firmware_build_test.yml diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml deleted file mode 100644 index 3145680..0000000 --- a/.github/workflows/build_test.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Build Tests - -on: - push: - branches: - - master - pull_request: - branches: - - '*' - -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - container: - - 'px4io/px4-dev-simulation-focal:2021-09-08' # Gazebo 11 - - 'px4io/px4-dev-simulation-bionic:2021-09-08' # Gazebo 9 - container: ${{ matrix.container }} - steps: - - uses: actions/checkout@v1 - - 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 && rm -rf /usr/local/include/mavlink/.git - - name: Install ignition Gazebo - run: apt update && apt install -y ignition-edifice - - name: Cmake Build - run: | - mkdir build - cd build - cmake .. - make diff --git a/.github/workflows/firmware_build_test.yml b/.github/workflows/firmware_build_test.yml deleted file mode 100644 index 00b6e44..0000000 --- a/.github/workflows/firmware_build_test.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Firmware Build Tests - -on: - push: - branches: - - master - pull_request: - branches: - - '*' - -permissions: - contents: read - packages: write - -jobs: - Firmware-build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - config: - - {container: 'px4io/px4-dev-simulation-focal:2021-07-12'} - container: ${{ matrix.config.container }} - steps: - - name: Checkout Firmware master - uses: actions/checkout@v2.3.1 - with: - repository: PX4/Firmware - ref: main - path: Firmware - fetch-depth: 0 - submodules: recurvise - - name: Download MAVSDK - run: wget https://github.com/mavlink/MAVSDK/releases/download/v0.27.0/mavsdk_0.27.0_ubuntu18.04_amd64.deb - - name: Install MAVSDK - run: dpkg -i mavsdk_0.27.0_ubuntu18.04_amd64.deb - - name: Checkout matching branch on PX4/Firmware if possible - run: | - git checkout ${{github.head_ref}} || echo "Firmware branch: ${{github.head_ref}} not found, using master instead" - git submodule update --init --recursive - working-directory: Firmware - - name: Configure Firmware to include current px4-simulation-ignition version - working-directory: Firmware/Tools/simulation-ignition - run: | - git remote set-url origin https://github.com/Auterion/px4-simulation-ignition.git - git fetch origin pull/${{github.event.pull_request.number}}/head:${{github.head_ref}} || echo "Couldn't find the feature branch of the pull request, using default branch" - git checkout ${{github.head_ref}} - - 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: sitl_tests-${{matrix.config.build_type}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} - restore-keys: sitl_tests-${{matrix.config.build_type}}-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 = 6" >> ~/.ccache/ccache.conf - echo "max_size = 400M" >> ~/.ccache/ccache.conf - ccache -s - ccache -z - - name: Build Firmware - working-directory: Firmware - env: - DONT_RUN: 1 - GIT_SUBMODULES_ARE_EVIL: 1 - run: make px4_sitl_default ignition - - name: ccache post-run mavsdk_tests - run: ccache -s diff --git a/CMakeLists.txt b/CMakeLists.txt index c26b42e..5a1c05a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -project(mavlink_sitl_gazebosim) +project(mavlink_hitl_gazebosim) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") @@ -33,9 +33,9 @@ include_directories( ${MAVLINK_INCLUDE_DIRS} ) -add_library(mavlink_sitl_gazebosim SHARED src/gazebo_mavlink_interface.cpp src/mavlink_interface.cpp) -set_property(TARGET mavlink_sitl_gazebosim PROPERTY CXX_STANDARD 17) -target_link_libraries(mavlink_sitl_gazebosim +add_library(mavlink_hitl_gazebosim SHARED src/gazebo_mavlink_interface.cpp src/mavlink_interface.cpp) +set_property(TARGET mavlink_hitl_gazebosim PROPERTY CXX_STANDARD 17) +target_link_libraries(mavlink_hitl_gazebosim PRIVATE ${Boost_LIBRARIES} PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER} PRIVATE gz-sim${GAZEBO_VERSION}::gz-sim${GAZEBO_VERSION} @@ -44,7 +44,7 @@ target_link_libraries(mavlink_sitl_gazebosim include(GNUInstallDirs) install(TARGETS - mavlink_sitl_gazebosim + mavlink_hitl_gazebosim LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/README.md b/README.md index 97e4f5b..214b364 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,35 @@ - -# Ignition Gazebo for MAVLink SITL and HITL -[![Build Tests](https://github.com/Auterion/sitl_ign_gazebo/actions/workflows/build_test.yml/badge.svg)](https://github.com/Auterion/sitl_ign_gazebo/actions/workflows/build_test.yml) +# Gazebo Sim Plugins +## MAVLink plugin for HITL +A Bridge between Gzsim and Px4 in HITL mode via Mavlink -This is a Software-In-The-Loop/Hardware-In-The-Loop simulation environment for the PX4 autopilot project with [Ignition Gazebo](https://ignitionrobotics.org/home) +### Mavlink subscribed messages (from PX4) +| Type | Description | +|---------------------------------|------------------------------------| +| HIL_ACTUATOR_CONTROLS | Actuator control outputs from PX4 | -## Installation +### Mavlink published messages (to PX4) +| Type | Description | +|----------------------|--------------------------------------------------------------------------------------------------------| +| HIL_SENSOR | The IMU readings in SI units in NED body frame, Magnetic field, absolute and differential pressure| +| HIL_STATE_QUATERNION | Used mainly to send gz model pose info| +| HIL_GPS | The global position, as returned by the Global Positioning System (GPS). This is NOT the global position estimate of the system, but rather a RAW sensor value. Send now mainly to give home GPS coordinate to PX4| -Follow instructions on the [official site](http://gazebosim.org/tutorials?cat=install) to install Gazebo. -``` -sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' -wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - -apt update -apt install ignition-edifice -``` +### Gz subscribed topics (from Gzsim) +| Topic name | Type | Description | +|----------------------------------------|------------------|--------------------------------------------| +| /link/base_link/sensor/imu_sensor/imu | gz::msgs::IMU | IMU sensor data | +| /pose/info | gz::msgs::Pose_V | Position and orientation vector of a model | -## Running the simulation -The simulation can be run using the following command at the root of the [PX4/PX4-Autopilot](https://github.com/PX4/PX4-Autopilot) repository -``` -make px4_sitl ignition -``` -For more instructions when running the simulation with PX4, follow the [documentation](http://docs.px4.io/master/en/simulation/ignition_gazebo.html) +### Gzsim plugins affected +| Plugin name | Description | +|-----------------------------------------|--------------------------------------------------------------------------| +| gz::sim::systems::MulticopterMotorModel | This system applies a thrust force to models with spinning propellers | + + + +## ABC plugin for HITL/SITL -## Creation and install of debian package on Linux -This creates a debian package and installs the plugins to /usr/lib on Linux. To use this package you must add /usr/lib to IGN_GAZEBO_SYSTEM_PLUGIN_PATH. -``` -mkdir build -cd build -cmake .. -make -cpack -G DEB -sudo dpkg -i *.deb -``` diff --git a/setup.bash b/setup.bash index e211941..d704878 100644 --- a/setup.bash +++ b/setup.bash @@ -1,5 +1,5 @@ # !/bin/bash export GZ_GAZEBO_SYSTEM_PLUGIN_PATH=/usr/lib -#export GZ_SIM_RESOURCE_PATH=$GZ_GAZEBO_RESOURCE_PATH:$1/Tools/sitl_ign_gazebo/models +#export GZ_SIM_RESOURCE_PATH=$GZ_GAZEBO_RESOURCE_PATH:$1/Tools/hitl_ign_gazebo/models