-
Notifications
You must be signed in to change notification settings - Fork 0
GitHub Action CI & Pre-commit hooks #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bffdd17
Add GitHub CI, apply polymath_code_standard
emersonknapp ef7c136
Apply markdown and copyright fixups
emersonknapp 5dd39fd
Add pre-commit ci also
emersonknapp 55f0bd9
Use a proper tag, not local checkout
emersonknapp 6eb28a8
No failfast ros2 matrix
emersonknapp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- | ||
| name: ROS2 Build and Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build_and_test_ros2: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - rosdistro: humble | ||
| ubuntu: jammy | ||
| - rosdistro: jazzy | ||
| ubuntu: noble | ||
| - rosdistro: kilted | ||
| ubuntu: noble | ||
| - rosdistro: rolling | ||
| ubuntu: noble | ||
| container: | ||
| image: rostooling/setup-ros-docker:ubuntu-${{ matrix.ubuntu }}-latest | ||
| steps: | ||
| - name: Build and run tests | ||
| uses: ros-tooling/action-ros-ci@v0.4 | ||
| with: | ||
| target-ros2-distro: ${{ matrix.rosdistro }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| name: Pre-commit | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| pre-commit: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.10' | ||
| - uses: pre-commit/action@v3.0.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ | |
| __pycache__ | ||
| .pytest_cache | ||
| node_modules | ||
| /.gitlab-ci-local/ | ||
| /.ruff.toml | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| # Apply Polymath Code Standard formatters and linters | ||
| repos: | ||
| - repo: https://github.com/polymathrobotics/polymath_code_standard | ||
| rev: v2.1.1 | ||
| hooks: | ||
| # Everything | ||
| - id: polymath-general | ||
| - id: polymath-copyright | ||
| args: [--license, Apache-2.0, --wildcard-copyright-org, --reuse-style] | ||
| # Implementation | ||
| - id: polymath-cmake | ||
| - id: polymath-cpp | ||
| exclude: ^pstop_c/ | ||
| - id: polymath-json | ||
| - id: polymath-python | ||
| # Mark(up/down) | ||
| - id: polymath-markdown | ||
| - id: polymath-shell | ||
| - id: polymath-xml | ||
| - id: polymath-yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| Instructions to be added | ||
| Instructions to be added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,59 @@ | ||
| # Robot Quick-Start | ||
|
|
||
| Have a protective stop and want to set up your robot to work with it? Follow these instructions. | ||
|
|
||
| ## Install Tailscale | ||
|
|
||
| 1. On your robot, install Tailscale on it with the following commands. You will be provided a link to log in to your Tailscale account after the last step. | ||
| ```bash | ||
| curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null | ||
| curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list | ||
| sudo apt-get update | ||
| sudo apt-get install tailscale | ||
| sudo tailscale up | ||
| ``` | ||
| 2. We can then check the Tailscale address of the robot with `tailscale ip -4`. | ||
|
|
||
| ```bash | ||
| curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null | ||
| curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list | ||
| sudo apt-get update | ||
| sudo apt-get install tailscale | ||
| sudo tailscale up | ||
| ``` | ||
|
|
||
| 1. We can then check the Tailscale address of the robot with `tailscale ip -4`. | ||
|
|
||
| ## roslibpy Custom Message Set-up | ||
|
|
||
| On your local machine (or robot that you want the p-stop to control): | ||
| 1. Install rosbridge-server with `sudo apt-get install ros-$ROS-DISTRO-rosbridge-server`. | ||
| 2. Create a colcon workspace if you don't already have one: | ||
| ``` | ||
| mkdir -p colcon_ws/src | ||
| cd colcon_ws/src | ||
| ``` | ||
| 3. Put the [`pstop_msg`](../pstop_msg) folder in this repo inside the `src` directory. It contains a custom message definition for our protective stop. | ||
| 4. Go back to the `colcon_ws` directory and run: | ||
| ``` | ||
| colcon build | ||
| source install/setup.bash | ||
| ``` | ||
| 5. To verify that our custom message set-up was successful, you can run `ros2 interface show pstop_msg/msg/EStopMsg`, which should print out the message definition. | ||
| 1. Create a colcon workspace if you don't already have one: | ||
|
|
||
| ``` | ||
| mkdir -p colcon_ws/src | ||
| cd colcon_ws/src | ||
| ``` | ||
|
|
||
| 1. Put the [`pstop_msg`](../pstop_msg) folder in this repo inside the `src` directory. It contains a custom message definition for our protective stop. | ||
| 1. Go back to the `colcon_ws` directory and run: | ||
|
|
||
| ``` | ||
| colcon build | ||
| source install/setup.bash | ||
| ``` | ||
|
|
||
| 1. To verify that our custom message set-up was successful, you can run `ros2 interface show pstop_msg/msg/EStopMsg`, which should print out the message definition. | ||
|
|
||
| ## roslibpy Client Set-up | ||
|
|
||
| In a terminal on your local machine where you have built and sourced the custom message type above: | ||
|
|
||
| 1. Launch a rosbridge_server with `ros2 launch rosbridge_server rosbridge_websocket_launch.xml`. | ||
| - If you are running this in a Docker container, make sure that port 9090 is exposed by doing `docker run -p 9090:9090 ...` | ||
| 2. To run the roslibpy client, run `python roslibpy_client.py [ip address]`. | ||
| - You can set a default ip address by altering line 12 of [`roslibpy_client.py`](../roslibpy_client.py): | ||
| ``` | ||
| parser.add_argument('target', type=str, help='Target IP address', default='') | ||
| ``` | ||
| 3. To use the flask interface, connect to the Raspberry Pi through SSH with portforwarding: | ||
| ``` | ||
| ssh -L 8000:localhost:5000 [username]@[tailscale ip] | ||
| ``` | ||
| - Now, you should be able to see the flask interface by going to `http://localhost:8000/config`. | ||
| - If you are running this in a Docker container, make sure that port 9090 is exposed by doing `docker run -p 9090:9090 ...` | ||
| 1. To run the roslibpy client, run `python roslibpy_client.py [ip address]`. | ||
| - You can set a default ip address by altering line 12 of [`roslibpy_client.py`](../roslibpy_client.py): | ||
|
|
||
| ``` | ||
| parser.add_argument('target', type=str, help='Target IP address', default='') | ||
| ``` | ||
|
|
||
| 1. To use the flask interface, connect to the Raspberry Pi through SSH with portforwarding: | ||
|
|
||
| ``` | ||
| ssh -L 8000:localhost:5000 [username]@[tailscale ip] | ||
| ``` | ||
|
|
||
| - Now, you should be able to see the flask interface by going to `http://localhost:8000/config`. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.