Files
MicrOBU/microbu-esp32c5/external/vanetza-idf/vanetza/facilities/path_history.hpp
T
Ashin Walpola 0e9525162d 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).
2026-09-23 17:46:40 +02:00

104 lines
3.3 KiB
C++

#ifndef PATH_HISTORY_HPP_1ITSMS5I
#define PATH_HISTORY_HPP_1ITSMS5I
#include <vanetza/facilities/path_point.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/range/iterator_range.hpp>
#include <cstddef>
#include <list>
namespace vanetza
{
namespace facilities
{
// C2C-CC BSP RS_BSP_318 path history (Method One) parameters
extern const units::Length cTraceAllowableError;
extern const units::Length cTraceMaxDeltaDistance;
extern const units::Angle cTraceDeltaPhi;
/**
* Implementation of Path History Reference Design (Method One)
* \see NHTSA Document "VSC-A Final Report: Appendix B-2" from September 2011
*/
class PathHistory
{
public:
struct Parameters
{
units::Length allowable_error = cTraceAllowableError;
units::Length chord_length_threshold = cTraceMaxDeltaDistance;
units::Angle small_delta_phi = cTraceDeltaPhi;
units::Length retention_distance = 500.0 * units::si::meter;
};
PathHistory();
explicit PathHistory(const Parameters& params);
/**
* Consider one further path point for inclusion into path history
* \param a path point, expected to be newer than any previously given point
*/
void addSample(const PathPoint&);
/**
* Drop all samples and concise points, e.g. on pseudonym (AT) change
*/
void clear();
/**
* Get current reference point, i.e. last provided path point
* \return current reference point (fallback is a default constructed PathPoint)
*/
const PathPoint& getReferencePoint() const;
/**
* Get concise list of path points
* \note previously given path points are only included if the algorithm
* presented in above mentioned document as "Method One" selects them
* \return list of path points, some given points might be omitted
*/
const std::list<PathPoint>& getConcisePoints() const { return m_concise; }
/**
* Newest concise points covering at least a distance (crossing point included)
* \param distance minimum distance to cover
* \return view of the newest concise points
*/
boost::iterator_range<std::list<PathPoint>::const_iterator>
getConcisePointsMinLength(units::Length distance) const;
/// As above but capped at max_points
boost::iterator_range<std::list<PathPoint>::const_iterator>
getConcisePointsMinLength(units::Length distance, std::size_t max_points) const;
/**
* Newest concise points covering at most a distance (crossing point excluded)
* \param distance maximum distance to cover
* \return view of the newest concise points
*/
boost::iterator_range<std::list<PathPoint>::const_iterator>
getConcisePointsMaxLength(units::Length distance) const;
/// As above but capped at max_points
boost::iterator_range<std::list<PathPoint>::const_iterator>
getConcisePointsMaxLength(units::Length distance, std::size_t max_points) const;
private:
void updateConcisePoints();
void truncateConcisePoints();
const PathPoint& starting() const;
const PathPoint& previous() const;
const PathPoint& next() const;
Parameters m_params;
boost::circular_buffer<PathPoint> m_samples;
std::list<PathPoint> m_concise;
};
} // namespace facilities
} // namespace vanetza
#endif /* PATH_HISTORY_HPP_1ITSMS5I */