Files
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
obu-firmware builds against the vanetza-idf C-ITS library, which until now
came from the colleague's microbu-esp32c5 tree beside the repository and was
not tracked here, so a clone of this repository could not build the firmware
it ships. The library alone is now part of obu-firmware, as
obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit
cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from
there by default; -DVANETZA_IDF_DIR still points the build elsewhere.

The rest of the colleague's tree (their own VAM firmware, PKI tooling,
station-link Python tools, the V2X2MAP bridge) stays out of this repository
and gitignored; nothing is pushed to their repository. NOTES.md, docs/06,
TODO.md and the pcap verifier's usage line point at the new location.
2026-09-24 10:56:05 +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 */