Skip to content
Merged

Dev #11

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5997eb2
Simplify motor driver API and remove ownership handling
tunapro1234 Oct 16, 2025
626f200
fix(motor): correct inversion handling
tunapro1234 Oct 16, 2025
1b552c3
feat: add ui simulator variants
tunapro1234 Oct 16, 2025
9bd4118
feat(ui-testing): add variant suite and minimal stack enhancements
tunapro1234 Oct 16, 2025
c356bf3
style(ui-testing): balance minimal stack layout
tunapro1234 Oct 16, 2025
0eb0f52
fix(ui-testing): adjust state machine transitions
tunapro1234 Oct 16, 2025
9c7fa38
style(ui-testing): remove rounded seams from minimal stack
tunapro1234 Oct 16, 2025
cdf6e45
Adjust minimal stack header for mobile
tunapro1234 Oct 16, 2025
9afeaca
Refine minimal stack header responsiveness
tunapro1234 Oct 17, 2025
ad5377f
Tune portrait header behavior
tunapro1234 Oct 17, 2025
aa1f78a
Force compact header on portrait
tunapro1234 Oct 17, 2025
c252ff2
Keep compact header in portrait
tunapro1234 Oct 17, 2025
98e114a
Always use compact header
tunapro1234 Oct 17, 2025
4c41235
Simplify compact header styling
tunapro1234 Oct 17, 2025
f882fb0
Refine minimal UI theme and archive unused variants
tunapro1234 Oct 17, 2025
23231e6
Rename driver station UI title
tunapro1234 Oct 18, 2025
2874822
Remove settings link from driver station header
tunapro1234 Oct 18, 2025
9b9f26a
Add priority-aware serial/Wi-Fi logging and instrumentation
tunapro1234 Oct 18, 2025
6ea6ac4
Add priority-aware serial/Wi-Fi logging and instrumentation
tunapro1234 Oct 18, 2025
1909e95
Embed minimal stack driver UI
tunapro1234 Oct 18, 2025
92de64a
Merge branch 'dev-ui' into dev-logging
tunapro1234 Oct 18, 2025
09f3552
Hook logging transport into minimal UI with safe ring buffer
tunapro1234 Oct 18, 2025
ad62da8
refactor: remove motor handle abstraction
tunapro1234 Oct 18, 2025
f6b9813
examples: replace demos with unified VNH/closed-loop set
tunapro1234 Oct 18, 2025
d955233
Merge branch 'dev' into dev-logging
tunapro1234 Oct 19, 2025
11ef9de
Add LoggingDemo example to exercise new logging stack
tunapro1234 Oct 19, 2025
12f4e95
Add cross-platform build metadata and ESP-IDF support
tunapro1234 Oct 19, 2025
bfa61a6
chore(release): bump metadata for 0.1.4
tunapro1234 Oct 20, 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
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set(PROBOT_SRCS
src/core/runtime.cpp
src/core/scheduler.cpp
src/core/wdt.cpp
src/io/ui_input.cpp
src/platform/esp32s3/drivers/builtin_led_ws2812.cpp
src/probot/devices/motors/Boardoza_BA6208.cpp
src/probot/devices/motors/boardoza_ba6208_driver.cpp
src/probot/devices/motors/boardoza_vnh_motor_driver.cpp
src/probot/logging/logger.cpp
src/probot/logging/telemetry_profiles.cpp
src/probot/logging/wifi_transport_esp32.cpp
src/probot/robot/system.cpp
src/probot/sensors/imu/mpu6050.cpp
)

idf_component_register(
SRCS ${PROBOT_SRCS}
INCLUDE_DIRS "src"
REQUIRES arduino
)

target_compile_definitions(${COMPONENT_TARGET}
PUBLIC
ARDUINO=10820
ESP32
ESP32S3
)
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ FQBN ?= esp32:esp32:esp32s3
PORT ?= /dev/ttyACM0
BAUD ?= 115200
ARDUINO_CLI ?= arduino-cli
PYTHON ?= python3

VERSION_FILE := $(CURDIR)/VERSION
VERSION_SYNC_SCRIPT := $(CURDIR)/tools/sync_version.py

# Examples
EXAMPLES_DIR := $(CURDIR)/examples
Expand All @@ -15,6 +19,9 @@ BUILD_DIR_BASE := $(CURDIR)/.build

TEST_STUB_DIR := $(CURDIR)/tests/stubs
TEST_SOURCES := $(filter %.cpp,$(wildcard $(CURDIR)/tests/*.cpp))
TEST_EXTRA_SOURCES := \
$(CURDIR)/src/probot/logging/logger.cpp \
$(CURDIR)/src/probot/logging/telemetry_profiles.cpp

# Common flags
EXTRA_FLAGS_COMMON := -DESP32S3 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1
Expand Down Expand Up @@ -54,6 +61,7 @@ build-all:

_build_single:
@echo "==> Building $(EXAMPLE)"
$(PYTHON) $(VERSION_SYNC_SCRIPT)
$(ARDUINO_CLI) compile --fqbn $(FQBN) --warnings all \
--library $(CURDIR) \
--build-path $(BUILD_DIR_BASE)/$(EXAMPLE) \
Expand All @@ -78,8 +86,11 @@ boards:
libs:
arduino-cli lib install "Adafruit NeoPixel"

version-sync:
$(PYTHON) $(VERSION_SYNC_SCRIPT)

tests/control_tests: $(TEST_SOURCES)
g++ -std=c++17 -Wall -Wextra -pedantic -I src -I $(TEST_STUB_DIR) -DPROBOT_CLM_NOLOG=1 -DPROBOT_SCHED_NOLOG=1 -o $@ $(TEST_SOURCES)
g++ -std=c++17 -Wall -Wextra -pedantic -I src -I $(TEST_STUB_DIR) -DPROBOT_CLM_NOLOG=1 -DPROBOT_SCHED_NOLOG=1 -DPROBOT_LOGGER_NO_SCHED_ATTACH=1 -o $@ $(TEST_SOURCES) $(TEST_EXTRA_SOURCES)

test: build tests/control_tests
./tests/control_tests
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ Her örnek doğrudan çalışır durumda ve yorumlarla açıklanmıştır.

---

## Platform Desteği

- **Arduino IDE / arduino-cli:** `library.properties` ve `Makefile` üzerinden doğrudan desteklenir. `make build EXAMPLE=TankDriveDemo` komutu, `arduino-cli` ile örnekleri derler.
- **PlatformIO (Arduino framework):** Kütüphaneyi `lib_deps = /path/to/probot-lib` ya da Git URL'siyle ekleyin. `library.json` sürüm bilgisi `VERSION` dosyasından otomatik güncellenir.
- **ESP-IDF + Arduino bileşeni:** Depoyu IDF projenizin `components/` klasörüne yerleştirip `idf.py build` çalıştırabilirsiniz. `idf_component.yml` otomatik olarak Arduino bileşenine bağımlıdır; `app_main` içinde `probot::runtime_setup()` çağırarak Arduino dışındaki uygulamalarda da aynı robot yaşam döngüsünü başlatabilirsiniz.

Tüm platformlarda sürüm numarası `VERSION` dosyasından yönetilir; `make version-sync` çağrısı metadata dosyalarını günceller.

---

## Ne içeriyor?

Kütüphane şunları sağlar:
Expand Down Expand Up @@ -138,6 +148,16 @@ Every example runs out of the box and is documented with inline comments.

---

## Platform Support

- **Arduino IDE / arduino-cli:** build examples with `make build EXAMPLE=TankDriveDemo`; metadata comes from `library.properties`.
- **PlatformIO (Arduino framework):** add `lib_deps = /path/to/probot-lib` or the Git URL; `library.json` stays in sync with `VERSION`.
- **ESP-IDF with the Arduino component:** drop the repository under your project's `components/` directory (or use `idf_component.yml` via the component manager) and call `idf.py build`. Invoke `probot::runtime_setup()` from `app_main()` to reuse the Arduino lifecycle on pure ESP-IDF projects.

`make version-sync` keeps all manifests aligned with the single `VERSION` file.

---

## What's inside?

The library provides:
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.4
137 changes: 137 additions & 0 deletions examples/AutonomousDemo/AutonomousDemo.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#include <probot.h>
#include <probot/io/joystick_api.hpp>
#include <probot/control/closed_loop_motor.hpp>
#include <probot/control/pid.hpp>
#include <probot/chassis/basic_tank_drive.hpp>
#include <probot/devices/motors/boardoza_vnh_motor_driver.hpp>

// Otonom tank demo için iki adet VNH sürücüsü.
static constexpr int L_INA = 33;
static constexpr int L_INB = 34;
static constexpr int L_PWM = 35;
static constexpr int L_ENA = -1;
static constexpr int L_ENB = -1;

static constexpr int R_INA = 36;
static constexpr int R_INB = 37;
static constexpr int R_PWM = 38;
static constexpr int R_ENA = -1;
static constexpr int R_ENB = -1;

static probot::motor::BoardozaVNHMotorDriver leftDriver(L_INA, L_INB, L_PWM, L_ENA, L_ENB);
static probot::motor::BoardozaVNHMotorDriver rightDriver(R_INA, R_INB, R_PWM, R_ENA, R_ENB);
static probot::sensors::NullEncoder leftEncoder;
static probot::sensors::NullEncoder rightEncoder;

static const probot::control::PidConfig kPid{.kp = 0.32f, .ki = 0.015f, .kd = 0.0f, .kf = 0.0f,
.out_min = -1.0f, .out_max = 1.0f};
static probot::control::PID pidLeft(kPid);
static probot::control::PID pidRight(kPid);
static probot::control::ClosedLoopMotor motorLeft(&leftEncoder, &pidLeft, &leftDriver, 1.0f, 1.0f);
static probot::control::ClosedLoopMotor motorRight(&rightEncoder, &pidRight, &rightDriver, 1.0f, 1.0f);
static probot::drive::BasicTankDrive chassis(&motorLeft, &motorRight);

PROBOT_SET_DRIVER_STATION_PASSWORD("ProBot1234");

enum class AutoStep {
kDriveForward,
kPause,
kTurn,
kDriveToGoal,
kFinished
};

static AutoStep g_step = AutoStep::kDriveForward;
static uint32_t g_stepStart = 0;

void robotInit() {
Serial.begin(115200);
delay(100);

leftDriver.begin();
rightDriver.begin();
leftDriver.setBrakeMode(true);
rightDriver.setBrakeMode(true);

motorLeft.setTimeoutMs(0);
motorRight.setTimeoutMs(0);

chassis.setWheelCircumference(32.0f);
chassis.setTrackWidth(29.0f);

Serial.println("[AutonomousDemo] robotInit: Otonom örneği hazır");
}

void robotEnd() {
chassis.setVelocity(0.0f, 0.0f);
Serial.println("[AutonomousDemo] robotEnd: Motorlar durdu");
}

void teleopInit() {
Serial.println("[AutonomousDemo] teleopInit: Bu örnekte teleop, tank sürüşü sağlar");
}

void teleopLoop() {
auto js = probot::io::joystick_api::makeDefault();
float left = js.getLeftY() * 100.0f;
float right = js.getRightY() * 100.0f;
chassis.setVelocity(left, right);
chassis.update(millis(), 20);
delay(20);
}

void autonomousInit() {
Serial.println("[AutonomousDemo] autonomousInit: İleri -> Bekle -> 90° dön -> Hedefe git");
g_step = AutoStep::kDriveForward;
g_stepStart = millis();
chassis.driveDistance(80.0f); // 80 cm ileri
}

void autonomousLoop() {
uint32_t now = millis();

switch (g_step) {
case AutoStep::kDriveForward:
if (now - g_stepStart > 2500) {
g_step = AutoStep::kPause;
g_stepStart = now;
chassis.setVelocity(0.0f, 0.0f);
Serial.println("[AutonomousDemo] Duraklama");
}
break;

case AutoStep::kPause:
if (now - g_stepStart > 800) {
g_step = AutoStep::kTurn;
g_stepStart = now;
chassis.turnDegrees(90.0f);
Serial.println("[AutonomousDemo] 90 derece dönüş başlıyor");
}
break;

case AutoStep::kTurn:
if (now - g_stepStart > 2200) {
g_step = AutoStep::kDriveToGoal;
g_stepStart = now;
chassis.driveDistance(40.0f);
Serial.println("[AutonomousDemo] Hedefe son itiş");
}
break;

case AutoStep::kDriveToGoal:
if (now - g_stepStart > 2000) {
g_step = AutoStep::kFinished;
chassis.setVelocity(0.0f, 0.0f);
Serial.println("[AutonomousDemo] Otonom tamamlandı");
}
break;

case AutoStep::kFinished:
default:
chassis.setVelocity(0.0f, 0.0f);
break;
}

chassis.update(now, 20);
delay(20);
}
53 changes: 0 additions & 53 deletions examples/BasicTankDrive/BasicTankDrive.ino

This file was deleted.

Loading