Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4c8c7d9
WIP bus servo management
danic85 Jul 12, 2025
d18189c
Update config
danic85 Jul 12, 2025
60d524a
Added SC servo examples + compatibility
danic85 Jul 13, 2025
3e4dfc0
Configure initial positions
danic85 Jul 14, 2025
0be65a3
Allow other poses to be stored and accessed
danic85 Jul 14, 2025
91fac95
Added change_id script
danic85 Aug 3, 2025
69f2d7c
Calibrate servos on boot
danic85 Oct 4, 2025
9a57f8a
adjustments
danic85 Oct 4, 2025
0cf906e
Dynamic servo calibration + center on change_id
danic85 Oct 5, 2025
8d62b54
Controller support and WIP recording
danic85 Dec 13, 2025
f02d0db
Working with Pi
danic85 Dec 13, 2025
b052ed0
Adjust config
danic85 Dec 13, 2025
6841f63
Cleanup
danic85 Dec 14, 2025
c1ed384
Working input recorder
danic85 Dec 14, 2025
5e503e5
Support servo control (WIP - calibration needed)
danic85 Dec 14, 2025
008c369
Callibration + allow modules to be disabled on test environments
danic85 Dec 15, 2025
af0fdb2
Disable test
danic85 Dec 15, 2025
40040c8
Add documentation and tests
danic85 Dec 16, 2025
f645caa
Fix test
danic85 Dec 16, 2025
8a22781
Timeout controller connection after 30 seconds
danic85 Dec 16, 2025
d81c07c
Enable on robot
danic85 Dec 16, 2025
6a84d43
Fix for environment input to resolve pi issue
danic85 Dec 17, 2025
4803d58
Calibrate new leg position
danic85 Dec 17, 2025
dc4cb27
Improvements to gamepad controller modules. Temperature alert in disp…
danic85 Dec 18, 2025
d48ccd8
Fix tests
danic85 Dec 18, 2025
4a5a0ee
Fixes and improvements to loop and temperature management
danic85 Dec 21, 2025
5349956
Fix tests
danic85 Dec 21, 2025
cd4331b
Resolve PR comments
danic85 Dec 21, 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
Prev Previous commit
Next Next commit
Controller support and WIP recording
  • Loading branch information
danic85 committed Dec 13, 2025
commit 8d62b543080e2085435c72289dba87f9dde0630c
100 changes: 100 additions & 0 deletions config/controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
controller:
enabled: true
path: 'modules.controller.Controller'
dependencies:
python:
- inputs
# sudo systemctl enable xboxdrv.service
#
unix:
- xboxdrv
config:
deadzone: 500
button_action_map:
default:
BTN_TL:
- topic: ''
args: {}
BTN_TR:
- topic: ''
args: {}
BTN_SELECT:
- topic: 'record/stop'
args: {}
BTN_START:
- topic: 'record/start'
args: {}
KEY_RECORD: # Only on Xbox S/X remotes
- topic: ''
args: {}
BTN_MODE: # Xbox Logo
- topic: ''
args: {}
ABS_HAT0X: # DPAD X (-1, 0 or 1)
- topic: ''
args: {}
ABS_HAT0Y: # DPAD Y (-1, 0 or 1)
- topic: ''
args: {}
BTN_SOUTH: # A
- topic: 'tts'
msg: 'Test Default'
BTN_NORTH: # X
- topic: 'eye/blink'
args: {}
BTN_WEST: # Y
- topic: ''
args: {}
BTN_EAST: # B
- topic: ''
args: {}
ABS_RX:
- topic: 'servo:pan:mv'
args: {}
deadzone: 200
modifier:
scale: 1.0
ABS_RY:
- topic: 'servo:tilt:mv'
args: {}
modifier:
scale: 1.0
ABS_X:
- topic: 'eye/look'
args: {axis: 'x'}
modifier:
scale: 0.03
ABS_Y:
- topic: 'eye/look'
args: {axis: 'y'}
modifier:
scale: 0.03
ABS_Z: # Left trigger
- topic: ''
args: {}
ABS_RZ: # Right trigger
- topic: ''
args: {}
BTN_BL:
BTN_SOUTH:
- topic: 'tts'
msg: 'Left Shoulder Held'
ABS_X:
- topic: 'servo:leg_l_ankle:mv'
modifier:
scale: 1.0
- topic: 'servo:leg_r_ankle:mv'
modifier:
scale: -1.0
- topic: 'servo:leg_l_knee:mv'
modifier:
scale: 1.0
- topic: 'servo:leg_r_knee:mv'
modifier:
scale: -1.0
- topic: 'servo:leg_l_hip:mv'
modifier:
scale: 1.0
- topic: 'servo:leg_r_hip:mv'
modifier:
scale: -1.0
2 changes: 1 addition & 1 deletion config/gpio_laser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
motion:
enabled: true
enabled: false
path: 'modules.gpio.laser.Laser'
config:
pin: 6
Expand Down
2 changes: 1 addition & 1 deletion config/gpio_motion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gpio_motion:
enabled: true
enabled: false
path: 'modules.gpio.motion.Motion'
config:
pin: 9
Expand Down
5 changes: 5 additions & 0 deletions config/input_recorder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
input_recorder:
enabled: false
path: modules.input_recorder.InputRecorder
config:
animations_dir: animations/recorded
2 changes: 1 addition & 1 deletion config/piservo.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
piservo:
enabled: true
enabled: false
path: modules.actuators.piservo.PiServo
instances:
- name: "ear"
Expand Down
2 changes: 1 addition & 1 deletion config/pitemperature.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pitemperature:
enabled: true
enabled: false
path: modules.pitemperature.PiTemperature
70 changes: 70 additions & 0 deletions config/servo_bus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
servos:
enabled: false
path: "modules.actuators.bus_servo.servo.Servo" # Include class name here
instances:
- name: "leg_r_tilt"
model: 'ST3215'
id: 1
range: [978, 3343]
start: 3187
poses:
- stand: 1269
- sit: 2048
- centre: 2048
- name: "leg_r_hip"
model: 'ST3215'
id: 3
range: [763, 2843]
start: 1336
poses:
- stand: 824
- sit: 1269
- centre: 2048
- name: "leg_r_knee"
model: 'ST3215'
id: 2
range: [750, 3297]
start: 1345
poses:
- stand: 2111
- sit: 723
- centre: 2048
- name: "leg_r_ankle"
model: 'ST3215'
id: 6
range: [2459, 3872]
start: 2762
poses:
- stand: 3721
- sit: 3721
- centre: 2048
- name: "neck_pan"
model: 'SC09'
id: 4
range: [96, 716]
start: 511
- name: "neck_tilt"
model: 'SC09'
id: 5
range: [171, 955]
start: 511
- name: "leg_l_tilt"
model: 'ST3215'
id: 7
range: [812, 2076]
start: 1093
- name: "leg_l_hip"
model: 'ST3215'
id: 8
range: [1700, 3371]
start: 2688
- name: "leg_l_knee"
model: 'ST3215'
id: 9
range: [1725, 3404]
start: 2643
- name: "leg_l_ankle"
model: 'ST3215'
id: 10
range: [874, 2270]
start: 1566
46 changes: 0 additions & 46 deletions config/servo_waveshare.yml

This file was deleted.

4 changes: 2 additions & 2 deletions config/tft_display.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tft_display:
enabled: true
enabled: false
path: modules.display.tft_display_eye.TFTDisplayEye
config:
bus: 0 # Use `ls /dev/spi*` to identify. (/dev/spidev0.0) is bus 0, device 0
Expand All @@ -8,7 +8,7 @@ tft_display:
dc_pin: 25
bl_pin: 18 # Not used if no backlight pin on device
rotation: -90.0
test_on_boot: true
test_on_boot: false
colors:
red: (255, 32, 32)
blue: (0, 245, 255)
Expand Down
2 changes: 1 addition & 1 deletion config/vision_imx500.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vision_imx500:
enabled: true
enabled: false
path: 'modules.vision.imx500.vision.Vision'
config:
preview: false
Expand Down
10 changes: 7 additions & 3 deletions docs/BusServo.md
100644 β†’ 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Serial bus servos allow for efficient communication and control of multiple serv

## Configuration

The `config/servo_waveshare.yml` file contains the configuration for each bus servo. The `instances` section defines the servos, their IDs, and their initial positions. The `poses` section within each instance defines various poses that can be used to set servo positions.
The `config/servo_bus.yml` file contains the configuration for each bus servo. The `instances` section defines the servos, their IDs, and their initial positions. The `poses` section within each instance defines various poses that can be used to set servo positions.

## Getting Started
## Getting Started / Calibration

To calibrate the servos, each must have their ID set individually. To achieve this, connect one servo to the driver board and run `modules/actuators/bus_servo/change_id.py`. This script will prompt you to enter the ID for the connected servo, which will then be saved permanently on the servo.

Expand All @@ -23,6 +23,8 @@ The servos range is between 0-4095 for ST servos and 0-1024 for SC servos. The p

The `change_id.py` script will set the servo to the midpoint when changing the ID. The servo should then be mounted in the robot at roughly the midpoint position.

You can also enable `center_on_boot` for each servo in the configuration file, which will move the servo to the center of its range on initialization.


### Calibration
To calibrate the servo positions, set the flag `calibrate_on_boot` to `true` in the configuration file for each instance (servo). This will cause the servo to output it's current position in the debug log, which can then be copied into the start position, or range. Servos can be manually moved to any position to identify their range or certain poses.
Expand All @@ -31,6 +33,8 @@ Note: `calibrate_on_boot` is enabled by default to help with initial configurati

Once the start position and range are set, move the flag to the next servo and repeat the process until all servos are calibrated.

You can then copy the output values directly from the log into the configuration file.

Finally, set `calibrate_on_boot` to false and re-run the program to start using the servos with their configured positions.

### Demonstration
Expand All @@ -49,7 +53,7 @@ Because the `Servo` class gets the current position of the servo on initializati

## SC vs ST servos

The `Servo` class supports both ST and SC series servos from Waveshare. The type of servo is determined by the `model` variable in the configuration file. The class will automatically use the appropriate SDK for the specified servo type.
The `Servo` class supports both ST and SC series servos from Waveshare and compatible servos. The type of servo is determined by the `model` variable in the configuration file. The class will automatically use the appropriate SDK for the specified servo type.

There are some limitations to the SC servos as they do not support continuous rotation and have a lower rotational range compared to the ST servos.

Expand Down
Loading