diff --git a/.github/workflows/catkin.yml b/.github/workflows/catkin.yml deleted file mode 100644 index e3e599cbf..000000000 --- a/.github/workflows/catkin.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: CI -on: - pull_request: - branches: - - master -jobs: - build: - name: Build and Test - runs-on: ubuntu-latest - container: - image: umrover1/ros:latest - options: --user root - if: github.event.pull_request.draft == false - steps: - - uses: actions/checkout@v3 - with: - lfs: "true" - path: "src" - - name: Initialize catkin workspace - run: . /opt/ros/noetic/setup.sh && catkin init - - name: Build - run: . /opt/ros/noetic/setup.sh && catkin build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_CLANG_TIDY=clang-tidy-12 - - name: Python requirements - run: pip3 install -r $GITHUB_WORKSPACE/src/requirements.txt - - name: Test - run: . /opt/ros/noetic/setup.sh && . $GITHUB_WORKSPACE/devel/setup.sh && catkin test -j1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..445697edb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI +on: + pull_request: + branches: + - master + push: + branches: + - master +jobs: + ci: + name: CI + runs-on: ubuntu-latest + container: + image: umrover1/ros:latest + steps: + - uses: actions/checkout@v4 + with: + lfs: "true" + # 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]" + - name: Style Check + run: . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && cd $GITHUB_WORKSPACE/src/mrover/ && ./style.sh + - name: Ensure APT Requirements + if: github.event.pull_request.draft == false + run: rosdep update && rosdep install --from-paths "$GITHUB_WORKSPACE/src" --ignore-src -r -y --rosdistro noetic + - name: Copy Catkin Profiles + if: github.event.pull_request.draft == false + run: rsync -r $GITHUB_WORKSPACE/src/mrover/ansible/roles/build/files/profiles $GITHUB_WORKSPACE/.catkin_tools + - 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 + run: . /opt/ros/noetic/setup.sh && . /home/mrover/catkin_ws/src/mrover/venv/bin/activate && catkin build + - 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 diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml deleted file mode 100644 index 545203560..000000000 --- a/.github/workflows/style.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Style -on: - pull_request: - branches: - - master - push: - branches: - - master -jobs: - code-style: - name: Code Style Check - runs-on: ubuntu-latest - container: - image: umrover1/ros:latest - options: --user root - steps: - - uses: actions/checkout@v3 - - name: Style check C++/Python - run: $GITHUB_WORKSPACE/style.sh diff --git a/.gitignore b/.gitignore index 2ac606dbf..b33a46b98 100644 --- a/.gitignore +++ b/.gitignore @@ -3,30 +3,28 @@ __pycache__/ *.py[cod] *$py.class .mypy_cache/ +*.egg-info/ # Common IDE's, ideally this should be in global gitignore per user -**/.vscode/ -**/.idea/ -cmake-build*/ +.vscode/ +.idea/ +/cmake-build*/ #GUI Files +node_modules/ /src/teleop/gui/dist/ -/src/teleop/gui/node_modules/ /src/teleop/gui/src/static/map -**/keys.json* -**/yarn.lock* -**/yarn-error.log* +keys.json* +yarn.lock* +yarn-error.log* # Bag Files -bags/ - -# Bag Files -bags/ +/bags/ # Catkin -build/ -devel/ -logs/ +/build/ +/devel/ +/logs/ # Moteus moteus-cal* @@ -35,4 +33,4 @@ moteus-cal* *.csv # Virtual Environment -venv/ \ No newline at end of file +/venv/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 03b28a876..5019ac533 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(mrover VERSION 2024.0 LANGUAGES CXX) +project(mrover VERSION 2024.0.0 LANGUAGES CXX) ## Compile as C++17, supported in ROS Kinetic and newer, enable some static analysis set(CMAKE_CXX_STANDARD 17) @@ -199,26 +199,6 @@ else () rosbridge_server teleop_twist_joy gazebo_ros - moveit_commander - moveit_core - moveit_fake_controller_manager - moveit_kinematics - moveit_msgs - moveit_planners_chomp - moveit_planners_ompl - moveit_ros_benchmarks - moveit_ros_control_interface - moveit_ros_manipulation - moveit_ros_move_group - moveit_ros_occupancy_map_monitor - moveit_ros_perception - moveit_ros_planning - moveit_ros_planning_interface - moveit_ros_robot_interaction - moveit_ros_visualization - moveit_ros_warehouse - moveit_setup_assistant - moveit_simple_controller_manager ) # append subdirectories @@ -235,7 +215,7 @@ else () find_package(OpenCV REQUIRED COMPONENTS core aruco) find_package(gazebo REQUIRED) find_package(Eigen3 REQUIRED) - find_package(ZED 2) + find_package(ZED 2 QUIET) if (ZED_FOUND) set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) set(CMAKE_CUDA_STANDARD 17) diff --git a/Dockerfile b/Dockerfile index 454b42b28..cd65b024e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,12 @@ FROM ros:noetic -RUN apt-get update -y && apt-get upgrade -y && apt-get install software-properties-common -y +# 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 +# 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 install -y ansible git git-lfs +RUN apt-get install -y ansible git git-lfs RUN useradd --create-home --groups sudo --shell /bin/zsh mrover # Give mrover user sudo access with no password @@ -12,8 +15,13 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers USER mrover 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 . +# Defines the Python packages that need to be installed +# pip is called from Ansible to install them ADD ./pyproject.toml . +# Copy over all Ansible files ADD ./ansible ./ansible ADD ./ansible.sh . RUN ./ansible.sh build.yml diff --git a/ansible.sh b/ansible.sh index 5cb4af68e..f37d0b3cc 100755 --- a/ansible.sh +++ b/ansible.sh @@ -9,6 +9,6 @@ fi sudo -v # Ensure Ansible has sudo permission -MROVER_PATH=$(dirname "$0") -CATKIN_WORKSPACE_PATH=$(realpath "${MROVER_PATH}"/../..) +readonly MROVER_PATH=$(dirname "$0") +readonly CATKIN_WORKSPACE_PATH=$(realpath "${MROVER_PATH}"/../..) ansible-playbook -i "localhost," -c local "${MROVER_PATH}"/ansible/"$1" --extra-vars "catkin_workspace=${CATKIN_WORKSPACE_PATH}" diff --git a/ansible/roles/build/files/profiles/ci/config.yaml b/ansible/roles/build/files/profiles/ci/config.yaml new file mode 100644 index 000000000..44661fe8f --- /dev/null +++ b/ansible/roles/build/files/profiles/ci/config.yaml @@ -0,0 +1,27 @@ +authors: [ ] +blacklist: [ ] +build_space: build +catkin_make_args: [ ] +cmake_args: + - -DCMAKE_BUILD_TYPE=Release + - -DCMAKE_CXX_FLAGS=-pipe + - -DCMAKE_C_COMPILER=clang-16 + - -DCMAKE_CXX_COMPILER=clang++-16 + - -DCMAKE_CXX_CLANG_TIDY=clang-tidy-16 +devel_layout: linked +devel_space: devel +extend_path: null +extends: null +install: false +install_space: install +isolate_install: false +jobs_args: [ ] +licenses: + - TODO +log_space: logs +maintainers: [ ] +make_args: [ ] +source_space: src +use_env_cache: false +use_internal_make_jobserver: true +whitelist: [ ] diff --git a/ansible/roles/build/files/profiles/debug/config.yaml b/ansible/roles/build/files/profiles/debug/config.yaml index 81a1c908f..004623cb6 100644 --- a/ansible/roles/build/files/profiles/debug/config.yaml +++ b/ansible/roles/build/files/profiles/debug/config.yaml @@ -1,14 +1,14 @@ -authors: [] -blacklist: [] +authors: [ ] +blacklist: [ ] build_space: build -catkin_make_args: [] +catkin_make_args: [ ] cmake_args: -- -DCMAKE_BUILD_TYPE=Debug -- -DCMAKE_CXX_FLAGS=-pipe -- -DCMAKE_C_COMPILER=clang-16 -- -DCMAKE_CXX_COMPILER=clang++-16 -- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -- -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache + - -DCMAKE_BUILD_TYPE=Debug + - -DCMAKE_CXX_FLAGS=-pipe + - -DCMAKE_C_COMPILER=clang-16 + - -DCMAKE_CXX_COMPILER=clang++-16 + - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + - -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache devel_layout: linked devel_space: devel extend_path: null @@ -16,13 +16,13 @@ extends: null install: false install_space: install isolate_install: false -jobs_args: [] +jobs_args: [ ] licenses: -- TODO + - TODO log_space: logs -maintainers: [] -make_args: [] +maintainers: [ ] +make_args: [ ] source_space: src use_env_cache: false use_internal_make_jobserver: true -whitelist: [] +whitelist: [ ] diff --git a/ansible/roles/build/files/profiles/release/config.yaml b/ansible/roles/build/files/profiles/release/config.yaml index ed7c7bc69..8f6df2e90 100644 --- a/ansible/roles/build/files/profiles/release/config.yaml +++ b/ansible/roles/build/files/profiles/release/config.yaml @@ -1,14 +1,14 @@ -authors: [] -blacklist: [] +authors: [ ] +blacklist: [ ] build_space: build -catkin_make_args: [] +catkin_make_args: [ ] cmake_args: -- -DCMAKE_BUILD_TYPE=Release -- -DCMAKE_CXX_FLAGS=-march=native -pipe -- -DCMAKE_C_COMPILER=clang-16 -- -DCMAKE_CXX_COMPILER=clang++-16 -- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -- -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache + - -DCMAKE_BUILD_TYPE=Release + - -DCMAKE_CXX_FLAGS=-march=native -pipe + - -DCMAKE_C_COMPILER=clang-16 + - -DCMAKE_CXX_COMPILER=clang++-16 + - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + - -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache devel_layout: linked devel_space: devel extend_path: null @@ -16,13 +16,13 @@ extends: null install: false install_space: install isolate_install: false -jobs_args: [] +jobs_args: [ ] licenses: -- TODO + - TODO log_space: logs -maintainers: [] -make_args: [] +maintainers: [ ] +make_args: [ ] source_space: src use_env_cache: false use_internal_make_jobserver: true -whitelist: [] +whitelist: [ ] diff --git a/ansible/roles/build/tasks/main.yml b/ansible/roles/build/tasks/main.yml index 2565fc41e..223073a98 100644 --- a/ansible/roles/build/tasks/main.yml +++ b/ansible/roles/build/tasks/main.yml @@ -80,11 +80,13 @@ - python3-virtualenvwrapper - clang-16 - clangd-16 + - clang-tidy-16 - clang-format-16 - lld-16 - lldb-16 - g++-11 - python3.10 + - python3.10-dev - python3.10-venv - ros-{{ ros_distro }}-rosbash diff --git a/package.xml b/package.xml index c7dba2fad..e87ee3c2c 100644 --- a/package.xml +++ b/package.xml @@ -1,119 +1,103 @@ - mrover - 1.0.0 - The MRover Package - - MRover - - - - - MIT - - - - - - - - - - - - - - - - - - - - - - - message_generation - - - - - - message_runtime - - - - - - - catkin - roscpp - rospy - std_msgs - nodelet - roscpp - rospy - std_msgs - roscpp - rospy - std_msgs - nodelet - xacro - joint_state_publisher - robot_state_publisher - ros_numpy - rosbridge_server - tf2_web_republisher - - - rviz - hector_trajectory_server - - - compressed_depth_image_transport - compressed_image_transport - theora_image_transport - tf2_geometry_msgs - tf2_ros - tf2 - image_transport - sensor_msgs - dynamic_reconfigure - python3-cairosvg - python3-joblib - rtabmap_ros - - - rviz_imu_plugin - robot_localization - nmea_navsat_driver - - - smach_ros - - - teleop_twist_joy - - - gazebo_ros - hector_gazebo - teleop_twist_keyboard - - - moveit - - - mavlink - mavros - mavros_extras - mavros_msgs - - - rosunit - rostest - - - - - - + mrover + 2024.0.0 + The MRover Package + + MRover + + + + + GPLv3 + + https://github.com/umrover/mrover-ros + + + + + + + + + + + + + + + + + message_generation + + + + + + message_runtime + + + + + + + catkin + roscpp + rospy + std_msgs + nodelet + roscpp + rospy + std_msgs + roscpp + rospy + std_msgs + nodelet + xacro + joint_state_publisher + robot_state_publisher + rosbridge_server + tf2_web_republisher + + + rviz + hector_trajectory_server + + + tf2 + tf2_ros + tf2_geometry_msgs + image_transport + theora_image_transport + compressed_image_transport + compressed_depth_image_transport + sensor_msgs + dynamic_reconfigure + + + rviz_imu_plugin + robot_localization + nmea_navsat_driver + + + smach_ros + control_msgs + + + teleop_twist_joy + + + gazebo_ros + hector_gazebo + teleop_twist_keyboard + + + rosunit + rostest + + + + + + diff --git a/pyproject.toml b/pyproject.toml index abc2757c3..17c26b5cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mrover" -version = "2024.0" +version = "2024.0.0" description = "MRover Python Code" readme = "README.md" requires-python = ">=3.10.0" @@ -9,6 +9,11 @@ maintainers = [ { name = "Michigan Mars Rover Team" } ] dependencies = [ + # ROS dependencies + "rospkg==1.5.0", + "netifaces==0.11.0", + "defusedxml==0.7.1", + # MRover dependencies "Django==4.2.5", "empy==3.3.4", "numpy==1.26.0", @@ -18,8 +23,6 @@ dependencies = [ "moteus==0.3.59", "pymap3d==3.0.1", "aenum==3.1.15", - "PyYAML==6.0.1", - "rospkg==1.5.0", ] [project.optional-dependencies] diff --git a/style.sh b/style.sh index 2afe1daf3..39ff40b7c 100755 --- a/style.sh +++ b/style.sh @@ -55,8 +55,8 @@ readonly FOLDERS=( ./src/gazebo ./src/util ) -for folder in "${FOLDERS[@]}"; do - find "$folder" -regex '.*\.\(cpp\|hpp\|h\)' -exec "$clang_format_executable_path" --dry-run -style=file -i {} \; +for FOLDER in "${FOLDERS[@]}"; do + find "${FOLDER}" -regex '.*\.\(cpp\|hpp\|h\)' -exec "$clang_format_executable_path" --dry-run -style=file -i {} \; done echo "Done"