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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
## Development Practices

- Start with minimal, lean implementations focused on proof-of-concept
- Avoid creating new files until asked
- Avoid implementing things from scratch
- Avoid defensive error handling for hypothetical failures
- Use print statements and logging sparingly, unless asked
- Avoid light wrappers and custom classes, unless asked
- Avoid `if __name__ == "__main__"` patterns in package code
- Avoid `if __name__ == "__main__"` patterns in package code, unless asked
For example, rather than using:
```python
from math import sqrt
def main():
sqrt(2)

if __name__ == "__main__":
main()
```
Leave it as a top-level script:
```python
from math import sqrt
sqrt(2)
```
- Skip unit tests unless explicitly requested
- Follow patterns in CONTRIBUTING.md when present
- Prefer writing Python if no language specified
Expand All @@ -19,7 +34,7 @@

- Validate and access link content using available MCP tools (Playwright and/or Perplexity)
- Search GitHub for relevant open-source alternatives to commercial tools
- Prioritize official package documentation over inferred usage
- Prioritize official package documentation over inferred usage by using Context7 MCP tool

## Communication Style

Expand All @@ -28,10 +43,19 @@
- Ask clarifying questions when needed
- Don't infer requirements or create workarounds unless asked
- Put documentation content in comment replies, not separate files, unless asked
- Comments should not leave a trace of the development process
- Avoid sycophancy, favor objectiveness

- ## Change Logging
## Change Logging

- Create CHANGELOG.md if it doesn't exist
- Each time you generate code, note the changes in CHANGELOG.md
- Follow semantic versioning guidelines
- Include date and description of changes

## Coding Agent

- Set environment variables `PIP_TIMEOUT=600` and `PIP_RETRIES=2` prior to `conda` or `pip` installs
- Include plots directly in your comment reply via `![image name](https://github.com/<user/org>/<repo>/blob/<shortened-commit-hash>/<filename>?raw=true)`. Truncate the commit hash to the first 7 characters only. For example, `https://github.com/AccelerationConsortium/evaluation-metrics/blob/52754e7/scripts/bo_benchmarks/demonstrations/branin_campaign_demonstration_results.png?raw=true`. For provenance, ensure you use the shortened (7-character) commit hash, not the branch name
- If you mention files in your comment reply, add direct hyperlinks based on the shortened (7-character) commit hash
- Use the following environment secrets: `HIVEMQ_HOST`, `HIVEMQ_USERNAME`, and `HIVEMQ_PASSWORD` for testing. Never echo or expose these, even in your logs
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install package and dev dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ax-platform prefect prefect-slack
python -m pip install ax-platform prefect prefect-slack paho-mqtt
python -m pip install -e .
# python -m pip install tox pre-commit
# pre-commit run --all-files
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ src/ac_training_lab/squidstat/SquidstatPyLibrary-1.9.1.8-py3-none-win_amd64.whl
src/ac_training_lab/apriltag_demo/tag25_09_00000.png
src/ac_training_lab/apriltag_demo/tag36_11_00000.png
src/ac_training_lab/apriltag_demo/tag49_12_00000.png
scripts/playwright/sem-open-close/chat.json
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CHANGELOG

## [Unreleased]
### Added
- Support for both `rpicam-vid` (Raspberry Pi OS Trixie) and `libcamera-vid` (Raspberry Pi OS Bookworm) camera commands in `src/ac_training_lab/picam/device.py` to ensure compatibility across different OS versions.

### Fixed
- Ctrl+C interrupt handling in `src/ac_training_lab/picam/device.py` now properly exits the streaming loop instead of restarting.

## [1.1.0] - 2024-06-11
### Added
- Imperial (10-32 thread) alternative design to SEM door automation bill of materials in `docs/sem-door-automation-components.md`.
- Validated McMaster-Carr part numbers and direct links for all imperial components.

### Changed
- No changes to metric design section.

### Notes
- All components sourced from McMaster-Carr for reliability and reproducibility.
6 changes: 2 additions & 4 deletions docs/_snippets/network-setup-note.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
```{note}
For devices running a full OS:
- If you need to connect to a WPA2-Enterprise WiFi network (common in institutional environments), please refer to the [Raspberry Pi WPA2-Enterprise WiFi Setup Guide](https://ac-training-lab.readthedocs.io/en/latest/raspberry-pi-wpa2-enterprise.html) first.
Optionally, complete the following network setup steps, applicable to devices such as Raspberry Pis running RPi OS Lite.
- Consider setting up Tailscale for secure remote access and management. Please refer to the [Tailscale Setup Guide](https://ac-training-lab.readthedocs.io/en/latest/tailscale-setup.html) for detailed instructions on installation and configuration.

Please complete these network setup steps before proceeding with the device-specific setup below.
- If you need to connect to a WPA2-Enterprise WiFi network (common in institutional environments), please refer to the [Raspberry Pi WPA2-Enterprise WiFi Setup Guide](https://ac-training-lab.readthedocs.io/en/latest/raspberry-pi-wpa2-enterprise.html) first.
```
2 changes: 2 additions & 0 deletions docs/raspberry-pi-wpa2-enterprise.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ First, let's check the current status of your wireless interface (`wlan0`) to un

```bash
ip addr show wlan0
iwgetid
```

This command will display the IP address and connection status of `wlan0`.
Expand Down Expand Up @@ -102,6 +103,7 @@ Check if `wlan0` has obtained an IP address and is connected to the "UofT" netwo

```bash
ip addr show wlan0
iwgetid
```

You can also check (example output also shown):
Expand Down
68 changes: 68 additions & 0 deletions docs/sem-door-automation-components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# SEM Door Automation Linkage: McMaster-Carr Component Selection

## 1. Adjustable Tie Rod (M4, Stainless Steel)

**Product:** 18-8 Stainless Steel Threaded Rod, M4 × 0.7 mm, 50 mm Length, Fully Threaded
**Link:** [McMaster-Carr 98863A534](https://www.mcmaster.com/98863A534/)
**Justification:** Provides corrosion resistance and compatibility with M4 rod ends and actuator clevis. 50 mm length is suitable for most SEM linkage applications and can be further cut to length if needed. Use with jam nuts for adjustment and secure installation.

## 2. Ball Joint Rod End (M4, Stainless Steel)
**Product:** Internally Threaded Corrosion-Resistant Ball Joint Rod End, M4 × 0.7 mm Thread, 303 Stainless Steel
**Link:** [McMaster-Carr 2988K31](https://www.mcmaster.com/2988K31)
**Justification:** Stainless steel construction ensures corrosion resistance in laboratory environments. Ball joint allows for angular misalignment and smooth actuation. M4 thread is compatible with the tie rod and actuator clevis.

## 3. Jam Nut (M4, Stainless Steel)
**Product:** Stainless Steel Hex Jam Nut, M4 × 0.7 mm Thread
**Link:** [McMaster-Carr 91828A110](https://www.mcmaster.com/91828A110)
**Justification:** Secures the rod end to the tie rod, preventing loosening during repeated actuation. Stainless steel for durability and corrosion resistance.

## 4. Handle Attachment (Cable Tie or U-Bolt Clamp)
**Product:** Select based on SEM handle geometry. Recommended: Stainless steel cable tie or U-bolt clamp sized to fit handle diameter.
**Link:** [Cable Ties](https://www.mcmaster.com/cable-ties/) | [U-Bolt Clamps](https://www.mcmaster.com/u-bolts/)
**Justification:** Provides a secure, non-slip connection to the SEM handle. Stainless steel options preferred for longevity and chemical resistance.

### Cable Tie for SEM Handle Attachment

**Selected Product:** [McMaster-Carr Stainless Steel Cable Tie, 5" Length, 0.18" Width, Part Number 6898K381](https://www.mcmaster.com/6898K381/)

**Specs:** Fits bundle diameters up to 1" (compatible with 20–24 mm SEM handle), 0.18" width, 5" length, 316 stainless steel for maximum corrosion resistance.

**Engineering Justification:** This cable tie is highly corrosion-resistant, fits the 20–24 mm handle diameter, and provides secure, low-profile clamping for the SEM handle geometry. The 0.18" width and 5" length ensure mechanical strength and ease of installation, while the 316 stainless steel construction prevents degradation in laboratory environments and ensures long-term reliability.

## Assembly Notes


*All components sourced from McMaster-Carr for reliability and ease of procurement.*

---

## Alternative Design: Imperial (10-32 Thread)

This section provides a complete bill of materials for automating a SEM door using imperial (10-32) threaded components, all sourced from McMaster-Carr. Stainless steel is selected for corrosion resistance and mechanical reliability.

### Bill of Materials

| Item | Description | McMaster-Carr Part # | Link | Engineering Justification |
| --------------------------- | -------------------------------------------- | -------------------- | ------------------------------------------------ | -------------------------------------------- |
| Threaded Rod | 10-32, 18-8 Stainless Steel, 1 ft length | 98804A106 | [98804A106](https://www.mcmaster.com/98804A106/) | Corrosion-resistant, compatible with linkage |
| Ball Joint Rod End (male) | 10-32, 303 Stainless Steel, Right Hand | 59915K21 | [59915K21](https://www.mcmaster.com/59915K21/) | Allows angular motion, corrosion-resistant |
| Ball Joint Rod End (female) | 10-32, 303 Stainless Steel, Right Hand | 59915K41 | [59915K41](https://www.mcmaster.com/59915K41/) | For adjustable linkage, corrosion-resistant |
| Ball Joint Linkage | 10-32, 304 Stainless Steel, Right Hand | 6058K35 | [6058K35](https://www.mcmaster.com/6058K35/) | Swivel connection, corrosion-resistant |
| Jam Nut (thin profile) | 10-32, 18-8 Stainless Steel, 1/pack | 94450A521 | [94450A521](https://www.mcmaster.com/94450A521/) | Locks rod end, corrosion-resistant |
| Cable Tie/U-bolt Clamp | Stainless Steel, 7.9" length, 50 lb capacity | 6898K381 | [6898K381](https://www.mcmaster.com/6898K381/) | Secures linkage, corrosion-resistant |

### Engineering Notes

- All components are stainless steel for maximum corrosion resistance in laboratory environments.
- 10-32 imperial thread is a standard for light mechanical linkages, ensuring compatibility and ease of sourcing.
- Ball joint rod ends and linkages allow for angular misalignment and smooth operation of the SEM door.
- Thin-profile jam nuts are used to lock rod ends in place without adding bulk.
- Cable tie/U-bolt clamp secures the linkage to the actuator or door bracket.

### Assembly Guidance

1. Cut the threaded rod to the required length for your SEM door linkage.
2. Thread ball joint rod ends onto each end of the rod; use jam nuts to lock them in place.
3. Use the ball joint linkage for additional articulation if needed.
4. Secure the completed linkage to the actuator and door bracket using the stainless steel cable tie/U-bolt clamp.
5. Verify smooth operation and adjust as needed.
Loading