Skip to content

SentryBOT V5 disorganized (my workspace) Merge #12

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

Open
wants to merge 67 commits into
base: SentryBOT-V5-VoidVortex
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
dd171a3
Updated README
danic85 Nov 14, 2024
1c075e9
Merge pull request #100 from makerforgetech/develop
danic85 Nov 14, 2024
50e7663
Merge pull request #101 from makerforgetech/main
danic85 Nov 14, 2024
10709c9
Added CM5 Modules.drawio
danic85 Dec 6, 2024
042d11f
Update CM5 Modules.drawio
danic85 Dec 6, 2024
846995e
Added CM5 Modules.drawio.png
danic85 Dec 6, 2024
bc2d348
Added CM5 Modules.drawio.svg
danic85 Dec 6, 2024
5d524d0
Update CM5 Modules.drawio
danic85 Dec 6, 2024
b48f546
Added CM5 Modules.drawio.svg
danic85 Dec 6, 2024
7e3b9aa
Update CM5 Modules.drawio
danic85 Dec 6, 2024
5141207
Added CM5 Modules.drawio.svg
danic85 Dec 6, 2024
6763121
Update CM5 Modules.drawio
danic85 Dec 6, 2024
fe4a634
Added CM5 Modules.drawio.svg
danic85 Dec 6, 2024
57224b9
Update CM5 Modules.drawio
danic85 Dec 6, 2024
360c253
Added CM5 Modules.drawio.svg
danic85 Dec 6, 2024
d4c635d
Update CM5 Modules.drawio
danic85 Dec 6, 2024
4e9e48e
Added CM5 Modules.drawio.svg
danic85 Dec 6, 2024
f747740
Update CM5 Modules.drawio
danic85 Dec 6, 2024
dc14e6f
Update CM5 Modules.drawio
danic85 Dec 6, 2024
50d925f
Update diagrams
danic85 Dec 13, 2024
1e124d7
Update diagrams
danic85 Dec 13, 2024
d46332f
Update diagrams
danic85 Dec 13, 2024
8fc2834
Update CM5 Modules.drawio.svg
danic85 Dec 13, 2024
263066d
Update CM5 Modules.drawio.svg
danic85 Dec 13, 2024
66e7955
Fixes to install (also applies to pi 5)
danic85 Dec 20, 2024
b09040f
Beginning of SPI support
danic85 Dec 30, 2024
5abc00a
Successful test of SPI neopixels
danic85 Dec 31, 2024
1d08be0
Remove unused file
danic85 Dec 31, 2024
879b059
Clean up neopixel protocol selection
danic85 Jan 1, 2025
da2882c
Conditional exit logic
danic85 Jan 1, 2025
cedef84
Adjustments for buddy branch
danic85 Jan 1, 2025
89818ca
Merge pull request #107 from makerforgetech/feature/fixes
danic85 Jan 1, 2025
ed15f7c
Auto launch installer
danic85 Jan 6, 2025
7b5f27c
Adjustments during testing
danic85 Jan 6, 2025
74ddd6f
Merge pull request #110 from makerforgetech/feature/autolaunch
danic85 Jan 6, 2025
6805d9a
Added Software Architecture.drawio.svg
danic85 Jan 15, 2025
fd3172f
Update Software Architecture.drawio.svg
danic85 Jan 15, 2025
b510901
Merge pull request #117 from makerforgetech/main
danic85 Feb 21, 2025
00074c9
PR template
danic85 Mar 9, 2025
23d820a
Merge pull request #121 from makerforgetech/feature/pr_template
danic85 Mar 9, 2025
b395351
Created unit test framework
danic85 Mar 9, 2025
48ec1a2
Fix version issue
danic85 Mar 9, 2025
17b141f
Fix version issue
danic85 Mar 9, 2025
a0d31fa
Fix version issue
danic85 Mar 9, 2025
2e01c98
Fix version issue
danic85 Mar 9, 2025
fbdaa4b
Fix test workflow
danic85 Mar 9, 2025
3c44d36
Fix test workflow
danic85 Mar 9, 2025
90f50b9
Fix test workflow
danic85 Mar 9, 2025
4c55db6
Fix test workflow
danic85 Mar 9, 2025
6a3503b
Fix test workflow
danic85 Mar 9, 2025
13b7376
Fix test workflow
danic85 Mar 9, 2025
3bfc464
Fix test workflow
danic85 Mar 9, 2025
ccb1811
Fix test workflow
danic85 Mar 9, 2025
1f234ca
Fix test workflow
danic85 Mar 9, 2025
bf68be7
Fix test workflow
danic85 Mar 9, 2025
171d5d5
Fix test workflow
danic85 Mar 9, 2025
f632872
Fix test workflow
danic85 Mar 9, 2025
4d8b60b
Fix test workflow
danic85 Mar 9, 2025
772d20a
Fix test workflow
danic85 Mar 9, 2025
dd547a4
Fix test workflow
danic85 Mar 9, 2025
b8715cf
simplify
danic85 Mar 9, 2025
f78801e
Failure
danic85 Mar 9, 2025
aaa8024
Pass
danic85 Mar 9, 2025
5eb1866
Merge pull request #122 from makerforgetech/feature/tests
danic85 Mar 9, 2025
3c2b2b5
Merge branch 'makerforgetech:main' into SentryBOT-V5-Disorganized
SentryCoderDev May 19, 2025
45acccb
Refactor ArduinoSerial and RobustSerial modules to remove MOTOR handl…
SentryCoderDev May 19, 2025
21cc415
Implement remote vision system with tracking and training capabilities
SentryCoderDev May 19, 2025
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
38 changes: 38 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- Thanks for submitting a new change request, please fill out the following template to help us review your PR. [Read the documentation on how to contribute to this project](https://github.com/makerforgetech/modular-biped/wiki/Contributing) BEFORE creating a PR! -->

## What type of change is this?
- [ ] New module
- [ ] Change to an existing module
- [ ] Core improvement
- [ ] Other (please describe)

## 📝 What does this change do?
<!-- Clearly and concisely describe the purpose of this PR. What feature, fix, or improvement does it add? -->

## ❓ Why is this change needed?
<!-- Explain the problem this solves or the motivation behind this change. -->

## 🛠️ How was this implemented?
<!-- Summarize the approach, design decisions, and key changes made. -->

## 🧪 How was this tested?
<!-- Describe how you verified the behavior of your changes (e.g., unit tests, integration tests, manual testing). Has it been tested using the latest release of the project? If not, it will need to be tested before it is reviewed. -->

## 💥 Breaking changes
<!-- Does this change affect existing functionality or APIs? If so, explain what changes and how to mitigate them. -->
- [ ] Yes (please describe)
- [ ] No

## 🗂 Related issues
<!-- Link any related issues (e.g., "Closes #123", "Fixes #456"). -->

## ✅ PR Checklist
- [ ] **Title & Description:** PR title and description are clear and complete.
- [ ] **Documentation:** PR links to idea in github discussion group containing complete documentation.
- [ ] **Scope & Size:** PR is focused on a single issue/feature and is a reasonable size.
- [ ] **Code Quality:** Code is clean, consistent, and follows the project style guide.
- [ ] **Tests:** Tests have been added/updated if needed.
- [ ] **Manual Testing:** Changes have been tested on the latest release of the project.
- [ ] **Self-Review:** I’ve reviewed my own code and ensured there are no obvious issues.

🚀 Thank you for your contribution to the project!
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Python Unittest on PR

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
run-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Run unittests
run: |
python -m unittest discover -s tests -p 'test_*.py'

permissions:
pull-requests: write
contents: read
233 changes: 43 additions & 190 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,190 +1,43 @@
[![Companion Robot](https://circleci.com/gh/danic85/companion-robot.svg?style=shield)](https://app.circleci.com/pipelines/github/danic85/companion-robot)

# Robotics Development Framework
This platform has been created to allow modular development and experimentation of robotics in python / C++ using the Raspberry Pi and Arduino.

## Coral TPU Accelerator

To use the Googla Coral USB Accelerator, first flash the Pi SD card with the image found in the [AIY Maker Kit](https://aiyprojects.withgoogle.com/maker/)
([Download as of 2022-08-05](https://github.com/google-coral/aiy-maker-kit-tools/releases/download/v20220518/aiy-maker-kit-2022-05-18.img.xz))

(I attempted to install the required software from the coral [getting started guide](https://coral.ai/docs/accelerator/get-started#1-install-the-edge-tpu-runtime) but I was unable to get past an error relating to grpico "GLIBC_2.29' not found")

Alternatively, set Config.vision.tech to `opencv` for the original (slower) facial recognition. I am not updating this anymore so you may find some integration issues.

## Installation
```
chmod 777 install.sh
./install.sh
```

Disable audio (see Neopixels section below)

## Running
```
./startup.sh
```
To execute manual control via keyboard:
```
./manual_startup.sh
```
To execute startup including a preview of the video feed (not available via SSH):
```
./preview_startup.sh
```

###Testing
```
python3 -m pytest --cov=modules --cov-report term-missing
```

## Run on Startup

Execute `sudo vim /etc/rc/local` and add the following lines before the `exit 0` statement:
```
python3 /home/archie/companion-robot/shutdown_pi.py
/home/archie/companion-robot/startup.sh
```

### Auto shutdown
GPIO 26 is wired to allow shutdown when brought to ground via a switch.

The script `shutdown_pi.py` manages this.

Guide:
https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi

## Features

### Facial detection and tracking
Using the Raspberry Pi camera

### Servo control
Control of up to 9 servos via an arduino serial connection

### Battery monitor
Both external and software integrated via the arduino serial connection

### Buzzer
A buzzer is connected to GPIO 27 to allow for tones to be played in absence of audio output (see Neopixel below).
https://github.com/gumslone/raspi_buzzer_player.git

### Motion Sensor
An RCWL-0516 microwave radar sensor is equipped on GPIO 13

### Stereo MEMS Mics
GPIO 18, 19 and 20 allow stereo MEMS microphones as audio input
```
Mic 3V to Pi 3.3V
Mic GND to Pi GND
Mic SEL to Pi GND (this is used for channel selection, connect to either 3.3V or GND)
Mic BCLK to BCM 18 (pin 12)
Mic DOUT to BCM 20 (pin 38)
Mic LRCL to BCM 19 (pin 35)
```
https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-test


```
cd ~
sudo pip3 install --upgrade adafruit-python-shell
wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/i2smic.py
sudo python3 i2smic.py
```

####Test
`arecord -l`
`arecord -D plughw:0 -c2 -r 48000 -f S32_LE -t wav -V stereo -v file_stereo.wav`

_Note:_ See below for additional configuration to support voice recognition

### Speech Recognition
Trigger word for voice recognition (currently not used):
https://snowboy.kitt.ai/

Speech recognition is enabled whenever a face is visible.
Ensure that the `device_index` specified in `modules/speechinput.py` matches your microphone.

See `scripts/speech.py` to list input devices and test. See below for MEMS microphone configuration

### MEMS Microphone configuration for speech recognition

By default the Adafruit I2S MEMS Microphone Breakout does not work with speech recognition.

To support voice recognition on the MEMS microphone(s) the following configuration changes are needed.

`sudo apt-get install ladspa-sdk`

Create `/etc/asound.conf` with the following content:

```
pcm.pluglp {
type ladspa
slave.pcm "plughw:0"
path "/usr/lib/ladspa"
capture_plugins [
{
label hpf
id 1042
}
{
label amp_mono
id 1048
input {
controls [ 30 ]
}
}
]
}

pcm.lp {
type plug
slave.pcm pluglp
}
```

This enables the device 'lp' to be referenced in voice recognition. Shown with index `18` in the example below.

Sample rate should also be set to `16000`

`mic = sr.Microphone(device_index=18, sample_rate=16000)`

References:

* [MEMS Microphone Installation Guide](https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-test)

* [Adafruit Support discussing issue](https://forums.adafruit.com/viewtopic.php?f=50&t=181675&p=883853&hilit=MEMS#p883853)

* [Referenced documentation of fix](https://github.com/mpromonet/v4l2rtspserver/issues/94)

### Serial communication with Arduino

In order to use the Raspberry Pi’s serial port, we need to disable getty (the program that displays login screen)

`sudo raspi-config -> Interfacing Options -> Serial -> "Would you like a login shell to be accessible over serial" = 'No'. Restart`

#### Connection via serial pins
Connect the Pi GPIO 14 & 15 (tx & rx) to the arduino tx & rx (tx -> rx in both directions!) via a logic level shifter, as the Pi is 3v3 and the arduino is (most likely) 5v.

####Upload to Arduino over serial pins
To upload over serial pins, press the reset button on the Arduino at the point that the IDE starts 'uploading' (after compile), otherwise a sync error will display.

### Neopixel

WS1820B support is included via the Pi GPIO pin 12. Unfortunately to support this you must disable audio on the Pi.

```
sudo vim /boot/config.txt
#dtparam=audio=on
```

This is also why the application must be executed with `sudo`

https://learn.adafruit.com/neopixels-on-raspberry-pi/python-usage

## PCBs
Prefabricated PCBs are available for this project in the `circuits` folder. This allows the connection between the core components as described above.

![Top](circuits/v2/Upper/Top%20Feb%202021_pcb.png)

![Bottom](circuits/v2/Lower/Lower%20Feb%202021_pcb.png)
# Open Source, 3D Printable, Modular Bipedal Robot Project

The **Modular Bipedal Robot** project aims to educate and inspire individuals interested in robotics and electronics. This open-source initiative focuses on creating a fully autonomous companion robot with a variety of advanced features.

## Key Features

- **Bipedal Design**: The robot includes articulated legs for bipedal movement.
- **Control Systems**: Utilizes Arduino and Raspberry Pi, managed through custom PCBs.
- **Modular Body**: Configurable body components allow for easy customization and adaptability.
- **Software Modules**:
- Animation: Handles the animation of the robot, including walking, turning, and other movements.
- Braillespeak: Converts text to Braille and speaks it using a proprietary audio output using the onboard buzzer.
- Buzzer: Controls the buzzer for audio output. Includes the ability to play tones and melodies.
- ChatGPT: Uses the OpenAI GPT models to process text based on user input.
- Logging: Logs data to a file for debugging and analysis.
- Motion Detection: Handles motion detection using an onboard microwave motion sensor.
- Neopixel: Controls the onboard Neopixel LEDs for visual feedback.
- PiServo: Controls the servos connected to the Raspberry Pi.
- PiTemperature: Reads the temperature from the integrated temperature sensor on the Raspberry Pi.
- RTLSDR: Uses an RTL-SDR dongle to receive and process radio signals.
- Serial Connection: Handles serial communication between the Raspberry Pi and Arduino.
- Servos: Controls the servos connected to the Arduino via the Raspberry Pi and the serial connection.
- Tracking: Uses computer vision to track objects and faces using the onboard camera.
- Translator: Translates text between languages using the Google Translate API.
- TTS: Converts text to speech using the onboard speaker.
- Viam: Uses the VIAM API to integrate Viam modules for additional functionality.
- Vision: Handles image processing and computer vision tasks using the onboard IMX500 Raspberry Pi AI camera.
- [Read more](https://github.com/makerforgetech/modular-biped/wiki/Software#modules)!

## Project Background

The Modular Biped Robot Project is designed to provide a flexible and modular framework for robotics development using Python and C++ on the Raspberry Pi and Arduino platforms. It aims to enable developers, robotics enthusiasts, and curious individuals to experiment, create, and customize their own biped robots. With a range of features and functionalities and the option to add your own easily, the Modular Biped Robot Project offers an exciting opportunity to explore the world of robotics.

## Modularity

The open source framework is designed for flexibility, allowing users to easily add or remove components to suit their specific needs. Comprehensive [guides](https://github.com/makerforgetech/modular-biped/wiki/Software#creating-a-module) are provided for integrating new modules seamlessly.

## Resources

- **Documentation**: For detailed information, visit the project’s GitHub wiki: [Modular Biped Documentation](https://github.com/makerforgetech/modular-biped/wiki)
- **Code**: Check out the modular open source software on [GitHub](https://github.com/makerforgetech/modular-biped)
- **YouTube Playlist**: Explore the development process through our build videos: [Watch on YouTube](https://www.youtube.com/watch?v=2DVJ5xxAuWY&list=PL_ua9QbuRTv6Kh8hiEXXVqywS8pklZraT)
- **Community**: Have a question or want to show off your build? Join the communities on [GitHub](https://bit.ly/maker-forge-community) and [Discord](https://bit.ly/makerforge-community)!
4 changes: 4 additions & 0 deletions Software Architecture.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
8 changes: 5 additions & 3 deletions config/neopixel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ neopixel:
enabled: true
path: 'modules.neopixel.neopx.NeoPx'
config:
pin: None # GPIO2 and 3 are use for i2c
i2c: True
pin: 12 # Only used for GPIO. GPIO2 and 3 are use for i2c, GPIO10 is used for SPI, GPIO12 is used for GPIO
protocol: 'I2C' # choose between GPIO, I2C and SPI
count: 12
positions: {
'status1': 0,
Expand Down Expand Up @@ -36,6 +36,8 @@ neopixel:
dependencies:
python:
- pypubsub
- adafruit-circuitpython-seesaw
- adafruit-circuitpython-seesaw # i2c SUPPORT
- adafruit-blinka # SPI SUPPORT
- adafruit-circuitpython-neopixel-spi # SPI SUPPORT
emotion_analysis:
enable: false
3 changes: 1 addition & 2 deletions config/vision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ vision:
unix:
- imx500-all
python:
- python3-opencv
- python3-munkres
- opencv-python
11 changes: 11 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ UNIX_DEPENDENCIES=()
ADDITIONAL_URLS=()
ACTIVE_MODULES=()

# Install yaml package for Python
myenv/bin/python3 -m pip install pyyaml

# Helper function to parse dependencies from YAML files using Python
parse_dependencies() {
myenv/bin/python3 - <<EOF
Expand Down Expand Up @@ -77,6 +80,7 @@ done

# Set execute permissions for additional scripts
chmod 777 startup.sh stop.sh
chmod 777 installers/*.sh

# Summary of modules and dependencies installed
echo -e "\n==== Installation Summary ===="
Expand All @@ -101,4 +105,11 @@ for dep in "${UNIQUE_ADDITIONAL_URLS[@]}"; do
echo " - $dep"
done
fi

# Tell the user about autolaunch
echo -e "\nTo enable autolaunch on boot, run the following command:"
echo "installer/autolaunch.sh enable"
echo "To disable autolaunch, run:"
echo "installer/autolaunch.sh disable"

echo "============================="
Loading
Loading