Skip to content

Commit

Permalink
merged integration into branch
Browse files Browse the repository at this point in the history
  • Loading branch information
nehakankanala committed Apr 2, 2024
2 parents 66652e1 + 262ccf9 commit e4ae239
Show file tree
Hide file tree
Showing 1,024 changed files with 713,888 additions and 185,557 deletions.
12 changes: 11 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
text=auto
# Image files
*.png filter=lfs diff=lfs merge=lfs -text
# Model files
*.dae filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.stl filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
# Neural network files
*.pt filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.engine filter=lfs diff=lfs merge=lfs -text
# Model files
*.glb filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
# Packages
*.deb filter=lfs diff=lfs merge=lfs -text
# Program files
ansible/roles/esw/files/bin/fdcanusb_daemon filter=lfs diff=lfs merge=lfs -text
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- master
- integration
push:
branches:
- master
Expand All @@ -22,7 +23,7 @@ jobs:
# This makes sure that $GITHUB_WORKSPACE is the catkin workspace path
path: "src/mrover"
- name: Ensure Python Requirements
run: . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && pip install -e "$GITHUB_WORKSPACE/src/mrover[dev]"
run: . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && pip install --no-cache-dir -e "$GITHUB_WORKSPACE/src/mrover[dev]"
- name: Style Check
run: . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && cd $GITHUB_WORKSPACE/src/mrover/ && ./style.sh
- name: Update ROS APT
Expand All @@ -37,9 +38,12 @@ jobs:
- name: Initialize
if: github.event.pull_request.draft == false
run: . /opt/ros/noetic/setup.sh && catkin init && catkin profile set ci
- name: Build
if: github.event.pull_request.draft == false
- name: Build Without Clang Tidy
if: github.event.pull_request.draft == false && github.event.pull_request.base.ref != 'refs/heads/master'
run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && catkin build
- name: Build With Clang Tidy
if : github.event_name == 'push' && github.event.pull_request.base.ref == 'refs/heads/master'
run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && catkin build -DCMAKE_CXX_CLANG_TIDY=clang-tidy-16
- name: Test
if: github.event.pull_request.draft == false
run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && . $GITHUB_WORKSPACE/devel/setup.sh && catkin test -j1
run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && . $GITHUB_WORKSPACE/devel/setup.sh && catkin test && rostest mrover integration.test --text
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ yarn.lock*
yarn-error.log*
bun.lock*
package-lock.json*
db.sqlite3

# Bag Files
/bags/
Expand Down
13 changes: 12 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
[submodule "deps/libde265"]
path = deps/libde265
url = git@github.com:strukturag/libde265.git
url = https://github.com/strukturag/libde265.git
shallow = true
branch = v1.0.15
[submodule "deps/dawn"]
path = deps/dawn
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
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@
"python.analysis.typeCheckingMode": "off",
//// Miscellaneous
"redhat.telemetry.enabled": false,
"editor.formatOnSave": true,
"git.ignoreSubmodules": true,
"git.detectSubmodules": false,
"cSpell.words": [
"Eigen",
"GLFW",
"wgpu"
],
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"deps/dawn": true,
},
"python.autoComplete.extraPaths": [
"/home/eric/catkin_ws/devel/lib/python3/dist-packages",
"/opt/ros/noetic/lib/python3/dist-packages"
]
}
142 changes: 83 additions & 59 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,24 +27,29 @@ 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 ()

option(MROVER_BUILD_SIM "Build the simulator" ON)
# Inject header files that get included before anything else, including system headers
include_directories(BEFORE SYSTEM src/preload)

include(cmake/macros.cmake)

Expand Down Expand Up @@ -63,6 +80,7 @@ set(MROVER_MESSAGE_DEPENDENCIES

set(MROVER_PARAMETERS
config/DetectorParams.cfg
config/ObjectDetectorParams.cfg
)

set(MROVER_CMAKE_INCLUDES
Expand All @@ -73,29 +91,8 @@ set(MROVER_CMAKE_INCLUDES
### Dependencies ###
### ============ ###

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)
message(FATAL_ERROR "Assimp not found")
endif ()

find_package(Bullet REQUIRED)

find_package(glfw3 REQUIRED)

include(cmake/webgpu.cmake)
include(cmake/deps.cmake)

add_subdirectory(deps/glfw3webgpu)
endif ()
find_package(OpenCV REQUIRED)
find_package(ZED QUIET)
find_package(Eigen3 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_search_module(NetLink libnl-3.0)
pkg_search_module(NetLinkRoute libnl-route-3.0)
if (ZED_FOUND)
# Anything newer than C++17 combined with libstdc++13 is not supported just yet by NVCC (the CUDA compiler)
set(CMAKE_CUDA_STANDARD 17)
Expand Down Expand Up @@ -142,20 +139,21 @@ catkin_package()
## Libraries

mrover_add_library(lie src/util/lie/*.cpp src/util/lie)
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)

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)
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 ${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)
mrover_add_node(${name} ${sources})
Expand All @@ -167,29 +165,55 @@ if (NOT APPLE)
mrover_add_esw_bridge_node(cache_bridge src/esw/cache_bridge/*.cpp)
mrover_add_esw_bridge_node(drive_bridge src/esw/drive_bridge/*.cpp)
mrover_add_esw_bridge_node(led_hw_bridge src/esw/led_hw_bridge/*.cpp)
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_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)

# 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)
# endif ()
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_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)
mrover_nodelet_defines(object_detector
__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ # Eigen includes some files it should not, ignore
)
# TODO(john): Update object detector to use new API
target_compile_options(object_detector_nodelet PRIVATE -Wno-deprecated-declarations)
# Temporary
mrover_nodelet_link_libraries(object_detector PRIVATE opencv_imgcodecs opencv_highgui)

mrover_add_nodelet(zed src/perception/zed_wrapper/*.c* src/perception/zed_wrapper src/perception/zed_wrapper/pch.hpp)
mrover_nodelet_include_directories(zed ${ZED_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS})
mrover_nodelet_link_libraries(zed ${ZED_LIBRARIES} ${SPECIAL_OS_LIBS} lie)
Expand All @@ -202,18 +226,17 @@ endif ()
## Teleoperation

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

## Simulator

if (MROVER_BUILD_SIM)
mrover_add_nodelet(simulator src/simulator/*.cpp src/simulator src/simulator/pch.hpp)
mrover_nodelet_include_directories(simulator ${ASSIMP_INCLUDE_DIRS} ${BULLET_INCLUDE_DIRS} ${OPENCV_INCLUDE_DIRS} src/simulator/imgui)
mrover_nodelet_link_libraries(simulator ${ASSIMP_LIBRARIES} ${BULLET_LIBRARIES} glfw3webgpu webgpu glfw opencv_core opencv_imgcodecs opencv_imgproc lie)
mrover_nodelet_include_directories(simulator ${ASSIMP_INCLUDE_DIRS} ${BULLET_INCLUDE_DIRS} ${OPENCV_INCLUDE_DIRS})
mrover_nodelet_link_libraries(simulator ${ASSIMP_LIBRARIES} ${BULLET_LIBRARIES} glfw3webgpu webgpu glfw opencv_core opencv_imgcodecs opencv_imgproc webgpu_hpp imgui lie)
mrover_nodelet_defines(simulator BOOST_THREAD_PROVIDES_FUTURE)
endif ()

# TODO

### ======= ###
### Testing ###
### ======= ###
Expand All @@ -223,15 +246,16 @@ catkin_add_gtest(example-cpp-test test/example/cpp_test.cpp)

# Python unit tests
catkin_add_nosetests(test/navigation/drive_test.py)
catkin_add_nosetests(test/teleop/teleop_test.py)
catkin_add_nosetests(test/util/SE3_test.py)
catkin_add_nosetests(test/util/SO3_test.py)

# Integration tests (python and c++)
find_package(rostest REQUIRED)
add_rostest(test/example/basic_integration_test.test)
add_rostest(test/integration/integration.test)
add_rostest(test/util/SE3_tf_test.test)
# Note(quintin): Commented these out because they ignore the Python virtual environment
# Most of our code relies on newer Python features so they fail to initialize
#find_package(rostest REQUIRED)
#add_rostest(test/example/basic_integration_test.test)
#add_rostest(test/integration/integration.test)
#add_rostest(test/util/SE3_tf_test.test)

## Install

Expand Down
29 changes: 16 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM ros:noetic
FROM ubuntu:focal

# DEBIAN_FRONTEND=noninteractive and keyboard-configuration are needed to prevent stdin prompting later on
# This was super annoying to figure out because otherwise the build would hang
# DEBIAN_FRONTEND=noninteractive prevents apt from asking for user input
# software-properties-common is needed for apt-add-repository
RUN apt-get update -y && apt-get upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common keyboard-configuration -y
RUN apt-add-repository ppa:ansible/ansible -y
RUN apt-add-repository ppa:git-core/ppa -y
RUN apt-get install -y ansible git git-lfs
# sudo is needed for ansible since it escalates from a normal user to root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install software-properties-common sudo -y
RUN apt-add-repository ppa:ansible/ansible -y && apt-get install -y git git-lfs ansible

RUN useradd --create-home --groups sudo --shell /bin/zsh mrover
# Give mrover user sudo access with no password
Expand All @@ -17,18 +16,22 @@ RUN mkdir -p /home/mrover/catkin_ws/src/mrover
WORKDIR /home/mrover/catkin_ws/src/mrover
# Defines the APT packages that need to be installed
# rosdep is called from Ansible to install them
ADD ./package.xml .
ADD --chown=mrover:mrover ./package.xml .
# Defines the Python packages that need to be installed
# pip is called from Ansible to install them
ADD ./pyproject.toml .
ADD --chown=mrover:mrover ./pyproject.toml .
# Define the NPM packages that need to be installed by Bun
ADD --chown=mrover:mrover ./src/teleoperation/frontend/package.json ./src/teleoperation/frontend/bun.lockb ./src/teleoperation/frontend/
# Copy over all Ansible files
ADD ./ansible ./ansible
ADD ./ansible.sh .
RUN ./ansible.sh build.yml
ADD --chown=mrover:mrover ./ansible ./ansible
ADD --chown=mrover:mrover ./ansible.sh .
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/*

USER mrover
ENTRYPOINT [ "/bin/zsh" ]
ENTRYPOINT [ "/bin/bash" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Check out our [Wiki](../../wiki/) for more information

![image](https://user-images.githubusercontent.com/20666629/183543916-a7fee846-31db-44d0-8845-c6a95af1110c.png)
![Picture of Rover in the Custom Simulator atop an Orange Mallet](https://github.com/umrover/mrover-ros/assets/20666629/55fbaf74-bc1b-407a-b8ed-407f276f2803)
Loading

0 comments on commit e4ae239

Please sign in to comment.