Boboter
Loading...
Searching...
No Matches
bumpers.h
Go to the documentation of this file.
1
7
8#pragma once
9
10#include <cstdint>
11#include <soc/gpio_num.h>
12#include "include/log_sources.h"
13
14class Robot;
15
16namespace Device {
17 class Bumpers {
18 private:
19 static constexpr const char* TAG = "Device::Bumpers";
20 static constexpr log_source LOG_SOURCE = LOG_SOURCE_DEVICE_BUMPERS;
21
22 static constexpr gpio_num_t LEFT_PIN = GPIO_NUM_35;
23 static constexpr gpio_num_t RIGHT_PIN = GPIO_NUM_34;
24
25 Robot& robot;
26
27 public:
28 enum class bumper_id_t : uint8_t {
29 LEFT = 0,
31 };
32
33 public:
34 explicit Bumpers(Robot& robot);
35 ~Bumpers();
36
40 void initialize();
41
47 [[nodiscard]] bool is_hit(bumper_id_t bumper_id) const;
48 };
49}
Bumpers(Robot &robot)
Definition bumpers.cpp:13
~Bumpers()
Definition bumpers.cpp:19
bumper_id_t
Definition bumpers.h:28
@ RIGHT
Definition bumpers.h:30
@ LEFT
Definition bumpers.h:29
bool is_hit(bumper_id_t bumper_id) const
Checks if the bumper is hit.
Definition bumpers.cpp:45
void initialize()
Sets up the necessary GPIO pins.
Definition bumpers.cpp:23
Class containing all the components of the robot.
Definition robot.h:32
log_source
Definition log_sources.h:12
@ LOG_SOURCE_DEVICE_BUMPERS
Definition log_sources.h:25
Definition battery.cpp:14