Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgz-sim7-dev #28

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5a0614e
JSON: initial steps to convert ardupilot_gazebo to use the SITL JSON …
srmainwaring Jan 19, 2021
ee0bc5d
JSON: add stand alone example to test SITL JSON socket interface
srmainwaring Jan 20, 2021
28a77b7
JSON: update add c++ socket example
srmainwaring Jan 21, 2021
af6ed39
JSON: update ArduPilotPlugin to use the SITL JSON interface
srmainwaring Jan 21, 2021
9cfdca0
JSON: replace jsoncpp with rapidjson
srmainwaring Jan 22, 2021
c281221
JSON: update socket timeout in ArduPilotPlugin
srmainwaring Jan 22, 2021
e5ee968
JSON: refactor param names, move loading of sensor params to separate…
srmainwaring Jan 23, 2021
930c9e2
JSON: enable check for STIL JSON protocol magic
srmainwaring Jan 23, 2021
c8154eb
JSON: update class documentation
srmainwaring Jan 23, 2021
a4379cb
JSON: additional checks for frame ordering and frame synchronisation
srmainwaring Jan 23, 2021
666163c
JSON: revert the deprecation of the fdm_port_in parameter
srmainwaring Jan 24, 2021
860f599
Models: remove the xml namespace from the iris model <sdf> element
srmainwaring Jan 24, 2021
1f5a851
JSON: add optional servo limits params to each servo controller
srmainwaring Jan 27, 2021
7c02d89
JSON: update CMakeLists.txt
srmainwaring Feb 23, 2021
c42e626
JSON: add install instructions
srmainwaring Feb 23, 2021
1f66d6f
JSON: remove socket and JSON examples
srmainwaring Apr 27, 2021
201509d
[IGN] migrate plugin using the json backend to ignition-edifice
srmainwaring Aug 23, 2021
fc7b7f7
[IGN] ensure the imu name is captured correctly
srmainwaring Aug 23, 2021
dc5a49b
[IGN] update iris_with_standoffs model to use additional sdf params f…
srmainwaring Aug 23, 2021
db7d05a
[IGN] update iris_with_standoffs model to use force controlled joints
srmainwaring Sep 14, 2021
9ac286e
[IGN] remove commented code and adjust formatting
srmainwaring Sep 14, 2021
81ec53b
[Iris] update colours for quadcopter model
srmainwaring Sep 14, 2021
fd00f11
[Zephyr] add zephyr plane model and demo world (#1)
srmainwaring Sep 16, 2021
49a5e52
[IGN] update the frame conversion calculation to use pose composition…
srmainwaring Sep 20, 2021
cda31ad
[Iris] add example for Iris based upon the edifice-demo depot world (#4)
srmainwaring Sep 20, 2021
56a6faf
[IGN] bug fix - last controller update time should not be updated if …
srmainwaring Sep 22, 2021
3b0dc18
Add support for lock-step simulation (#6)
srmainwaring Sep 22, 2021
e407fad
Forward port to support ignition garden: ignition-gazebo5 to ignition…
srmainwaring Nov 5, 2021
28e6a01
Forward port ignition-edifice -> ignition-garden
tridge Dec 2, 2021
9f6330d
Ensure the model base link is set to the correct model
srmainwaring Jan 18, 2022
b5aa171
Remove unused includes
clydemcqueen Mar 14, 2022
bb2ce98
Update comment for Ignition Gazebo
clydemcqueen Mar 18, 2022
fe01601
Fix: use copied imuMsg
clydemcqueen Mar 18, 2022
bf9af69
Readme: re init readme
khancyr Jan 21, 2022
3d4c781
IrlockPluging: fix port as per https://github.com/khancyr/ardupilot_g…
khancyr Feb 25, 2022
aaffdc0
Add COMMAND control type (#18)
srmainwaring Mar 31, 2022
65dded5
IGN -> GZ (#27)
ahcorde Aug 16, 2022
9c1d365
libgz-sim7-dev
Rezenders Oct 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ qtcreator-*
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# Catch everything
.idea/
.cmake-build-*

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
Expand Down
195 changes: 37 additions & 158 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,170 +1,49 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

#============================================================================
# Initialize the project
#============================================================================
project(ardupilot_sitl_gazebo)

#------------------------------------------------------------------------
# Compile as C++14

#######################
## Find Dependencies ##
#######################

find_package(gazebo REQUIRED)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")

if("${GAZEBO_VERSION}" VERSION_LESS "8.0")
message(FATAL_ERROR "You need at least Gazebo 8.0. Your version: ${GAZEBO_VERSION}")
else()
message("Gazebo version: ${GAZEBO_VERSION}")
endif()

###### COMPILE RULES ######
include(CheckCXXCompilerFlag)

macro(filter_valid_compiler_flags)
foreach(flag ${ARGN})
CHECK_CXX_COMPILER_FLAG(${flag} R${flag})
if(${R${flag}})
set(VALID_CXX_FLAGS "${VALID_CXX_FLAGS} ${flag}")
endif()
endforeach()
endmacro()

set(CMAKE_CXX_EXTENSIONS off) # see gazebo CMakeList

if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo Profile Check" FORCE)
endif (NOT CMAKE_BUILD_TYPE)

# Build type link flags
set (CMAKE_LINK_FLAGS_RELEASE " " CACHE INTERNAL "Link flags for release" FORCE)
set (CMAKE_LINK_FLAGS_RELWITHDEBINFO " " CACHE INTERNAL "Link flags for release with debug support" FORCE)
set (CMAKE_LINK_FLAGS_DEBUG " " CACHE INTERNAL "Link flags for debug" FORCE)
set (CMAKE_LINK_FLAGS_PROFILE " -pg" CACHE INTERNAL "Link flags for profile" FORCE)
set (CMAKE_LINK_FLAGS_COVERAGE " --coverage" CACHE INTERNAL "Link flags for static code coverage" FORCE)

set (CMAKE_C_FLAGS_RELEASE "")
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT MSVC)
# -s doesn't work with clang or Visual Studio, see alternative in link below:
# http://stackoverflow.com/questions/6085491/gcc-vs-clang-symbol-strippingu
set (CMAKE_C_FLAGS_RELEASE "-s")
endif()

if (NOT MSVC)
set (CMAKE_C_FLAGS_RELEASE " ${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for release" FORCE)
set (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})

set (CMAKE_C_FLAGS_RELWITHDEBINFO " -g -O2 ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for release with debug support" FORCE)
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})

set (CMAKE_C_FLAGS_DEBUG " -ggdb3 ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for debug" FORCE)
set (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})

set (CMAKE_C_FLAGS_PROFILE " -fno-omit-frame-pointer -g -pg ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for profile" FORCE)
set (CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})

set (CMAKE_C_FLAGS_COVERAGE " -g -O0 -Wformat=2 --coverage -fno-inline ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for static code coverage" FORCE)
set (CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE}")
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# -fno-default-inline -fno-implicit-inline-templates are unimplemented, cause errors in clang
# -fno-elide-constructors can cause seg-faults in clang 3.4 and earlier
# http://llvm.org/bugs/show_bug.cgi?id=12208
set (CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -fno-default-inline -fno-implicit-inline-templates -fno-elide-constructors")
endif()
endif()

#####################################
# Set all the global build flags
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")

# Compiler-specific C++11 activation.
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (NOT (GCC_VERSION VERSION_GREATER 4.7))
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.8 or greater.")
endif ()
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION)
if (NOT (CLANG_VERSION VERSION_GREATER 3.2))
message(FATAL_ERROR "${PROJECT_NAME} requires clang 3.3 or greater.")
endif ()

if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif ()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
if (MSVC_VERSION LESS 1800)
message(FATAL_ERROR "${PROJECT_NAME} requires VS 2013 or greater.")
endif ()
else ()
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
endif ()

set(WARN_LEVEL "-Wall")
filter_valid_compiler_flags(${WARN_LEVEL}
-Wextra -Wno-long-long -Wno-unused-value -Wfloat-equal -Wshadow
-Wswitch-default -Wmissing-include-dirs -pedantic)
if (UNIX AND NOT APPLE)
filter_valid_compiler_flags(-fvisibility=hidden -fvisibility-inlines-hidden)
endif()

set(UNFILTERED_FLAGS "-std=c++14")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VALID_CXX_FLAGS} ${UNFILTERED_FLAGS}")

###########
## Build ##
###########

include_directories(
${PROJECT_SOURCE_DIR}
include
${GAZEBO_INCLUDE_DIRS}
)

link_libraries(
${GAZEBO_LIBRARIES}
)

link_directories(
${GAZEBO_LIBRARY_DIRS}
)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set (plugins_single_header
ArduPilotPlugin
ArduCopterIRLockPlugin
GimbalSmall2dPlugin
)
#============================================================================
# Find gz-cmake
#============================================================================
find_package(gz-cmake3 3.0.0 REQUIRED)
set(GZ_CMAKE_VER ${gz-cmake3_VERSION_MAJOR})

add_library(ArduCopterIRLockPlugin SHARED src/ArduCopterIRLockPlugin.cc)
target_link_libraries(ArduCopterIRLockPlugin ${GAZEBO_LIBRARIES})
#============================================================================
# Search for project-specific dependencies
#============================================================================

add_library(ArduPilotPlugin SHARED src/ArduPilotPlugin.cc)
target_link_libraries(ArduPilotPlugin ${GAZEBO_LIBRARIES})
#--------------------------------------
# Find gz-sim
gz_find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})

if("${GAZEBO_VERSION}" VERSION_LESS "8.0")
add_library(GimbalSmall2dPlugin SHARED src/GimbalSmall2dPlugin.cc)
target_link_libraries(GimbalSmall2dPlugin ${GAZEBO_LIBRARIES})
install(TARGETS GimbalSmall2dPlugin DESTINATION ${GAZEBO_PLUGIN_PATH})
endif()
#--------------------------------------
# Find RapidJSON
find_package(RapidJSON REQUIRED)

install(TARGETS ArduCopterIRLockPlugin DESTINATION ${GAZEBO_PLUGIN_PATH})
install(TARGETS ArduPilotPlugin DESTINATION ${GAZEBO_PLUGIN_PATH})
#======================================
# Build plugin

install(DIRECTORY models DESTINATION ${GAZEBO_MODEL_PATH}/..)
install(DIRECTORY worlds DESTINATION ${GAZEBO_MODEL_PATH}/..)
add_library(ArduPilotPlugin
SHARED
src/ArduPilotPlugin.cc
src/Socket.cpp
)

# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
target_include_directories(ArduPilotPlugin PUBLIC
include
${GZ-SIM_INCLUDE_DIRS}
)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
target_link_libraries(ArduPilotPlugin PUBLIC
${GZ-SIM_LIBRARIES}
)
Loading