Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/integration' into percep-second-cam
Browse files Browse the repository at this point in the history
  • Loading branch information
qhdwight committed Feb 20, 2024
2 parents 0884ea2 + e72e18e commit 9f2d260
Show file tree
Hide file tree
Showing 124 changed files with 1,132 additions and 6,999 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ text=auto
*.stl filter=lfs diff=lfs merge=lfs -text
*.glb filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.deb filter=lfs diff=lfs merge=lfs -text
ansible/roles/esw/files/bin/fdcanusb_daemon filter=lfs diff=lfs merge=lfs -text
10 changes: 7 additions & 3 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 Down Expand Up @@ -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
6 changes: 5 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[submodule "deps/libde265"]
path = deps/libde265
url = git@github.com:strukturag/libde265.git
url = https://github.com/strukturag/libde265.git
shallow = true
branch = 0.1-20240106
[submodule "deps/dawn"]
path = deps/dawn
url = https://dawn.googlesource.com/dawn
shallow = true
branch = chromium/6108
[submodule "deps/manif"]
path = deps/manif
url = https://github.com/artivis/manif.git
shallow = true
47 changes: 11 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ if (MROVER_CI)
list(APPEND MROVER_CPP_COMPILE_OPTIONS -Werror)
endif ()

if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/dawn/out/Release)
set(MROVER_BUILD_SIM ON)
else ()
set(MROVER_BUILD_SIM OFF)
endif ()

include(cmake/macros.cmake)

# ROS packages list
Expand Down Expand Up @@ -77,29 +71,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 ()
include(cmake/deps.cmake)

find_package(Bullet REQUIRED)

find_package(glfw3 REQUIRED)

include(cmake/webgpu.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 @@ -146,6 +119,7 @@ catkin_package()
## Libraries

mrover_add_library(lie src/util/lie/*.cpp src/util/lie)
target_link_libraries(lie PUBLIC MANIF::manif)

## ESW

Expand Down Expand Up @@ -176,7 +150,7 @@ 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_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)
Expand Down Expand Up @@ -224,8 +198,8 @@ mrover_add_node(arm_controller src/teleoperation/arm_controller/*.cpp)

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 ()

Expand All @@ -240,15 +214,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
26 changes: 15 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
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
# 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
RUN apt-add-repository ppa:git-core/ppa -y
RUN apt-get install -y ansible git git-lfs
ADD ./pkg /tmp/
RUN apt-get install -f /tmp/*.deb && rm /tmp/*.deb

RUN useradd --create-home --groups sudo --shell /bin/zsh mrover
# Give mrover user sudo access with no password
Expand All @@ -17,18 +19,20 @@ 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 .
RUN ./ansible.sh ci.yml

USER root
# 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" ]
7 changes: 7 additions & 0 deletions ansible/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: all
vars:
ros_distro: noetic
ubuntu_release: focal
roles:
- ci
1 change: 0 additions & 1 deletion ansible/roles/build/files/profiles/ci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ cmake_args:
- -DCMAKE_C_COMPILER=clang-16
- -DCMAKE_CXX_FLAGS=-pipe
- -DCMAKE_CXX_COMPILER=clang++-16
- -DCMAKE_CXX_CLANG_TIDY=clang-tidy-16
- -DCMAKE_CUDA_HOST_COMPILER=clang++-16
- -DMROVER_CI=ON
- -Wno-dev
Expand Down
3 changes: 2 additions & 1 deletion ansible/roles/build/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@
- ros-{{ ros_distro }}-rosbash
- libbullet-dev
- libglfw3-dev
- xorg-dev
- libx11-xcb-dev
- libnl-3-dev
- libnl-route-3-dev
- libtbb-dev
- libopencv-dev

- name: Initialize rosdep
become: True
Expand Down
173 changes: 173 additions & 0 deletions ansible/roles/ci/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Allows us to install Python versions newer than 3.8
- name: Add Python PPA
become: True
apt_repository:
repo: ppa:deadsnakes/ppa

# Allows us to install G++13, so we can use an updated libstdc++ which provides more standard library features (C++20)
- name: Add GCC PPA
become: True
apt_repository:
repo: ppa:ubuntu-toolchain-r/test

- name: Add LLVM APT Key
become: True
apt_key:
url: https://apt.llvm.org/llvm-snapshot.gpg.key

# Allows us to install Clang 16 and other LLVM tools
- name: Add LLVM APT List
become: True
apt_repository:
repo: deb http://apt.llvm.org/{{ ubuntu_release }}/ llvm-toolchain-{{ ubuntu_release }}-16 main
filename: llvm

- name: Add CMake APT Key
become: True
apt_key:
url: https://apt.kitware.com/keys/kitware-archive-latest.asc
keyring: /usr/share/keyrings/kitware-archive-keyring.gpg

# Allows us to install CMake versions newer than 3.16
- name: Add CMake APT List
become: True
apt_repository:
repo: deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ {{ ubuntu_release }} main
filename: kitware

- name: Add ROS APT Key
become: True
apt_key:
url: https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc

- name: Add ROS APT List
become: True
apt_repository:
repo: deb http://packages.ros.org/ros/ubuntu {{ ubuntu_release }} main
filename: ros

- name: Upgrade APT Packages
become: True
apt:
cache_valid_time: 604800
state: latest
upgrade: yes

- name: Install APT Packages
become: True
apt:
cache_valid_time: 604800
state: latest
name:
- cmake
- rsync
- python3-rosdep
- python3-catkin-tools
- clang-16
- clang-tidy-16
- clang-format-16
- lld-16
- gcc-13
- g++-13
- python3.10
- python3.10-dev
- python3.10-venv
- libbullet-dev
- libglfw3-dev
- libx11-xcb-dev
- libnl-3-dev
- libnl-route-3-dev
- libtbb-dev
- libopencv-dev

- name: Initialize rosdep
become: True
command: rosdep init
args:
# This command will be skipped if this file already exists
creates: /etc/ros/rosdep/sources.list.d/20-default.list

- name: Update rosdep
command: rosdep update

- name: Install ROS Packages
command: rosdep install --from-paths {{ catkin_workspace }}/src --ignore-src -y --rosdistro={{ ros_distro }}

#- name: Download Bun Installer
# get_url:
# url: https://bun.sh/install
# dest: /tmp/bun_installer.sh
# mode: 0755
#
#- name: Run Bun Installer
# command: /tmp/bun_installer.sh
# args:
# creates: ~/.bun/bin/bun
#
#- name: Upgrade Bun
# command: ~/.bun/bin/bun upgrade
#
#- name: Install Bun Packages
# command: ~/.bun/bin/bun install --cwd {{ catkin_workspace }}/src/mrover/src/teleoperation/frontend

#- name: Install Catkin Profiles
# synchronize:
# src: files/profiles
# dest: "{{ catkin_workspace }}/.catkin_tools"
# recursive: true

- name: Set G++ 13 as Default
become: True
alternatives:
name: g++
path: /usr/bin/g++-13
link: /usr/bin/g++
priority: 130

- name: Set GCC 13 as Default
become: True
alternatives:
name: gcc
path: /usr/bin/gcc-13
link: /usr/bin/gcc
priority: 130

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

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

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

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

- name: Setup Python Virtual Environment
pip:
name:
# Installs from pyproject.toml
- "{{ catkin_workspace }}/src/mrover[dev]"
virtualenv: "{{ catkin_workspace }}/src/mrover/venv"
virtualenv_command: /usr/bin/python3.10 -m venv
Loading

0 comments on commit 9f2d260

Please sign in to comment.