Skip to content

Commit

Permalink
Update spike
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLocatelli committed Dec 15, 2023
1 parent 4adaa67 commit 770188b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions spikes/lk_auto_charge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ target_link_libraries(spike_lk_auto_charge
CoreI2C
IMUKit
BLEKit
BehaviorKit
)

target_link_custom_leka_targets(spike_lk_auto_charge)
11 changes: 11 additions & 0 deletions spikes/lk_auto_charge/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "BLEServiceCommands.h"

#include "BatteryKit.h"
#include "BehaviorKit.h"
#include "CoreBattery.h"
#include "CoreI2C.h"
#include "CoreLSM6DSOX.hpp"
Expand All @@ -24,6 +25,7 @@
#include "LogKit.h"
#include "MathUtils.h"
#include "SealStrategy.h"
#include "behaviors/AutochargeSeal.h"

using namespace std::chrono;
using namespace leka;
Expand Down Expand Up @@ -100,6 +102,10 @@ auto service_commands = BLEServiceCommands {};
auto services = std::to_array<interface::BLEService *>({&service_commands});
auto blekit = BLEKit {};

auto behavior_autocharge_seal = behavior::AutochargeSeal {motors::left::motor, motors::right::motor, imukit};

auto behavior_kit = BehaviorKit {event_loop};

auto seal_strategy =
SealStrategy {event_loop, timeout, battery::cells, motors::left::motor, motors::right::motor, imukit};
auto happy_toupie = HappyToupie {event_loop, timeout, battery::cells, motors::left::motor, motors::right::motor};
Expand Down Expand Up @@ -146,6 +152,11 @@ auto main() -> int
service_commands.onCommandsReceived([](std::span<uint8_t> _buffer) { runStrategy(_buffer[0]); });
blekit.init();

auto behaviors = std::to_array<interface::Behavior *>({&behavior_autocharge_seal});
behavior_kit.registerBehaviors(behaviors);

behavior_kit.start(behavior_id::autocharge_seal);

while (true) {
rtos::ThisThread::sleep_for(10min);
}
Expand Down

0 comments on commit 770188b

Please sign in to comment.