Keep the colleague's microbu-esp32c5 tree in this repository
obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
This commit is contained in:
+105
@@ -0,0 +1,105 @@
|
||||
#ifndef FULLY_MESHED_STATE_MACHINE_HPP_YPE958OH
|
||||
#define FULLY_MESHED_STATE_MACHINE_HPP_YPE958OH
|
||||
|
||||
#include <vanetza/common/clock.hpp>
|
||||
#include <vanetza/dcc/channel_load.hpp>
|
||||
#include <vanetza/dcc/state_machine.hpp>
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace vanetza
|
||||
{
|
||||
namespace dcc
|
||||
{
|
||||
|
||||
// constants
|
||||
static constexpr Clock::duration NDL_minDccSampling = std::chrono::milliseconds(100);
|
||||
|
||||
|
||||
class State
|
||||
{
|
||||
public:
|
||||
virtual Clock::duration transmission_interval() const = 0;
|
||||
virtual const char* name() const = 0;
|
||||
virtual ~State() {}
|
||||
};
|
||||
|
||||
class Relaxed : public State
|
||||
{
|
||||
public:
|
||||
Clock::duration transmission_interval() const override;
|
||||
const char* name() const override;
|
||||
};
|
||||
|
||||
class Active : public State
|
||||
{
|
||||
public:
|
||||
Active();
|
||||
void update(double min, double max);
|
||||
Clock::duration transmission_interval() const override;
|
||||
const char* name() const override;
|
||||
|
||||
private:
|
||||
static const std::size_t sc_substates;
|
||||
std::size_t m_substate;
|
||||
};
|
||||
|
||||
class Restrictive : public State
|
||||
{
|
||||
public:
|
||||
Clock::duration transmission_interval() const override;
|
||||
const char* name() const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fully meshed TRC state machine as per TS 102 687 v1.1.1
|
||||
*
|
||||
* States are modelled according to C2C-CC DCC Whitepaper / BSP v1.2
|
||||
* State transitions are deferred internally for ramping up and cooling down over time.
|
||||
*/
|
||||
class FullyMeshedStateMachine : public StateMachine
|
||||
{
|
||||
public:
|
||||
FullyMeshedStateMachine();
|
||||
~FullyMeshedStateMachine();
|
||||
|
||||
/**
|
||||
* Notify state machine about current channel load.
|
||||
* This method expects to be called in regular intervals
|
||||
* of NDL_minDccSampling length.
|
||||
*/
|
||||
void update(ChannelLoad channel_load);
|
||||
|
||||
/**
|
||||
* Get currently allowed maximum message rate depending on state
|
||||
* \return messages per second
|
||||
*/
|
||||
double message_rate() const;
|
||||
|
||||
/**
|
||||
* Get advised transmission interval between consecutive messages
|
||||
* \return message transmission interval
|
||||
*/
|
||||
Clock::duration transmission_interval() const;
|
||||
|
||||
/**
|
||||
* Get state machine's active state
|
||||
*/
|
||||
const State& state() const;
|
||||
|
||||
private:
|
||||
double max_channel_load() const;
|
||||
double min_channel_load() const;
|
||||
|
||||
Relaxed m_relaxed;
|
||||
Active m_active;
|
||||
Restrictive m_restrictive;
|
||||
State* m_state;
|
||||
boost::circular_buffer<ChannelLoad> m_channel_loads;
|
||||
};
|
||||
|
||||
} // namespace dcc
|
||||
} // namespace vanetza
|
||||
|
||||
#endif /* FULLY_MESHED_STATE_MACHINE_HPP_YPE958OH */
|
||||
|
||||
Reference in New Issue
Block a user