Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/integration' into rtk
Browse files Browse the repository at this point in the history
  • Loading branch information
umroverPerception committed Mar 31, 2024
2 parents 14c6ffe + edec4e7 commit 02ec01e
Show file tree
Hide file tree
Showing 332 changed files with 131,533 additions and 4,677 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
url = https://dawn.googlesource.com/dawn
shallow = true
branch = chromium/6108
[submodule "deps/emsdk"]
path = deps/emsdk
url = [email protected]:emscripten-core/emsdk.git
shallow = true
branch = 3.1.53
[submodule "deps/manif"]
path = deps/manif
url = https://github.com/artivis/manif.git
shallow = true
branch = devel
82 changes: 56 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
cmake_minimum_required(VERSION 3.16)
project(mrover VERSION 2024.0.0 LANGUAGES CXX)

option(MROVER_IS_CI "Build for CI" OFF)
option(MROVER_RUN_CLANG_TIDY "Run clang-tidy" OFF)
option(MROVER_IS_JETSON "Build for the Jetson" OFF)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Generate compile_commands.json for clangd

### ============= ###
### OS & Compiler ###
### ============= ###

if (APPLE)
# Ensures that homebrew packages are never used over miniforge packages
set(CMAKE_IGNORE_PATH /opt/homebrew)
Expand All @@ -15,23 +27,30 @@ if (APPLE)
link_libraries(fmt::fmt)
else ()
# TODO(quintin): Fix this
find_package(TBB REQUIRED)
link_libraries(TBB::tbb)
find_package(TBB QUIET)
if (TBB_FOUND)
link_libraries(TBB::tbb)
endif ()
endif ()

include_directories(BEFORE SYSTEM src/preload)
if (NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # Link with LLVM lld instead of GNU ld when using Clang on Linux, it is faster
add_link_options(-fuse-ld=lld)
endif ()

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Generate compile_commands.json for clangd
if (NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_link_options(-fuse-ld=lld) # LLVM lld is faster than GNU ld
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(MROVER_CPP_COMPILE_OPTIONS -Wall -Wextra -pedantic -Wno-missing-field-initializers)
if (MROVER_IS_CI) # Make warnings errors in CI
list(APPEND MROVER_CPP_COMPILE_OPTIONS -Werror)
endif ()
endif ()
set(MROVER_CPP_COMPILE_OPTIONS -Wall -Wextra -pedantic)
if (MROVER_CI)
list(APPEND MROVER_CPP_COMPILE_OPTIONS -Werror)

if (MROVER_IS_JETSON)
add_definitions(-DMROVER_IS_JETSON)
endif ()

# Inject header files that get included before anything else, including system headers
include_directories(BEFORE SYSTEM src/preload)

include(cmake/macros.cmake)

# ROS packages list
Expand Down Expand Up @@ -125,17 +144,15 @@ target_link_libraries(lie PUBLIC MANIF::manif)
## ESW

if (NOT APPLE)
mrover_add_vendor_header_only_library(moteus src/esw/mjbots)
mrover_add_vendor_header_only_library(moteus deps/mjbots)
mrover_add_header_only_library(can_device src/esw/can_device)
mrover_add_library(motor_library src/esw/motor_library/*.cpp src/esw/motor_library)
target_link_libraries(motor_library PUBLIC can_device moteus)

if (NetLink_FOUND AND NetLinkRoute_FOUND)
mrover_add_nodelet(can_driver src/esw/can_driver/*.cpp src/esw/can_driver src/esw/can_driver/pch.hpp)
mrover_nodelet_link_libraries(can_driver nl-3 nl-route-3)
# TODO(quintin): Fix this CMake hard coding
#mrover_nodelet_link_libraries(can ${NetLink_LIBRARIES} ${NetLinkRoute_LIBRARIES}})
mrover_nodelet_include_directories(can_driver /usr/include/libnl3)
mrover_nodelet_link_libraries(can_driver ${NetLink_LIBRARIES} ${NetLinkRoute_LIBRARIES})
mrover_nodelet_include_directories(can_driver ${NetLink_INCLUDE_DIRS} ${NetLinkRoute_INCLUDE_DIRS})
endif ()

macro(mrover_add_esw_bridge_node name sources)
Expand All @@ -151,27 +168,41 @@ if (NOT APPLE)
mrover_add_esw_bridge_node(led src/esw/led/*.cpp)
mrover_add_esw_bridge_node(mast_gimbal_bridge src/esw/mast_gimbal_bridge/*.cpp)
mrover_add_esw_bridge_node(pdb_bridge src/esw/pdb_bridge/*.cpp)
# mrover_add_esw_bridge_node(sa_bridge src/esw/sa_translator_bridge/*.cpp)
mrover_add_esw_bridge_node(sa_hw_bridge src/esw/sa_hw_bridge/*.cpp)
mrover_add_esw_bridge_node(sa_translator_bridge src/esw/sa_translator_bridge/*.cpp)
mrover_add_esw_bridge_node(science_bridge src/esw/science_bridge/*.cpp)
mrover_add_esw_bridge_node(brushless_test_bridge src/esw/brushless_test_bridge/*.cpp motor_library)
mrover_add_esw_bridge_node(brushed_test_bridge src/esw/brushed_test_bridge/*.cpp)
mrover_add_esw_bridge_node(test_arm_bridge src/esw/test_arm_bridge/*.cpp)
mrover_add_esw_bridge_node(pdb_test_bridge src/esw/pdb_test_bridge/*.cpp)
mrover_add_esw_bridge_node(arm_position_test_bridge src/esw/arm_position_test_bridge/*.cpp)
# mrover_add_esw_bridge_node(sa_sensor src/esw/fw/dirt_sensor/dirt_sensor_ros/dirt_sensor_ros.ino)
endif ()

## Perception

mrover_add_nodelet(tag_detector src/perception/tag_detector/*.cpp src/perception/tag_detector src/perception/tag_detector/pch.hpp)
mrover_nodelet_link_libraries(tag_detector opencv_core opencv_objdetect opencv_aruco opencv_imgproc opencv_highgui lie)
mrover_add_library(websocket_server src/esw/websocket_server/*.cpp src/esw/websocket_server)
target_compile_definitions(websocket_server PUBLIC BOOST_ASIO_NO_DEPRECATED)

mrover_add_nodelet(zed_tag_detector src/perception/tag_detector/zed/*.cpp src/perception/tag_detector/zed src/perception/tag_detector/zed/pch.hpp)
mrover_nodelet_link_libraries(zed_tag_detector opencv_core opencv_objdetect opencv_aruco opencv_imgproc lie)

mrover_add_nodelet(long_range_tag_detector src/perception/tag_detector/long_range_cam/*.cpp src/perception/tag_detector/long_range_cam src/perception/tag_detector/long_range_cam/pch.hpp)
mrover_nodelet_link_libraries(long_range_tag_detector opencv_core opencv_objdetect opencv_aruco opencv_imgproc lie)

mrover_add_nodelet(usb_camera src/perception/usb_camera/*.cpp src/perception/usb_camera src/perception/usb_camera/pch.hpp)
mrover_nodelet_link_libraries(usb_camera opencv_core opencv_objdetect opencv_aruco opencv_imgproc opencv_highgui)

if (CUDA_FOUND)
mrover_add_library(streaming src/esw/streaming/*.c* src/esw/streaming)
# target_link_libraries(streaming PUBLIC opencv_core opencv_cudacodec)
target_link_libraries(streaming PUBLIC cuda nvidia-encode opencv_core)
target_include_directories(streaming SYSTEM PUBLIC deps/nvenc)
target_compile_definitions(streaming PUBLIC BOOST_ASIO_NO_DEPRECATED)
# mrover_add_node(nv_vid_codec_h265_enc src/esw/nv_vid_codec_h265_enc/*.c*)
# target_link_libraries(nv_vid_codec_h265_enc PUBLIC cuda nvidia-encode opencv_core opencv_imgproc streaming)
# target_include_directories(nv_vid_codec_h265_enc SYSTEM PUBLIC deps/nvenc)
endif ()

mrover_add_nodelet(gst_websocket_streamer src/esw/gst_websocket_streamer/*.c* src/esw/gst_websocket_streamer src/esw/gst_websocket_streamer/pch.hpp)
mrover_nodelet_link_libraries(gst_websocket_streamer PRIVATE websocket_server ${Gst_LIBRARIES} ${GstApp_LIBRARIES})
mrover_nodelet_include_directories(gst_websocket_streamer ${Gst_INCLUDE_DIRS} ${GstApp_INCLUDE_DIRS})

if (ZED_FOUND)
mrover_add_nodelet(object_detector src/perception/object_detector/*.c* src/perception/object_detector src/perception/object_detector/pch.hpp)
mrover_nodelet_link_libraries(object_detector PRIVATE opencv_core opencv_dnn opencv_imgproc lie nvinfer nvonnxparser tbb)
Expand All @@ -195,6 +226,7 @@ endif ()
## Teleoperation

mrover_add_node(arm_controller src/teleoperation/arm_controller/*.cpp)
target_link_libraries(arm_controller PRIVATE lie)

## Simulator

Expand All @@ -205,8 +237,6 @@ if (MROVER_BUILD_SIM)
mrover_nodelet_defines(simulator BOOST_THREAD_PROVIDES_FUTURE)
endif ()

# TODO

### ======= ###
### Testing ###
### ======= ###
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ADD --chown=mrover:mrover ./pkg ./pkg
RUN ./ansible.sh ci.yml

USER root
RUN apt-get purge ansible -y && apt-get autoremove -y
# Remove apt cache to free up space in the image
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/basestation_networks/files/networking_setup_basestation.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh

export ROS_MASTER_URI=http://10.0.0.10:11311
export ROS_IP=10.0.0.2
export ROS_MASTER_URI=http://10.1.0.10:11311
export ROS_IP=10.1.0.2
4 changes: 2 additions & 2 deletions ansible/roles/basestation_networks/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
type: ethernet
ifname: "{{ ifname }}"
autoconnect: yes
ip4: 10.0.0.2/8
ip4: 10.1.0.2/8
# Share connection to the Internet
method4: shared
method6: disabled
Expand All @@ -15,5 +15,5 @@
community.general.ssh_config:
user: "{{ ansible_user_id }}"
host: jetson
hostname: 10.0.0.10
hostname: 10.1.0.10
remote_user: mrover
2 changes: 1 addition & 1 deletion ansible/roles/build/files/profiles/ci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cmake_args:
- -DCMAKE_CXX_FLAGS=-pipe
- -DCMAKE_CXX_COMPILER=clang++-16
- -DCMAKE_CUDA_HOST_COMPILER=clang++-16
- -DMROVER_CI=ON
- -DMROVER_IS_CI=ON
- -Wno-dev
devel_layout: linked
devel_space: devel
Expand Down
10 changes: 10 additions & 0 deletions ansible/roles/build/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
- libnl-route-3-dev
- libtbb-dev
- libopencv-dev
- libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev

- name: Install Local APT Packages
become: True
Expand Down Expand Up @@ -188,6 +190,14 @@
link: /usr/bin/lld
priority: 160

- name: Set clang-tidy 16 as Default
become: True
alternatives:
name: clang-tidy
path: /usr/bin/clang-tidy-16
link: /usr/bin/clang-tidy
priority: 160

- name: Setup Python Virtual Environment
pip:
name:
Expand Down
10 changes: 10 additions & 0 deletions ansible/roles/ci/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
- libnl-route-3-dev
- libtbb-dev
- libopencv-dev
- libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev

- name: Install Local APT Packages
become: True
Expand Down Expand Up @@ -173,6 +175,14 @@
link: /usr/bin/lld
priority: 160

- name: Set clang-tidy 16 as Default
become: True
alternatives:
name: clang-tidy
path: /usr/bin/clang-tidy-16
link: /usr/bin/clang-tidy
priority: 160

- name: Setup Python Virtual Environment
pip:
name:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

export ROS_IP=10.0.0.10
export ROS_IP=10.1.0.10
6 changes: 3 additions & 3 deletions ansible/roles/jetson_networks/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
type: ethernet
ifname: eth0
autoconnect: yes
ip4: 10.0.0.10/8
gw4: 10.0.0.2
dns4: [10.0.0.2]
ip4: 10.1.0.10/8
gw4: 10.1.0.2
dns4: [10.1.0.2]
method6: disabled
33 changes: 15 additions & 18 deletions cmake/deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,32 @@ else ()
else ()
set(WEBGPU_SHARED_LIB ${WEBGPU_BUILD_DIR}/src/dawn/native/libwebgpu_dawn.so)
endif ()
if (NOT EXISTS ${WEBGPU_SHARED_LIB})
message(FATAL_ERROR "Dawn not found. If on Ubuntu install with 'sudo apt install -f ./pkg/dawn.deb'. Or build from source with ./scripts/build_dawn.sh")
endif ()
target_include_directories(webgpu INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../deps/dawn/include ${WEBGPU_BUILD_DIR}/gen/include)
set_property(TARGET webgpu PROPERTY IMPORTED_LOCATION ${WEBGPU_SHARED_LIB})
if (EXISTS ${WEBGPU_SHARED_LIB})
target_include_directories(webgpu INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../deps/dawn/include ${WEBGPU_BUILD_DIR}/gen/include)
set_property(TARGET webgpu PROPERTY IMPORTED_LOCATION ${WEBGPU_SHARED_LIB})

set(dawn_FOUND TRUE)
set(dawn_FOUND TRUE)
else ()
message(WARNING "Dawn not found. If on Ubuntu install with 'sudo apt install -f ./pkg/libdawn-dev.deb'. Or build from source with ./scripts/build_dawn.sh")
endif ()
endif ()

option(MROVER_BUILD_SIM "Build the simulator" ${dawn_FOUND})

if (MROVER_BUILD_SIM)
# Apparently Assimp has different names on different systems
# find_package is case-sensitive so try both
find_package(Assimp QUIET)
find_package(assimp QUIET)
if (NOT Assimp_FOUND AND NOT assimp_FOUND)
find_package(Assimp NAMES Assimp assimp QUIET)
if (NOT Assimp_FOUND)
message(FATAL_ERROR "Assimp not found")
endif ()

find_package(Bullet REQUIRED)
find_package(glfw3 REQUIRED)

add_subdirectory(deps/glfw3webgpu SYSTEM)
add_subdirectory(deps/imgui SYSTEM)
add_subdirectory(deps/webgpuhpp SYSTEM)

set_target_properties(glfw3webgpu PROPERTIES CXX_CLANG_TIDY "")
set_target_properties(imgui PROPERTIES CXX_CLANG_TIDY "")
set_target_properties(webgpu_hpp PROPERTIES CXX_CLANG_TIDY "")
add_subdirectory(deps/glfw3webgpu SYSTEM EXCLUDE_FROM_ALL)
add_subdirectory(deps/imgui SYSTEM EXCLUDE_FROM_ALL)
add_subdirectory(deps/webgpuhpp SYSTEM EXCLUDE_FROM_ALL)
endif ()

find_package(OpenCV REQUIRED)
Expand All @@ -52,14 +48,15 @@ if (NOT manif_FOUND)
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/../deps/manif/include/manif)
add_subdirectory(deps/manif SYSTEM)
add_library(MANIF::manif ALIAS manif)
set_target_properties(manif PROPERTIES CXX_CLANG_TIDY "")

set(manif_FOUND TRUE)
else ()
message(WARNING "Manif not found. If on Ubuntu install with 'sudo apt install -f ./pkg/manif.deb'. Or build from source with 'submodule update --init deps/manif' and make sure it is non-empty")
message(FATAL_ERROR "Manif not found. If on Ubuntu install with 'sudo apt install -f ./pkg/libmanif-dev.deb'. Or build from source with 'submodule update --init deps/manif' and make sure it is non-empty")
endif ()
endif ()

find_package(PkgConfig REQUIRED)
pkg_search_module(NetLink libnl-3.0 QUIET)
pkg_search_module(NetLinkRoute libnl-route-3.0 QUIET)
pkg_search_module(Gst gstreamer-1.0 QUIET)
pkg_search_module(GstApp gstreamer-app-1.0 QUIET)
4 changes: 4 additions & 0 deletions cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ macro(target_rosify target)
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

if (MROVER_RUN_CLANG_TIDY)
set_target_properties(${target} PROPERTIES CXX_CLANG_TIDY clang-tidy)
endif ()
endmacro()

macro(mrover_add_library name sources includes)
Expand Down
16 changes: 8 additions & 8 deletions config/ekf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ global_ekf:
publish_tf: true

# odom frame off
# map_frame: none
# odom_frame: map
# base_link_frame: base_link
# world_frame: map

# odom frame on
map_frame: map
odom_frame: odom
map_frame: none
odom_frame: map
base_link_frame: base_link
world_frame: map

# odom frame on
# map_frame: map
# odom_frame: odom
# base_link_frame: base_link
# world_frame: map

# IMU accel and gyro
# imu0: imu/imu_only

Expand Down
Loading

0 comments on commit 02ec01e

Please sign in to comment.