Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 2 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN apt-get update -y \
iputils-ping \
ipython3 \
jq \
just \
less \
libncurses5-dev \
locales \
Expand Down Expand Up @@ -91,9 +92,6 @@ RUN python3 -m pip install --user --break-system-packages \
git+https://github.com/timonegk/colcon-notification.git@colors \
git+https://github.com/timonegk/colcon-output.git@colors

# Create colcon workspace
RUN mkdir -p /home/$user/colcon_ws/src

# Install oh-my-zsh for pretty terminal
RUN sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"
Expand All @@ -105,4 +103,4 @@ COPY --chown=$user:$user zshrc /home/$user/.zshrc
ENV QT_X11_NO_MITSHM=1

# Switch to the workspace directory
WORKDIR /home/$user/colcon_ws
WORKDIR /home/$user/bitbots_main
24 changes: 21 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,30 @@
"dev.containers.copyGitConfig": false,
"dev.containers.gitCredentialHelperConfigLocation": "none"
},
"extensions": ["ms-iot.vscode-ros"]
"extensions": [
"charliermarsh.ruff", // Ruff linting and formatting support
"DavidAnson.vscode-markdownlint", // Lints markdown files
"DotJoshJohnson.xml", // XML support
"lextudio.restructuredtext", // Rendering rst files in preview
"Mastermori.dsd", // DSD support
"mohsen1.prettify-json", // JSON formatting
"MS-CEINTL.vscode-language-pack-de", // German language pack
"Ranch-Hand-Robotics.rde-pack", // ROS2 development environment
"ms-python.python", // Python support
"ms-python.vscode-pylance", // Python support
"ms-vscode.cpptools-extension-pack", // C++ support
"ms-vscode.cpptools-themes", // C++ support
"ms-vscode.cpptools", // C++ support
"streetsidesoftware.code-spell-checker-german", // Spell checker
"streetsidesoftware.code-spell-checker", // Spell checker
"tamasfe.even-better-toml", // TOML support
"trond-snekvik.simple-rst" // Syntax highlighting for rst files
]
}
},

"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/home/bitbots/colcon_ws/src/bitbots_main",
"workspaceFolder": "/home/bitbots/colcon_ws/src/bitbots_main",
"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/home/bitbots/bitbots_main",
"workspaceFolder": "/home/bitbots/bitbots_main",

"mounts": [
"type=bind,source=${localEnv:HOME},target=/srv/host_home,consistency=cached"
Expand Down
12 changes: 6 additions & 6 deletions .devcontainer/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export ROS_DOMAIN_ID=24
export ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST

# Set the default colcon workspace
export COLCON_WS="$HOME/colcon_ws"
export COLCON_WS="$HOME/bitbots_main"

# Set the default log level for colcon
export COLCON_LOG_LEVEL=30
Expand All @@ -75,8 +75,8 @@ export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity}] [{name}]: {message}"
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

# Load our ros plugin script containing useful functions and aliases for ROS 2 development
if [[ -f $COLCON_WS/src/bitbots_main/scripts/ros.plugin.sh ]]; then
source $COLCON_WS/src/bitbots_main/scripts/ros.plugin.sh
if [[ -f $COLCON_WS/scripts/ros.plugin.sh ]]; then
source $COLCON_WS/scripts/ros.plugin.sh
fi

# <<< bit-bots initialize <<<
Expand All @@ -89,7 +89,7 @@ echo "Hello there! Welcome to the Bit-Bots ROS 2 development environment!"
echo "If you just (re)build this container a few manual steps are nessessary:"
echo "Create a ssh key with 'ssh-keygen -q -f $HOME/.ssh/id_rsa -N \"\" && cat $HOME/.ssh/id_rsa.pub'."
echo "Copy the commands output and add it to your GitHub account ('https://github.com/settings/keys') (ctrl+click to open in browser)."
echo "Now you can install the rest of the workspace and compile everything with 'make install && cba'."
echo "To update an existing workspace you can use 'make update && cba'."
echo "To compile all packages in the workspace use 'cba'. If you want to compile only a specific package use 'cbs <package_name>'."
echo "Now you can install the rest of the workspace and compile everything with 'just install && just build'."
echo "To update an existing workspace you can use 'just update'."
echo "To compile all packages in the workspace use 'just build'. If you want to compile only a specific package use 'just build <package_name>'."
echo "Run 'xhost local:root' in a terminal on the host machine to enable GUI applications (e.g. rviz2) in the container. This needs to be done after every restart of the host machine."
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ f29fb619aef9f416cbbdc74ec77c23423dcefe07
ae9fbef74c50ba1e462d1b76da16779c76aa0d5b
476e75e3f3d17c35ac89b17f513d93078687d613
cd3280273363807e1b5df2ade0138d48178cb06b
5c6c1edc69b5d4e26bb7bdc3fef3399e2a61567b
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

## Checklist

- [ ] Run `colcon build`
- [ ] Run `just build`
- [ ] Write documentation
- [ ] Test on your machine
- [ ] Test on the robot
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: 'true'
# Remove comments to spawn an interactive debigging ssh shell in the ci

# Remove comments to spawn an interactive debigging ssh shell in the ci
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# with:
# detached: true

- name: Set up ROS ecosystem
uses: ros-tooling/[email protected]

Expand All @@ -39,21 +39,20 @@ jobs:
mkdir -p $HOME/.local/bin
echo "PATH=$PATH:/github/home/.local/bin" >> "$GITHUB_ENV"

- name: Pull source code for libraries and install dependencies
- name: Install just
run: |
sudo apt-get remove -y python3-pytest-repeat #TODO remove once the upstream apt package reports the correct version on the newest pip version
make install HTTPS=true ARGS="--ci"
sudo apt-get update
sudo apt-get install -y just

- name: Set up colcon workspace
- name: Pull source code for libraries and install dependencies
run: |
mkdir -p /colcon_ws/src
ln -s $(realpath .) /colcon_ws/src/bitbots_main
sudo apt-get remove -y python3-pytest-repeat #TODO remove once the upstream apt package reports the correct version on the newest pip version
just HTTPS=true CI=true install

- name: Build packages
run: |
. /opt/ros/jazzy/setup.sh
colcon build --symlink-install
working-directory: /colcon_ws
just build

- name: Test packages
run: |
Expand All @@ -62,4 +61,3 @@ jobs:
. install/setup.sh
# Run tests for all packages
colcon test --event-handlers console_direct+ --return-code-on-test-failure --parallel-workers 1
working-directory: /colcon_ws
22 changes: 15 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,10 @@ bitbots_docs_internal

# VS Code ROS extension
.vscode/browse.vc.*
log/

# Neural Network Model Path
/bitbots_vision/models/
/bitbots_motion/bitbots_rl_motion/rl_walk_models/
/src/bitbots_vision/models/
/src/bitbots_motion/bitbots_rl_motion/rl_walk_models/

**/.*.
.idea/*
Expand All @@ -220,15 +219,24 @@ doc_internal/*
doku/*

# library subdirectories
/lib/
/src/lib/

# Path to the protocol buffer definitions, which are a different repository and managed by vcstool
/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/RobocupProtocol
/src/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/RobocupProtocol
# Protobuf generated file
/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/robocup_extension_pb2.py
/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/robocup_extension_pb2.pyi
/src/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/robocup_extension_pb2.py
/src/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/robocup_extension_pb2.pyi

# Workspace git status file from the deploy tool
**/workspace_status.json

# Do not include colcon build files
/install/
/build/
/log/

# Ignore mypy cache
.mypy_cache/

# Pytest cache
.pytest_cache/
3 changes: 3 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"/root/colcon_ws/install/*/include/**",
"/root/colcon_ws/build/**/include/**",
"/root/colcon_ws/build/**/rosidl_generator_cpp/**",
"${workspaceFolder}/install/*/include/**",
"${workspaceFolder}/build/**/include/**",
"${workspaceFolder}/build/**/rosidl_generator_cpp/**",
"${workspaceFolder}/**/include/**",
"/opt/ros/${env:ROS_DISTRO}/include/**",
"/usr/include/**",
Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,9 @@
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"search.exclude": {
"build": true,
"install": true,
"log": true,
},
}
108 changes: 108 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Justfile

# Set shell
set shell := ["bash", "-uc"]

# Variables
HTTPS := ""
REPO := `pwd`
CI := ""

# Setup / Update related targets

# Install the proprietary Basler Camera SDK
install-basler:
scripts/make_basler.sh {{ if CI != "" {"--ci"} else {""} }}

# Install Webots Simulation environment
install-webots:
scripts/make_webots.sh {{ if CI != "" {"--ci"} else {""} }}

# Install all dependencies, pull all repositories, ...
install: pull-init install-basler install-webots update

# Same as install but without sudo commands (apt/ros dependencies must be already installed on the system)
install-no-root: pull-init update-no-root

# Install python dependencies
pip:
# Install and upgrade pip dependencies
pip install --upgrade pip --user --break-system-packages -v
pip install --upgrade -r requirements/dev.txt --user --break-system-packages -v


# Sets up pre-commit hooks that check code formatting etc. before each commit
install-pre-commit:
pre-commit install

# This is needed as the ROS vscode extension adds absolute paths to some files and we do not want to commit those.
# Install git filters to remove absolute paths from files before committing them.
install-git-filters:
# Install git filters
git config filter.removeFullHomePath.clean "sed '/\/\(home\|root\).*\(install\|build\)/d'"

# Formats the code according to our style guidelines
format:
pre-commit run --all-files

# Clones/Overrides all library repositories and pulls all auxiliary files (like neural network weights)
pull-init: fresh-libs pull-files

# Pull all auxiliary files (like neural network weights) from the http server
pull-files:
wget --no-verbose --show-progress --timeout=15 --tries=2 --recursive --timestamping --no-parent --no-host-directories --directory-prefix={{REPO}}/src/bitbots_vision --reject "index.html*" "https://data.bit-bots.de/models/"
wget --no-verbose --show-progress --timeout=15 --tries=2 --recursive --timestamping --no-parent --no-host-directories --directory-prefix={{REPO}}/src/bitbots_motion/bitbots_rl_motion --reject "index.html*" "https://data.bit-bots.de/rl_walk_models/"

# Remove all library repositories and re-clone them
fresh-libs: remove-libs clone-libs

# Remove all library repositories
remove-libs:
rm -rf src/lib/*
rm -rf src/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/RobocupProtocol
rm src/bitbots_team_communication/bitbots_team_communication/robocup_extension_pb2.py || true

# Clone all library repositories
clone-libs:
if [ "{{HTTPS}}" = "true" ]; then \
awk '{sub("[email protected]:", "https://github.com/"); print " " $$0}' workspace.repos | vcs import .; \
else \
vcs import . < workspace.repos; \
fi

# Install all ROS managed dependencies
rosdep:
[ -f /etc/ros/rosdep/sources.list.d/20-default.list ] || sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro jazzy -y

# Update everything (download all lib repositories, update dependencies, ...)
update: pull-init rosdep pip install-git-filters

# Same as update but without sudo commands (all apt/ros dependencies must be already installed on the system)
update-no-root: pull-init pip install-git-filters


# Build related targets

# Build a specific package or all packages
build *packages:
colcon build --symlink-install --continue-on-error {{ if packages != "" {"--packages-select " + packages} else {""} }}

# Clean all build artifacts or only those of specific packages
clean *packages:
if [ "{{packages}}" != "" ]; then \
colcon clean packages --packages-select {{packages}}; \
else \
rm -rf install build log; \
fi

# Run tests of all packages or a specific package
test *packages:
colcon test --event-handlers console_direct+ --return-code-on-test-failure {{ if packages != "" {"--packages-select " + packages} else {""} }}

# Development related targets

# Deploy the code to a robot
deploy *args:
scripts/deploy_robots.py {{args}}
Loading
Loading