Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6108aa9bf6 | |||
| b590f157e1 | |||
| 0f2a0c65ba | |||
| 37474e840d | |||
| e1d37a907d |
@@ -262,8 +262,9 @@
|
||||
const rotatedXm = settings.xm * cosTotal - settings.zm * sinTotal
|
||||
const rotatedZm = settings.xm * sinTotal + settings.zm * cosTotal
|
||||
|
||||
const cosHead = Math.cos(headingYaw)
|
||||
const sinHead = Math.sin(headingYaw)
|
||||
const mpuHeadingRad = degToRad($mpu.heading)
|
||||
const cosHead = Math.cos(mpuHeadingRad)
|
||||
const sinHead = Math.sin(mpuHeadingRad)
|
||||
const rotatedCumX = body_state.cumulative_x * cosHead - body_state.cumulative_z * sinHead
|
||||
const rotatedCumZ = body_state.cumulative_x * sinHead + body_state.cumulative_z * cosHead
|
||||
|
||||
|
||||
@@ -31,7 +31,11 @@ class I2CBus {
|
||||
bus_cfg.scl_io_num = scl;
|
||||
bus_cfg.clk_source = I2C_CLK_SRC_DEFAULT;
|
||||
bus_cfg.glitch_ignore_cnt = 7;
|
||||
#if CONFIG_IDF_TARGET_ESP32P4
|
||||
bus_cfg.flags.enable_internal_pullup = false;
|
||||
#else
|
||||
bus_cfg.flags.enable_internal_pullup = true;
|
||||
#endif
|
||||
|
||||
esp_err_t err = i2c_new_master_bus(&bus_cfg, &_bus);
|
||||
if (err != ESP_OK) {
|
||||
@@ -64,7 +68,7 @@ class I2CBus {
|
||||
if (!_initialized) return ESP_ERR_INVALID_STATE;
|
||||
esp_err_t err = ensureDevice(addr);
|
||||
if (err != ESP_OK) return err;
|
||||
return i2c_master_transmit(_dev, data, len, pdMS_TO_TICKS(100));
|
||||
return i2c_master_transmit(_dev, data, len, pdMS_TO_TICKS(200));
|
||||
}
|
||||
|
||||
esp_err_t writeReg(uint8_t addr, uint8_t reg, const uint8_t* data, size_t len) {
|
||||
@@ -77,19 +81,19 @@ class I2CBus {
|
||||
if (len > 0 && data != nullptr) {
|
||||
memcpy(buf + 1, data, len);
|
||||
}
|
||||
return i2c_master_transmit(_dev, buf, len + 1, pdMS_TO_TICKS(100));
|
||||
return i2c_master_transmit(_dev, buf, len + 1, pdMS_TO_TICKS(200));
|
||||
}
|
||||
|
||||
esp_err_t readReg(uint8_t addr, uint8_t reg, uint8_t* data, size_t len) {
|
||||
if (!_initialized) return ESP_ERR_INVALID_STATE;
|
||||
esp_err_t err = ensureDevice(addr);
|
||||
if (err != ESP_OK) return err;
|
||||
return i2c_master_transmit_receive(_dev, ®, 1, data, len, pdMS_TO_TICKS(100));
|
||||
return i2c_master_transmit_receive(_dev, ®, 1, data, len, pdMS_TO_TICKS(200));
|
||||
}
|
||||
|
||||
bool probe(uint8_t addr) {
|
||||
if (!_initialized) return false;
|
||||
return i2c_master_probe(_bus, addr, pdMS_TO_TICKS(50)) == ESP_OK;
|
||||
return i2c_master_probe(_bus, addr, pdMS_TO_TICKS(200)) == ESP_OK;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> scan(uint8_t lower = 1, uint8_t upper = 127) {
|
||||
|
||||
@@ -143,8 +143,8 @@ A PyBullet-based physics simulation is available for algorithm development and r
|
||||
|
||||
```bash
|
||||
cd simulation
|
||||
pip install -r requirements.txt
|
||||
python play.py
|
||||
uv sync
|
||||
uv run play.py
|
||||
```
|
||||
|
||||
Features:
|
||||
@@ -245,7 +245,7 @@ Complete build instructions are available in the documentation:
|
||||
**Build and flash:**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/runeharlyk/SpotMicroESP32-Leika
|
||||
git clone --recurse-submodules https://github.com/runeharlyk/SpotMicroESP32-Leika
|
||||
cd SpotMicroESP32-Leika
|
||||
|
||||
cd app
|
||||
@@ -264,8 +264,8 @@ To experiment with the simulation environments without hardware:
|
||||
|
||||
```bash
|
||||
cd simulation
|
||||
pip install -r requirements.txt
|
||||
python play.py
|
||||
uv sync
|
||||
uv run play.py
|
||||
```
|
||||
|
||||
For development workflows and contribution guidelines, see [docs/6_developing.md](docs/6_developing.md) and [docs/7_contributing.md](docs/7_contributing.md).
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
3.13
|
||||
@@ -0,0 +1,21 @@
|
||||
[project]
|
||||
name = "simulation-leika"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"gymnasium>=1.2.3",
|
||||
"matplotlib>=3.10.9",
|
||||
"msgpack>=1.1.2",
|
||||
"numpy>=2.4.4",
|
||||
"onnx>=1.21.0",
|
||||
"onnxruntime>=1.26.0",
|
||||
"pybullet>=3.2.7",
|
||||
"stable-baselines3[extra]>=2.0.0",
|
||||
"tensorboard>=2.20.0",
|
||||
"tensorflow>=2.21.0",
|
||||
"torch>=2.11.0",
|
||||
"tqdm>=4.67.3",
|
||||
"websockets>=16.0",
|
||||
]
|
||||
@@ -1,14 +0,0 @@
|
||||
torch
|
||||
onnx
|
||||
onnxruntime
|
||||
tensorflow
|
||||
numpy
|
||||
matplotlib
|
||||
pybullet
|
||||
websockets
|
||||
msgpack
|
||||
asyncio
|
||||
gymnasium
|
||||
stable-baselines3[extra]>=2.0.0
|
||||
tensorboard
|
||||
tqdm
|
||||
@@ -1,24 +0,0 @@
|
||||
from src.envs.quadruped_env import QuadrupedEnv
|
||||
from training.model import SimpleNN
|
||||
|
||||
import resources as resources
|
||||
|
||||
|
||||
def main():
|
||||
env = QuadrupedEnv(resources.getDataPath() + "/spot.urdf")
|
||||
env.reset()
|
||||
|
||||
input_size = env.robot.get_observation().shape[0]
|
||||
output_size = env.robot.get_observation().shape[0]
|
||||
agent = SimpleNN(input_size, output_size)
|
||||
|
||||
done = False
|
||||
observation = []
|
||||
|
||||
while not done:
|
||||
action = agent.select_action(observation)
|
||||
observation, reward, done = env.step(action)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Generated
+1724
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user