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

Add ROS! #49

Merged
merged 55 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f9ccb25
work on unifying CI env
da-luce Aug 10, 2024
3d88fff
update README.md
da-luce Aug 11, 2024
763eec8
dir structure changes
da-luce Aug 11, 2024
0477cb2
update image for workflow
da-luce Aug 11, 2024
a575d3d
format and fix some lint errors
da-luce Aug 11, 2024
1bc4c7c
update workflow and fix some errors in waypoints
da-luce Aug 11, 2024
c7f71bf
tweaks to documentation and meta data
da-luce Aug 11, 2024
4396ced
Update alerts
da-luce Aug 11, 2024
cfdd37a
fix some lint errors and other infa changes
da-luce Aug 12, 2024
0023eb8
Merge branch 'ci' of github.com:AriMirsky/Q-Learning into ci
da-luce Aug 12, 2024
b8a7a2f
Dockerfile updates
da-luce Aug 12, 2024
f67ae36
pin versions
da-luce Aug 12, 2024
40b2f67
Automatic linter changes
AriMirsky Aug 13, 2024
53652fc
Fix most liniting problems
AriMirsky Aug 13, 2024
87e96d1
Fix remaining linting errors
AriMirsky Aug 13, 2024
5fbac9e
revert unintended changes
da-luce Aug 13, 2024
4765ca7
Fix mypy type check
AriMirsky Aug 13, 2024
c607210
Merge branch 'ci' of github.com:AriMirsky/Q-Learning into ci
AriMirsky Aug 13, 2024
47f9676
correct mypy errors and silence failing test
da-luce Aug 13, 2024
6d012ee
revert constants
da-luce Aug 13, 2024
0239a4d
fix badge
da-luce Aug 13, 2024
651f19a
upload code cov always and add arch diagram
da-luce Aug 14, 2024
5e295c9
fix mermaid colors
da-luce Aug 14, 2024
a561d56
update code coverage workflow
da-luce Aug 14, 2024
76709b5
try to fix coverage again
da-luce Aug 14, 2024
02f132c
last time, I swear
da-luce Aug 14, 2024
9be4928
update arch
da-luce Aug 15, 2024
6faf198
ROS arch
da-luce Aug 15, 2024
417801d
working novnc
da-luce Aug 16, 2024
8d7d628
ROS board
da-luce Aug 16, 2024
0190421
working docker install... no tkinter tho
da-luce Aug 16, 2024
7525c25
working python and ros
da-luce Aug 16, 2024
87d080c
hodge podge ROS changes
da-luce Aug 16, 2024
9ed6e11
working waypoint node
da-luce Aug 17, 2024
108046e
more infa updates
da-luce Aug 17, 2024
e367218
fix local file pytest and colcon test running
da-luce Aug 17, 2024
4836388
update ROS info in README
da-luce Aug 17, 2024
e1c9d33
readme tips
da-luce Aug 17, 2024
dee9157
track OSM map
da-luce Aug 17, 2024
a84f1ef
merge ros and main
da-luce Aug 17, 2024
58a776c
update test, no docker cache
da-luce Aug 17, 2024
5de7aac
remove demo version
da-luce Aug 17, 2024
4c431f7
remove compose version
da-luce Aug 17, 2024
67aa8ee
fix build github workflow
da-luce Aug 17, 2024
f4d4825
attempt to fix permission errors
da-luce Aug 17, 2024
48d71ec
run workflow as root
da-luce Aug 17, 2024
640238f
clean up and fix entrypoint
da-luce Aug 17, 2024
a7c0242
fix and ignore lint errors
da-luce Aug 17, 2024
7ce465c
readme updates
da-luce Aug 18, 2024
2984ebf
fix type_check step
da-luce Aug 18, 2024
497ebab
try one container workflow
da-luce Aug 19, 2024
26a6070
readme tweak
da-luce Aug 19, 2024
3cb750b
Merge branch 'ros' of github.com:AriMirsky/Q-Learning into ros
da-luce Aug 19, 2024
2b80d14
back to one container per stage
da-luce Aug 19, 2024
d2e6bf0
resolve gitignore conflict
da-luce Aug 20, 2024
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
25 changes: 18 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
# We only need to test on one OS as we are using Docker
runs-on: ubuntu-latest
env:
DOCKER_BASE_CMD: docker run --user root --rm
# Running as root removes permission errors when running github workflow
DOCKER_BASE_CMD: docker compose run --rm --user root
COVERAGE_VOLUME: ${{ github.workspace }}/coverage:/usr/app/coverage

steps:
Expand All @@ -23,29 +24,39 @@ jobs:

# Build Docker image
- name: Build Docker image
run: docker build -t autobike .
run: docker build -t autobike --no-cache .

# Build ROS project
- name: Build ROS project
if: success()
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "build"

# Run test ROS package
- name: Run ROS package
if: success()
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "build && ros2 run waypoints once"

# Run Black formatting check
- name: Black formatting check
# always() runs even if the job is canceled, while success() || failure() does not
if: success() || failure()
run: ${{ env.DOCKER_BASE_CMD }} autobike black --check --config pyproject.toml .
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "format_check"

# Run Pylint linting
- name: Pylint linting
# always() runs even if the job is canceled, while success() || failure() does not
if: success() || failure()
run: ${{ env.DOCKER_BASE_CMD }} autobike pylint --rcfile=pyproject.toml src/
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "lint"

# Run Pytest with code coverage
- name: Pytest with code coverage
if: success() || failure()
# Specify coverage volume
run: ${{ env.DOCKER_BASE_CMD }} -v ${{ env.COVERAGE_VOLUME }} autobike pytest --cov=./ --cov-report=xml:./coverage/coverage.xml --cov-report=term
run: ${{ env.DOCKER_BASE_CMD }} -v ${{ env.COVERAGE_VOLUME }} autobike bash -ic "build && pytest --cov=./ --cov-report=xml:./coverage/coverage.xml --cov-report=term"

# Run mypy type checking
- name: Mypy type check
if: success() || failure()
run: ${{ env.DOCKER_BASE_CMD }} autobike mypy --config-file=pyproject.toml src/
run: ${{ env.DOCKER_BASE_CMD }} autobike bash -ic "type_check"

# Upload to codecov
- name: Upload coverage to Codecov
Expand Down
19 changes: 9 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# Cache files
__pycache__/
*cache*
*.egg-info

# Coverage reports and test artifacts
*coverage*
codecov*

# IDE-specific files (IntelliJ IDEA, PyCharm)
Q-Learning.iml
misc.xml
modules.xml
vcs.xml

# Egg info (Python package distribution)
src/qlearning.egg-info/

# Coverage reports and test artifacts
*coverage*
codecov*

# macOS system files
.DS_Store

# Build directories
# ROS2 build artifacts
build/
install/
log/


# OpenStreetMap data files
*.osm
60 changes: 45 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,64 @@
# Autonomous Bicycle - Python Enviorment
# Build-time arguments
ARG ROS_DISTRO=humble

# Base image
FROM python:3.10.6-slim
# Base image (Humble is the LTS version for Ubuntu 22.04)
# IMPORTANT: pin to a specific hash!
FROM ros:${ROS_DISTRO}@sha256:80a4f6329aad64f14b600133cb3fd279d0bf666feeca5abef3f10bb41b0916ea

# Set working directory
ENV WORKDIR /usr/local/autobike
WORKDIR $WORKDIR

# Update package list and fix missing dependencies
RUN apt-get update --fix-missing

# Set working directory of container
WORKDIR /usr/app/
ENV PYTHONPATH="/usr/app/src:${PYTHONPATH}"
COPY . .
# Basic tools
RUN apt-get install -y vim

# Install pip (updating is important!)
RUN apt-get install -y python3-pip=22.0.2+dfsg-1ubuntu0.4 && pip3 install --upgrade pip

# Setup ROSboard
RUN apt-get install -y \
ros-${ROS_DISTRO}-demo-nodes-cpp && \
pip3 install tornado==6.4.1 simplejpeg==1.7.4 && \
git clone https://github.com/dheera/rosboard.git /usr/local/rosboard

# OSMnx dependencies
RUN apt-get install -y \
gdal-bin=3.2.2+dfsg-2+deb11u2 \
libgdal-dev=3.2.2+dfsg-2+deb11u2 \
g++=4:10.2.1-1
gdal-bin=3.4.1+dfsg-1build4 \
libgdal-dev=3.4.1+dfsg-1build4 \
g++=4:11.2.0-1ubuntu1

USER root
# GUI backend for python (required by Matplotlib)
RUN apt-get install -y python3.10-tk

# Install Python dependencies defined in pyproject.toml
# Copy Python project files and install dependencies
ENV PYTHONPATH="$WORKDIR:${PYTHONPATH}"
COPY pyproject.toml .
RUN pip install .

# GUI backend for python (required by Matplotlib)
RUN apt-get install -y tk=8.6.11+1
# Run the container as a non-root user for better security
ARG USERNAME=bichael
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd --gid $USER_GID $USERNAME && \
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME

ENV HOME=/home/$USERNAME
RUN chown -R $USERNAME:$USERNAME $HOME

# Add shell env to .bashrc (overwritten by volume)
COPY shell_env.sh $HOME/shell_env.sh
RUN echo "source \$HOME/shell_env.sh" >> $HOME/.bashrc

# Clean up cached package lists to reduce image size
RUN rm -rf /var/lib/apt/lists/*

USER 1001
# Copy the rest of the application files
COPY . .

USER $USERNAME

# Run on container start (not when using docker-compose run, however)
CMD ["/bin/bash"]
18 changes: 0 additions & 18 deletions Dockerfile-navigation

This file was deleted.

Loading
Loading