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
16 changes: 3 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,11 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/environment-setup

- name: Install and start redis server
run: |
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz >/dev/null
cd redis-stable
make >/dev/null
make install >/dev/null
redis-server --daemonize yes

- name: Stop redis server
- name: Environment Setup
run: |
redis-cli shutdown

"${GITHUB_WORKSPACE}"/environment_setup/setup_software.sh
- name: Jetson Nano Build
run: |
cd src
Expand Down
30 changes: 20 additions & 10 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,26 @@ Where `<platform>` is the robot platform you are deploying to (`PI` or `NANO`),
It is possible to run Thunderloop without having a fully-working robot. Using this mode is useful when testing features that don't require the power board or motors.

1. To run Thunderloop locally on your computer
1. First, you must ensure that `redis` is installed. Installation instructions can be found [here](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/). The result of these installation directions will likely enable `redis-server` as a service that starts on boot. You may want to run `sudo systemctl disable redis-server` to prevent this.
2. Next, run the command `redis-server` in a terminal.
3. Set up the following required REDIS constants by running the following commands in the terminal:
- `redis-cli set /robot_id "{robot_id}"` where `{robot_id}` is the robot's ID (e.g. `1`, `2`, etc.)
- `redis-cli set /network_interface "{network_interface}"` where `{network_interface}` is one of the interfaces listed by `ip a`.
- `redis-cli set /channel_id "{channel_id}"` where `{channel_id}` is the channel id of the robot (e.g. `1`, `2`, etc.)
- `redis-cli set /kick_coeff "{kick_coeff}"` where `{kick_coeff}` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
- `redis-cli set /kick_constant "{kick_constant}"` where `{kick_constant}` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
- `redis-cli set /chip_pulse_width "{chip_pulse_width}"` where `{chip_pulse_width}` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
4. Now, run Thunderloop with the following command:
1. Create a TOML configuration file in the opt/tbotspython directory with the following content (replace values as needed):
```toml
robot_id = "1"
channel_id = "0"
network_interface = "tbotswifi5"
kick_constant = "0"
kick_coeff = "0.0"
chip_pulse_width = "0"
battery_voltage = "0.0"
current_draw = "0.0"
cap_voltage = "0.0"
```
Where:
- `robot_id` is the robot's ID (e.g. `1`, `2`, etc.)
- `network_interface` is one of the interfaces listed by `ip a`.
- `channel_id` is the channel id of the robot (e.g. `1`, `2`, etc.)
- `kick_coeff` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
- `kick_constant` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
- `chip_pulse_width` is a calibrated kicking parameter. When running locally, this parameter doesn't matter so `0` is fine.
2. Now, run Thunderloop with the following command:
- `bazel run //software/embedded:thunderloop_main --//software/embedded:host_platform=LIMITED`

2. If you have a robot PC that doesn't have proper communication with the power or motor board, you can still run Thunderloop in a limited capacity to test software features (eg. networking).
Expand Down
6 changes: 3 additions & 3 deletions docs/robot-software-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [Tools](#tools)
- [Ansible](#ansible)
- [Systemd](#systemd)
- [Redis](#redis)
- [TOML Configuration](#toml-configuration)
- [Thunderloop](#thunderloop)

<!--TOC-->
Expand Down Expand Up @@ -39,9 +39,9 @@ More commands available [here](useful-robot-commands.md#off-robot-commands)

To learn more about how it works, [see the RFC](https://docs.google.com/document/d/1hN3Us2Vjr8z6ihqUVp_3L7rrjKc-EZ-l2hZJc31gNOc/edit)

## Redis
## TOML Configuration

[Redis](https://redis.io/docs/about/) is an in-memory key-value store. This allows us to share state between processes as well as modify values dynamically through the provided [cli](useful-robot-commands#redis). Values also persists between boots.
Robot configuration is stored in a TOML file in home directory. This file contains both static configuration values and dynamic runtime values.

# Thunderloop

Expand Down
42 changes: 0 additions & 42 deletions docs/useful-robot-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
- [On Robot Commands](#on-robot-commands)
- [Systemd Services](#systemd-services)
- [Debugging Uart](#debugging-uart)
- [Redis](#redis)

<!--TOC-->

Expand Down Expand Up @@ -63,14 +62,6 @@ flowchart TD
`service thunderloop restart`)
tloop_status --> |Running| tloop_logs(Check Thunderloop logs for errors
`journalctl -fu thunderloop -n 300`)
tloop_logs --> |No Errors| check_redis(Does `redis-cli get /network_interface` return 'wlan0' or 'tbots',
and does `redis-cli get /channel_id` return '0'?)
tloop_logs --> |Contains Errors| rip2("Fix errors or check errors with a lead")
check_redis --> |No| update_redis("Update Redis constants by running:
`redis-cli set /network_interface 'wlan0'` (for Nanos) OR `redis-cli set /network_interface 'tbots'` (for Pis)
`redis-cli set /channel_id '0'`")
check_redis --> |Yes| rip3(Check with a lead)
update_redis --> tloop_restart
tloop_restart --> tloop_status
end
```
Expand Down Expand Up @@ -256,36 +247,3 @@ If the serial_port is busy, screen will not launch and instead says `screen is t
Powerloop uart communication is encoded so you can't read it from screen and will appear as a mix of foreign characters

Pressing the reset button once will send a status msg over its connected port. This is useful for sanity checking.

## Redis

Current redis keys that are used are available in `software/constants.h`. Official Documentation [here](https://redis.io/docs/manual/cli/).

<b>Values should be strings. For example `set \ROBOT_ID "0"`</b>

Redis repl can be accessed through the following command.

```bash
redis-cli
```

Other common commands (once inside redis repl):

```bash
get <redis_key>
set <redis_key> <value>
```

To Exit:

```bash
quit
```

Alternative (without entering redis repl):

```bash
redis-cli get <redis_key>
redis-cli set <redis_key> <value>
```

20 changes: 5 additions & 15 deletions src/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,12 @@ use_repo(pybind11_configure, "pybind11")
###########################################################################
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Dep for cpp_redis
http_archive(
name = "tacopie",
sha256 = "bbdebecdb68d5f9eb64170217000daf844e0aee18b8c4d3dd373d07efd9f7316",
strip_prefix = "tacopie-master",
url = "https://github.com/cylix/tacopie/archive/master.zip",
)

# TODO(#3315): Used for on-robot value storage - deprecation soon
http_archive(
name = "cpp_redis",
sha256 = "12a6fc86ba4ca3d4537a3eee82c094f385b8e03e283c664c976f16d421f17f7d",
strip_prefix = "cpp_redis-fc2c43fa07e45e1ef0f77cbda6a240e7890ae5aa",
urls = [
"https://github.com/cpp-redis/cpp_redis/archive/fc2c43fa07e45e1ef0f77cbda6a240e7890ae5aa.zip",
],
name = "tomlplusplus",
build_file = "@//extlibs:tomlplusplus.BUILD",
sha256 = "8517f65938a4faae9ccf8ebb36631a38c1cadfb5efa85d9a72e15b9e97d25155",
strip_prefix = "tomlplusplus-3.4.0",
urls = ["https://github.com/marzer/tomlplusplus/archive/refs/tags/v3.4.0.tar.gz"],
)

http_archive(
Expand Down
Loading