Boboter
Loading...
Searching...
No Matches
Device::Linefollower Class Reference

#include <linefollower.h>

Public Types

enum class  linefollower_id_t : uint8_t { LEFT = 0 , RIGHT = 1 }
enum class  linefollower_result_t : uint8_t { BLACK = 0 , WHITE = 1 }

Public Member Functions

 Linefollower (Robot &robot)
 ~Linefollower ()
void initialize ()
 Sets up the necessary GPIO pin and ADC channel.
void measure ()
 Measures the currently seen color from both sensors.
linefollower_result_t get_left_sensor_color () const
 Get the last measured color from the left sensor.
linefollower_result_t get_right_sensor_color () const
 Get the last measured color from the right sensor.

Static Public Attributes

static constexpr uint16_t REFLECTIVITY_THRESHOLD = 2300

Member Enumeration Documentation

◆ linefollower_id_t

enum class Device::Linefollower::linefollower_id_t : uint8_t
strong
Enumerator
LEFT 
RIGHT 

◆ linefollower_result_t

enum class Device::Linefollower::linefollower_result_t : uint8_t
strong
Enumerator
BLACK 
WHITE 

Constructor & Destructor Documentation

◆ Linefollower()

Device::Linefollower::Linefollower ( Robot & robot)
explicit

◆ ~Linefollower()

Device::Linefollower::~Linefollower ( )

Member Function Documentation

◆ get_left_sensor_color()

linefollower_result_t Device::Linefollower::get_left_sensor_color ( ) const
inlinenodiscard

Get the last measured color from the left sensor.

Returns
The color last measured by the right sensor

◆ get_right_sensor_color()

linefollower_result_t Device::Linefollower::get_right_sensor_color ( ) const
inlinenodiscard

Get the last measured color from the right sensor.

Returns
The color last measured by the right sensor

◆ initialize()

void Device::Linefollower::initialize ( )

Sets up the necessary GPIO pin and ADC channel.

◆ measure()

void Device::Linefollower::measure ( )

Measures the currently seen color from both sensors.

Member Data Documentation

◆ REFLECTIVITY_THRESHOLD

uint16_t Device::Linefollower::REFLECTIVITY_THRESHOLD = 2300
staticconstexpr

The documentation for this class was generated from the following files: