Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
inspection_functions.hpp
Go to the documentation of this file.
1#ifndef INSPECTION_FUNCTIONS_HPP
2#define INSPECTION_FUNCTIONS_HPP
3
4#define MAX_THROTTLE (1.0)
5#define MAX_ANGLE 0.34 // 22.5 degrees in rad
6
7#include <chrono>
8#include <cmath>
9#include <functional>
10#include <memory>
11#include <string>
12
13constexpr double WHEELS_STOPPED_THRESHOLD = 0.2;
14
16public:
17 // default to EBS test values
19 double ideal_velocity_ = 2.0;
20 double turning_period_ = 4.0;
21 double wheel_radius_ = 0.254;
22 double gain_ = 0.05;
23 double finish_time_ = 26.0;
25 bool start_and_stop_ = false;
26
28 bool stop_oscilating_ = false;
29
36 double calculate_steering(double time) const;
37
44 double calculate_throttle(double current_velocity) const;
45
52 double rpm_to_velocity(double rpm) const;
53
60 void redefine_goal_velocity(double current_velocity);
61
68 double throttle_to_adequate_range(double throttle) const;
69
75
90 InspectionFunctions(double max_angle, double turning_period, double wheel_radius,
91 double finish_time, bool start_and_stop, double gain = 0.0,
92 double ideal_velocity = 0.0);
93};
94
95#endif // INSPECTION_FUNCTIONS_HPP
void redefine_goal_velocity(double current_velocity)
used when in oscilation mode to redefine the ideal velocity
double calculate_throttle(double current_velocity) const
calculate torque output according to velocity
bool stop_oscilating_
Used to stop the oscilation near zero and avoid violent wheel movements.
double throttle_to_adequate_range(double throttle) const
convert the throttle to a range between -1 and 1
double rpm_to_velocity(double rpm) const
convert rpm [rotations/minute] to velocity [m/s]
double calculate_steering(double time) const
calculate the steering angle according to time
InspectionFunctions()
Construct a new Inspection Functions object.
#define MAX_ANGLE
constexpr double WHEELS_STOPPED_THRESHOLD