Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
6#include "timings.hpp"
7#include "debugUtils.hpp"
8
14
19
20void setup() {
21 Serial.begin(9600);
22 DEBUG_PRINT("Starting up...");
25 // state_calculation_timer.begin([]() {
26 // noInterrupts();
27 // digitalReceiver.digitalReads();
28 // as_state.calculateState();
29 // interrupts();
30 // }, STATE_CALCULATION_INTERVAL); // Ensuring 50ms intervals beween state calculations
31
35}
36
The ASState class manages and transitions between different states of the vehicle system.
void calculateState()
Calculates the state of the vehicle.
State state
Current state of the vehicle system, initialized to OFF.
Class that contains definitions of typical messages to send via CAN It serves only as an example of t...
static int publish_mission(int mission_id)
Publish AS Mission to CAN.
void init()
Initializes the CAN bus.
static SystemData * _systemData
static int publish_state(int state_id)
Publish AS State to CAN.
Class responsible for the reading of the digital inputs into the Master teensy.
void digitalReads()
read all digital inputs
Class responsible for controlling digital outputs in the Master Teensy.
Our own implementation of Metro class.
Definition metro.h:13
void reset()
Resets the timer to the current time.
Definition metro.h:125
bool check()
Checks if the interval has passed and resets the timer if true.
Definition metro.h:91
#define DEBUG_PRINT(str)
Metro mission_timer
Definition main.cpp:16
Communicator communicator
Definition main.cpp:10
ASState as_state
Definition main.cpp:13
void setup()
Definition main.cpp:20
DigitalSender digitalSender
Definition main.cpp:12
Metro rl_rpm_timer
Definition main.cpp:15
DigitalReceiver digitalReceiver
Definition main.cpp:11
Metro state_timer
Definition main.cpp:17
SystemData systemData
Definition main.cpp:9
IntervalTimer state_calculation_timer
Definition main.cpp:18
void loop()
Definition main.cpp:37
The whole model of the system: holds all the data necessary.
DigitalData digitalData
Mission mission
constexpr auto MISSION_PUBLISH_INTERVAL
Definition timings.hpp:6
constexpr auto LEFT_WHEEL_PUBLISH_INTERVAL
Definition timings.hpp:4
constexpr auto STATE_PUBLISH_INTERVAL
Definition timings.hpp:5