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

Move udp_board and rosflight_firmware to sim package #149

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "rosflight_io/include/rosflight_io/mavlink/v1.0"]
path = rosflight_io/include/rosflight_io/mavlink/v1.0
url = https://github.com/rosflight/mavlink_c_library.git
[submodule "rosflight_firmware/rosflight_firmware"]
path = rosflight_firmware/rosflight_firmware
[submodule "rosflight_sim/include/rosflight_sim/rosflight_firmware"]
path = rosflight_sim/include/rosflight_sim/rosflight_firmware
url = https://github.com/rosflight/rosflight_firmware.git
32 changes: 0 additions & 32 deletions rosflight_firmware/CHANGELOG.rst

This file was deleted.

144 changes: 0 additions & 144 deletions rosflight_firmware/CMakeLists.txt

This file was deleted.

26 changes: 0 additions & 26 deletions rosflight_firmware/package.xml

This file was deleted.

1 change: 0 additions & 1 deletion rosflight_firmware/rosflight_firmware
Submodule rosflight_firmware deleted from 5df075
1 change: 0 additions & 1 deletion rosflight_pkgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<buildtool_depend>ament_cmake</buildtool_depend>

<exec_depend>rosflight_io</exec_depend>
<exec_depend>rosflight_firmware</exec_depend>
<exec_depend>rosflight_msgs</exec_depend>
<exec_depend>rosflight_sim</exec_depend>
<exec_depend>rosflight_utils</exec_depend>
Expand Down
106 changes: 97 additions & 9 deletions rosflight_sim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

add_compile_options(-Wall)
add_compile_options(-Wall -fPIC)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
Expand All @@ -21,44 +21,128 @@ find_package(gazebo_plugins REQUIRED)
find_package(gazebo_ros REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(rosflight_firmware REQUIRED)
find_package(rosflight_msgs REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread)


##############
## Firmware ##
##############

set(FIRMWARE_INCLUDE_DIRS
include/rosflight_sim/rosflight_firmware/include/
include/rosflight_sim/rosflight_firmware/lib/
include/rosflight_sim/rosflight_firmware/comms/
include/rosflight_sim/rosflight_firmware/test/
)

include_directories(
${FIRMWARE_INCLUDE_DIRS}
)

# clone firmware submodule if it is missing
set(FIRMWARE_SUBMODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/rosflight_sim/rosflight_firmware")
if(NOT EXISTS "${FIRMWARE_SUBMODULE_DIR}/.git")
message(STATUS "Firmware submodule not found at ${FIRMWARE_SUBMODULE_DIR}")
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()

# Git information
execute_process(COMMAND git rev-parse --short=8 HEAD
OUTPUT_VARIABLE GIT_VERSION_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/rosflight_firmware)

execute_process(COMMAND git describe --tags --abbrev=8 --always --dirty --long
OUTPUT_VARIABLE GIT_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/rosflight_firmware)

if("${GIT_VERSION_STRING}" STREQUAL "")
set(GIT_VERSION_STRING "undefined")
endif()

if("${GIT_VERSION_HASH}" STREQUAL "")
set(GIT_VERSION_HASH "0")
endif()

# rosflight_firmware
add_library(rosflight_firmware
include/rosflight_sim/rosflight_firmware/src/rosflight.cpp
include/rosflight_sim/rosflight_firmware/src/nanoprintf.cpp
include/rosflight_sim/rosflight_firmware/src/estimator.cpp
include/rosflight_sim/rosflight_firmware/src/mixer.cpp
include/rosflight_sim/rosflight_firmware/src/controller.cpp
include/rosflight_sim/rosflight_firmware/src/param.cpp
include/rosflight_sim/rosflight_firmware/src/state_manager.cpp
include/rosflight_sim/rosflight_firmware/src/rc.cpp
include/rosflight_sim/rosflight_firmware/src/command_manager.cpp
include/rosflight_sim/rosflight_firmware/src/sensors.cpp
include/rosflight_sim/rosflight_firmware/src/comm_manager.cpp

include/rosflight_sim/rosflight_firmware/comms/mavlink/mavlink.cpp

include/rosflight_sim/rosflight_firmware/lib/turbomath/turbomath.cpp
)
target_compile_definitions(rosflight_firmware PUBLIC
GIT_VERSION_HASH=0x${GIT_VERSION_HASH}
GIT_VERSION_STRING=\"${GIT_VERSION_STRING}\"
)
ament_export_targets(rosflight_firmwareTargets HAS_LIBRARY_TARGET)
install(
TARGETS rosflight_firmware
EXPORT rosflight_firmwareTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)


###################
## ROSflight SIL ##
###################

include_directories(include
${ament_INCLUDE_DIRS}
${rclcpp_INLCUDE_DIRS}
${Eigen_INCLUDE_DIRS}
${GAZEBO_INCLUDE_DIRS}
${SDFormat_INCLUDE_DIRS}
)
${Boost_INCLUDE_DIRS}
)
link_directories(${GAZEBO_LIBRARY_DIRS})

add_library(rosflight_sil_plugin SHARED
src/rosflight_sil.cpp
src/sil_board.cpp
src/udp_board.cpp
src/multirotor_forces_and_moments.cpp
src/fixedwing_forces_and_moments.cpp
)
)
target_link_libraries(rosflight_sil_plugin
rosflight_firmware
${rclcpp_INLCUDE_DIRS}
${ament_INCLUDE_DIRS}
${GAZEBO_LIBRARIES}
)
${Boost_LIBRARIES}
)
ament_target_dependencies(rosflight_sil_plugin
rclcpp
geometry_msgs
nav_msgs
rosflight_firmware
rosflight_msgs
gazebo_ros
)
)
ament_export_targets(rosflight_sil_pluginTargets HAS_LIBRARY_TARGET)
ament_export_dependencies(
rclcpp
geometry_msgs
nav_msgs
rosflight_firmware
rosflight_msgs
gazebo_ros
)
Expand All @@ -72,12 +156,16 @@ install(
INCLUDES DESTINATION include
)


#############
## Install ##
#############

install(
DIRECTORY include/${PROJECT_NAME}
DESTINATION include/${PROJECT_NAME}
)

# Install launch files.
install(
DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
Expand Down
1 change: 1 addition & 0 deletions rosflight_sim/include/rosflight_sim/rosflight_firmware
Submodule rosflight_firmware added at 1d20ca
Loading