bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
infrared_line_follower.h
Go to the documentation of this file.
1#ifndef BITSIM_CONTROL_INFRARED_LINE_FOLLOWER_H
2#define BITSIM_CONTROL_INFRARED_LINE_FOLLOWER_H
3
5
6namespace bitsim
7{
8namespace sensors
9{
10class InfraredSensor;
11}
12
13namespace control
14{
15
22{
23 real_t v{0.0};
25};
26
44{
45 public:
53
56
61
65 bool is_lost() const noexcept { return lost_for_ > 0.0; }
66
70 bool has_given_up() const noexcept { return lost_for_ > p_.lost_time; }
71
72 const Parameters &parameters() const noexcept { return p_; }
73
74 private:
75 Parameters p_{};
76 real_t last_side_{0.0};
77 real_t lost_for_{0.0};
78};
79
80} // namespace control
81} // namespace bitsim
82
83#endif // BITSIM_CONTROL_INFRARED_LINE_FOLLOWER_H
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
bool has_given_up() const noexcept
True when no element has seen the line for longer than lost_time.
Definition infrared_line_follower.h:70
InfraredLineFollower(const Parameters &parameters)
Definition infrared_line_follower.h:55
const Parameters & parameters() const noexcept
Definition infrared_line_follower.h:72
DiffDriveCommand command(const sensors::InfraredSensor &ir, real_t dt)
The command for the elements' last reading, dt [s] after the last command.
Definition infrared_line_follower.cpp:11
bool is_lost() const noexcept
True when no element saw the line at the last command.
Definition infrared_line_follower.h:65
An array of infrared reflectance elements that looks at the floor, to tell its colour: light paper or...
Definition infrared_sensor.h:33
Controllers: PID controllers, line following, a quadrotor flight controller, a fixed wing autopilot,...
Definition control_module.h:18
Definition infrared_line_follower.h:9
Definition dc_motor_backend_base.h:9
double real_t
real_t
Definition bitsim_types.h:20
What a differential drive robot is told to do: drive at v [m/s] and turn at omega [rad/s],...
Definition infrared_line_follower.h:22
real_t v
Definition infrared_line_follower.h:23
real_t omega
Definition infrared_line_follower.h:24
Definition infrared_line_follower.h:47
real_t cruise_speed
[m/s] with the line under the middle
Definition infrared_line_follower.h:48
real_t search_turn_rate
[rad/s] while looking for the line
Definition infrared_line_follower.h:50
real_t line_turn_rate
[rad/s] with only an outer element on the line
Definition infrared_line_follower.h:49
real_t lost_time
[s] without the line before giving up
Definition infrared_line_follower.h:51