![]() |
Galaxis Codebase
1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
|
#include <ECUHandler.hpp>
Public Member Functions | |
| ECUHandler () | |
| ~ECUHandler () | |
| uint32_t | calculateChecksum (ComputerPacket const &packet) |
| uint32_t | calculateChecksum (SettingsPacket const &packet) |
| void | init (PublishMeasurementsCallback cb) |
| Provides the handler with a connection to the ECUNode to communicate via ROS. More... | |
| void | TransmitPacket (SettingsPacket &packet) |
| This function transmits a packet to the ECU. More... | |
| void | TransmitPacket (ComputerPacket &packet) |
| This function transmits a packet to the ECU. More... | |
Private Types | |
| enum | ButtonType { BTN_SC1 = 1, BTN_SC2 = 1 << 1, BTN_SC3 = 1 << 2 } |
| enum | DrivingModeType { UNDEFINED, WITH_OBSTACLES, WITHOUT_OBSTACLES } |
Private Member Functions | |
| void | InitializeCommunication () |
| void | ReceiveHandler () |
| void | onNewPacketReceived (const EcuPacket *const) |
| void | Stop () |
Private Attributes | |
| std::chrono::steady_clock::time_point | current_timestamp |
| std::chrono::steady_clock::time_point | last_timestamp |
| size_t | difference_index |
| std::array< std::chrono::duration< double, std::milli >, 10 > | packet_differences |
| ComputerPacket | m_lastEcuPacket |
| PublishMeasurementsCallback | cb_ |
| std::thread * | receiverThread = nullptr |
| bool | receiverThreadRunning = true |
| std::mutex | mutex_on_packet |
| EcuPacket | currentPacket |
| ComputerPacket | m_computerPacket |
| bool | firstPacketReceived |
| std::shared_ptr< ICommunication > | m_pCommunication = nullptr |
Definition at line 36 of file ECUHandler.hpp.
|
private |
| Enumerator | |
|---|---|
| BTN_SC1 | |
| BTN_SC2 | |
| BTN_SC3 | |
Definition at line 76 of file ECUHandler.hpp.
|
private |
| Enumerator | |
|---|---|
| UNDEFINED | |
| WITH_OBSTACLES | |
| WITHOUT_OBSTACLES | |
Definition at line 82 of file ECUHandler.hpp.
|
inline |
Definition at line 38 of file ECUHandler.hpp.
|
inline |
Definition at line 41 of file ECUHandler.hpp.
References m_pCommunication, and Stop().

| uint32_t ECUHandler::calculateChecksum | ( | ComputerPacket const & | packet | ) |
Definition at line 13 of file ECUHandler.cpp.
References ComputerPacket.
Referenced by TransmitPacket().

| uint32_t ECUHandler::calculateChecksum | ( | SettingsPacket const & | packet | ) |
| void ECUHandler::init | ( | PublishMeasurementsCallback | cb | ) |
Provides the handler with a connection to the ECUNode to communicate via ROS.
| cb | Function pointer to callback function |
Definition at line 31 of file ECUHandler.cpp.
References cb_, InitializeCommunication(), and xlog.

|
private |
Definition at line 81 of file ECUHandler.cpp.
References firstPacketReceived, m_pCommunication, ReceiveHandler(), receiverThread, receiverThreadRunning, and xlog.
Referenced by init().


|
private |
Definition at line 65 of file ECUHandler.cpp.
References cb_, packet_differences, and xlog.
Referenced by ReceiveHandler().

|
private |
Definition at line 102 of file ECUHandler.cpp.
References current_timestamp, currentPacket, difference_index, EcuPacket, firstPacketReceived, gcu8_header, last_timestamp, m_pCommunication, onNewPacketReceived(), packet_differences, receiverThreadRunning, and xlog.
Referenced by InitializeCommunication().


|
private |
Definition at line 75 of file ECUHandler.cpp.
References receiverThread, and receiverThreadRunning.
Referenced by ~ECUHandler().

| void ECUHandler::TransmitPacket | ( | ComputerPacket & | packet | ) |
This function transmits a packet to the ECU.
TODO
Definition at line 37 of file ECUHandler.cpp.
References calculateChecksum(), ComputerPacket, gcu8_header, m_lastEcuPacket, m_pCommunication, PACKET_ID_COMPUTER, and xlog.

| void ECUHandler::TransmitPacket | ( | SettingsPacket & | packet | ) |
This function transmits a packet to the ECU.
TODO
Definition at line 51 of file ECUHandler.cpp.
References calculateChecksum(), gcu8_header, m_pCommunication, PACKET_ID_SETTINGS, SettingsPacket, and xlog.

|
private |
Definition at line 94 of file ECUHandler.hpp.
Referenced by init(), and onNewPacketReceived().
|
private |
Definition at line 71 of file ECUHandler.hpp.
Referenced by ReceiveHandler().
|
private |
Definition at line 109 of file ECUHandler.hpp.
Referenced by ReceiveHandler().
|
private |
Definition at line 73 of file ECUHandler.hpp.
Referenced by ReceiveHandler().
|
private |
Definition at line 111 of file ECUHandler.hpp.
Referenced by InitializeCommunication(), and ReceiveHandler().
|
private |
Definition at line 72 of file ECUHandler.hpp.
Referenced by ReceiveHandler().
|
private |
Definition at line 110 of file ECUHandler.hpp.
|
private |
Definition at line 88 of file ECUHandler.hpp.
Referenced by TransmitPacket().
|
private |
Definition at line 117 of file ECUHandler.hpp.
Referenced by InitializeCommunication(), ReceiveHandler(), TransmitPacket(), and ~ECUHandler().
|
private |
Definition at line 102 of file ECUHandler.hpp.
|
private |
Definition at line 74 of file ECUHandler.hpp.
Referenced by onNewPacketReceived(), and ReceiveHandler().
|
private |
Definition at line 100 of file ECUHandler.hpp.
Referenced by InitializeCommunication(), and Stop().
|
private |
Definition at line 101 of file ECUHandler.hpp.
Referenced by InitializeCommunication(), ReceiveHandler(), and Stop().