Skip to content

Commit f5628ef

Browse files
committed
Merge branch 'master' of https://github.com/UBC-Thunderbots/Software into william/thunderloop_refactor
2 parents 8b252c2 + 83fe79a commit f5628ef

196 files changed

Lines changed: 1063 additions & 2331 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/working_with_hardware/useful-robot-commands.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@ This will stop the current Systemd services, replace and restart them. Binaries
7777
<b>This will trigger motor calibration meaning the wheels may spin. Please elevate the robot so the wheels are not touching the ground for proper calibration.</b>
7878

7979
```bash
80-
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot --//software/embedded:motor_board=<motor_board> -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>
80+
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot -- --playbook deploy_robot_software.yml --hosts <robot_ip> --ssh_pass <robot_password>
8181
```
8282

83-
* <motor_board> is the type of motor driver board on the robot (either `STSPIN` or `TRINAMIC`)
8483
* <robot_ip> is the IP address of the robot
8584
* <robot_password> is the password of the `robot` user account
8685

@@ -155,7 +154,7 @@ Deploys the STSPIN Motor Controller Test binary onto a robot through Ansible.
155154
From Software/src:
156155

157156
```bash
158-
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot --//software/embedded:motor_board=STSPIN -- --playbook deploy_stspin_motor_controller_test.yml --hosts <robot_name> --ssh_pass <robot_password>
157+
bazel run //software/embedded/ansible:run_ansible --platforms=//toolchains/cc:robot -- --playbook deploy_stspin_motor_controller_test.yml --hosts <robot_name> --ssh_pass <robot_password>
159158
```
160159

161160
* replace the \<robot_ip\> with the actual ip address of the Raspberry Pi for the ssh connection.

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[tool.ruff]
2+
target-version = "py312"
3+
4+
[tool.ruff.lint]
5+
extend-select = ["I", "F403", "F405"]

scripts/lint_and_format.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,13 @@ function run_bazel_formatting () {
6363
function run_ruff() {
6464
printf "Running ruff to lint and format Python files...\n\n"
6565

66-
/opt/tbotspython/bin/python3 -m ruff check $BAZEL_ROOT_DIR --fix-only --extend-select D
66+
/opt/tbotspython/bin/python3 -m ruff check $BAZEL_ROOT_DIR --fix && \
6767
/opt/tbotspython/bin/python3 -m ruff format $BAZEL_ROOT_DIR
6868

6969
if [[ "$?" != 0 ]]; then
7070
printf "\n***Failed to lint/format Python files!***\n\n"
7171
exit 1
7272
fi
73-
74-
# F403: https://docs.astral.sh/ruff/rules/undefined-local-with-import-star/
75-
# F405: https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage/
76-
/opt/tbotspython/bin/python3 -m ruff check $BAZEL_ROOT_DIR --select F403,F405
77-
78-
if [[ "$?" != 0 ]]; then
79-
printf "\n***Wildcard imports should not be used (F403/F405)!***\n\n"
80-
exit 1
81-
fi
8273
}
8374

8475
function run_code_spell(){

src/MODULE.bazel

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,6 @@ git_repository(
223223
remote = "https://github.com/UBC-Thunderbots/MDv6_Firmware.git",
224224
)
225225

226-
http_archive(
227-
name = "trinamic",
228-
build_file = "@//extlibs:trinamic.BUILD",
229-
sha256 = "4c1640a87347afdc4d5954752f0e773f6d9fbb0ea0fb1481dbdb3012ec00ef8b",
230-
strip_prefix = "TMC-API-0cd695fab6d43ceb121af4b8608e5d92b14e1ce9",
231-
url = "https://github.com/analogdevicesinc/TMC-API/archive/0cd695fab6d43ceb121af4b8608e5d92b14e1ce9.tar.gz",
232-
)
233-
234226
http_archive(
235227
name = "cppcrc",
236228
build_file = "@//extlibs:cppcrc.BUILD",

src/cli/cli_params.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
from enum import Enum
2-
from typing import Annotated
3-
from dataclasses import dataclass
4-
import questionary
51
import os
62
import sys
3+
from dataclasses import dataclass
4+
from enum import Enum
5+
from typing import Annotated
76

8-
from typer import Argument, Option
9-
7+
import questionary
108
from cli.multi_option import MultiOption
9+
from typer import Argument, Option
1110

1211

1312
class ActionArgument(str, Enum):
@@ -333,7 +332,7 @@ def load_history() -> list[str]:
333332
return []
334333
with open(InteractiveCli.HISTORY_FILE) as f:
335334
lines = [line.strip() for line in f.readlines()]
336-
return [l.replace("\\n", "\n") for l in lines if l]
335+
return [line.replace("\\n", "\n") for line in lines if line]
337336

338337
@staticmethod
339338
def save_to_history(cmd_title: str, cmd_str: str):

src/cli/multi_option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from typing import Any
2+
23
import click
34
import typer
45
import typer.core
56
import typer.main
67
from typer.models import OptionInfo
78

8-
99
# ======= Patch to support nargs functionality in typer =======
1010
# nargs usage is considered bad practice in typer and many CLIs,
1111
# but since we likely want to be able to parse many optional args at once, this patch allows us to do so.

src/extlibs/trinamic.BUILD

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/proto/import_all_protos.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import importlib
22
import pkgutil
3+
34
import proto
45

56

src/proto/message_translation/tbots_protobuf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from __future__ import annotations
22

3+
import math
4+
5+
import numpy
36
import proto.import_all_protos as protos
47
import software.python_bindings as tbots_cpp
5-
import numpy
6-
import math
78

89

910
def create_world_state(

src/proto/robot_status_msg.proto

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -80,40 +80,19 @@ enum ErrorCode
8080

8181
enum MotorFault
8282
{
83-
/*********** TMC Faults ************/
84-
// Refer to Trinamic 6100 datasheet for precise definitions of motor faults.
85-
// https://trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC6100_datasheet_Rev1.00.pdf
86-
// (Section 5.1, p22-23)
87-
RESET = 0;
88-
DRIVER_OVERTEMPERATURE_PREWARNING = 1;
89-
DRIVER_OVERTEMPERATURE = 2;
90-
UNDERVOLTAGE_CHARGEPUMP = 3;
91-
PHASE_U_SHORT_COUNTER_DETECTED = 4;
92-
PHASE_U_SHORT_TO_GND_DETECTED = 5;
93-
PHASE_U_SHORT_TO_VS_DETECTED = 6;
94-
// for the sake of consistency with the TMC 6100, "7" is unused
95-
PHASE_V_SHORT_COUNTER_DETECTED = 8;
96-
PHASE_V_SHORT_TO_GND_DETECTED = 9;
97-
PHASE_V_SHORT_TO_VS_DETECTED = 10;
98-
// for the sake of consistency with the TMC 6100, "11" is unused
99-
PHASE_W_SHORT_COUNTER_DETECTED = 12;
100-
PHASE_W_SHORT_TO_GND_DETECTED = 13;
101-
PHASE_W_SHORT_TO_VS_DETECTED = 14;
102-
103-
// TODO: #3749 Move this to its own proto.
104-
/*********** STSPIN Faults ************/
105-
NO_FAULT = 15;
106-
DURATION = 16;
107-
OVER_VOLT = 17;
108-
UNDER_VOLT = 18;
109-
OVER_TEMP = 19;
110-
START_UP = 20;
111-
SPEED_FDBK = 21;
112-
OVER_CURR = 22;
113-
SW_ERROR = 23;
114-
SAMPLE_FAULT = 24;
115-
OVERCURR_SW = 25;
116-
DP_FAULT = 26;
83+
reserved 13 to 26;
84+
NO_FAULT = 0;
85+
DURATION = 1;
86+
OVER_VOLT = 2;
87+
UNDER_VOLT = 3;
88+
OVER_TEMP = 4;
89+
START_UP = 5;
90+
SPEED_FDBK = 6;
91+
OVER_CURR = 7;
92+
SW_ERROR = 8;
93+
SAMPLE_FAULT = 9;
94+
OVERCURR_SW = 10;
95+
DP_FAULT = 11;
11796
}
11897

11998
message DriveUnit

0 commit comments

Comments
 (0)