Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
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 }}
17 changes: 17 additions & 0 deletions .github/workflows/pre-commit.yml
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
__pycache__
.pytest_cache
node_modules
/.gitlab-ci-local/
/.ruff.toml
29 changes: 0 additions & 29 deletions .gitlab-ci.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [2024] [Polymath Robotics, Inc.]
Copyright 2024 Polymath Robotics, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ To register a remote protective stop, the node also exposes two services:

In order to integrate with the node, you have to activate it first before starting to send heartbeat messages.


#### User Monitor Mode

**USE WITH EXTREME CAUTION**
Expand All @@ -53,14 +52,12 @@ In the case you have a test driver or other onsite personnel to operate a physic
ros2 param set /protective_stop_node is_user_monitored False
```


### Protective Stop Remote

The remote is run next to the operator of the P-Stop. It exchanges heartbeat messages with the node on the robot, the latter of which will signal if it detects that the heartbeats are coming in at the expected rate.

In this repo currently, we've implemented it as a web client, but it can also be instantiated as a hardware interface.


### Foxglove Websocket Bridge

The bridge acts as the proxy between the remote and the node, so the two can talk to one-another. If it is not online, the other components will fail gracefully.
Expand All @@ -73,4 +70,3 @@ cd build
cmake ..
make
```

2 changes: 1 addition & 1 deletion archive/docs/Case.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Instructions to be added
Instructions to be added
31 changes: 14 additions & 17 deletions archive/docs/Hardware.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@
<img width="40%" src="/docs/img/rpi-tape.png">
</p>


2. Solder Raspberry Pi GPIO pin extender
1. Solder Raspberry Pi GPIO pin extender
- Use flux to make soldering easier
- Secure a few pins on each end first for better stability
- May want to clean singe marks from flux after soldering; we used a toothbrush and water for this.
<p align="center">
<img width="40%" src="/docs/img/soldered-rpi.png"><br><i> Left = before, right = after </i>
</p>


3. Apply Raspberry Pi heat sink.
1. Apply Raspberry Pi heat sink.
- The Geekworm heatsink we used came with two thermal pads, one is 0.5mm and the other is 1mm. Make sure each pad goes in the right place! It comes with a diagram.
<p align="center">
<img width="40%" src="/docs/img/heatsink.png"> <br><i> Before </i>
Expand All @@ -49,8 +47,7 @@
<img width="40%" src="/docs/img/thermal-pad-placement.png"> <br><i> Thermal Pad Placement </i>
</p>


4. Add e-ink display to UPS using GPIO header.
1. Add e-ink display to UPS using GPIO header.
<p align="center">
<img width="30%" src="/docs/img/gpio-1.png"> <br><i> Top to bottom: UPS, GPIO header, e-ink display </i>
</p>
Expand All @@ -61,16 +58,16 @@
<img width="30%" src="/docs/img/gpio-3.png"> <br><i> Install e-ink to UPS by plugging in GPIO header to pins </i>
</p>


## Wiring
Now it’s time to starting connecting stuff together. The connections at a glance are shown below.

```mermaid
graph TD
USB-C -->|Power Out| UPS(UPS)
UPS(UPS) -->|Power Out| R(Raspi)
R -->|Control| ES(Eink Screen)
R <-->|USB Power and Data| C(Cell Modem)
C -->|USB Power and Data| E(ESP32)
C -->|USB Power and Data| E(ESP32)
E -->|D2 to DI, + and GND| L(LED Ring)
E -->|D22 to switch, + and GNDx2| PB(Power Button)
PB -->|switch to input| UPS
Expand Down Expand Up @@ -99,7 +96,7 @@ We will go through the wire soldering connections in the diagram above one by on
<img width="20%" src="/docs/img/stopbutton-esp.png"> <br><i> Corresponding ESP32 wiring for stop button </i>
</p>

2. LED Ring to ESP32
1. LED Ring to ESP32
- LED Ring DI → ESP32 D2 (Green wire)
- LED Ring PWR5V → ESP32 VIN (Red wire)
- LED Ring GND → ESP32 GND (Black wire)
Expand All @@ -111,7 +108,7 @@ We will go through the wire soldering connections in the diagram above one by on
<img width="30%" src="/docs/img/ledring-esp32.png"> <br><i> Corresponding ESP32 wiring for LED ring </i>
</p>

3. Power Button to ESP32 and UPS
1. Power Button to ESP32 and UPS
- Power Button LED power terminal → ESP32 D22 and UPS pin 3 (White wires)
- Power Button LED ground and switch contact A → ESP32 GND (Black wire)
- Power Button switch contact B→ ESP32 D23 (Red wire)
Expand All @@ -134,12 +131,12 @@ We will go through the wire soldering connections in the diagram above one by on
</p>

- Two white wires should be connected to the same terminal on the button (power button LED power terminal)
- Tip: Solder these wires together first, and then solder them to the terminal
- Tip: Solder these wires together first, and then solder them to the terminal
- The black wire is soldered across two power button terminals (power button LED ground and switch contact A)
- Tip: Solder the end of the wire to the further terminal first, then the closer one
- Tip: Solder the end of the wire to the further terminal first, then the closer one
- Red wire is soldered normally

4. UPS to ESP32 (battery indicator)
1. UPS to ESP32 (battery indicator)
- Lowbat to D34 (yellow wire)
<p align="center">
<img width="30%" src="/docs/img/ups-lowbat.png"> <br><i> UPS lowbat soldering </i>
Expand All @@ -148,16 +145,16 @@ We will go through the wire soldering connections in the diagram above one by on
<img width="30%" src="/docs/img/esp-d34.png"> <br><i> ESP32 pin D34 soldering </i>
</p>

5. Connect cell modem to ESP32 and RPi UPS.
1. Connect cell modem to ESP32 and RPi UPS.
Comment thread
skyegalaxy marked this conversation as resolved.
- Modem USB → ESP32 microUSB (solid black cable)
- Modem microUSB → UPS microUSB (black/white cable)

6. Add battery to USP.
1. Add battery to USP.
<p align="center">
<img width="30%" src="/docs/img/connected-sys.png"> <br><i> Wired and connected system. </i>
</p>

7. Add antennas - if you want to use cellular data instead of WiFi
1. Add antennas - if you want to use cellular data instead of WiFi
- Screw on antennas to AUX and MAIN pins on the underside of the modem

Now you're ready to move onto [Software](/docs/Software.md)
Now you're ready to move onto [Software](/docs/Software.md)
76 changes: 45 additions & 31 deletions archive/docs/Robot-Quickstart.md
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`.
Loading
Loading