Vanetza
Loading...
Searching...
No Matches
path_history.hpp
1#ifndef PATH_HISTORY_HPP_1ITSMS5I
2#define PATH_HISTORY_HPP_1ITSMS5I
3
4#include <vanetza/facilities/path_point.hpp>
5#include <boost/circular_buffer.hpp>
6#include <boost/range/iterator_range.hpp>
7#include <cstddef>
8#include <list>
9
10namespace vanetza
11{
12namespace facilities
13{
14
15// C2C-CC BSP RS_BSP_318 path history (Method One) parameters
16extern const units::Length cTraceAllowableError;
17extern const units::Length cTraceMaxDeltaDistance;
18extern const units::Angle cTraceDeltaPhi;
19
20/**
21 * Implementation of Path History Reference Design (Method One)
22 * \see NHTSA Document "VSC-A Final Report: Appendix B-2" from September 2011
23 */
25{
26public:
28 {
29 units::Length allowable_error = cTraceAllowableError;
30 units::Length chord_length_threshold = cTraceMaxDeltaDistance;
31 units::Angle small_delta_phi = cTraceDeltaPhi;
32 units::Length retention_distance = 500.0 * units::si::meter;
33 };
34
35 PathHistory();
36 explicit PathHistory(const Parameters& params);
37
38 /**
39 * Consider one further path point for inclusion into path history
40 * \param a path point, expected to be newer than any previously given point
41 */
42 void addSample(const PathPoint&);
43
44 /**
45 * Drop all samples and concise points, e.g. on pseudonym (AT) change
46 */
47 void clear();
48
49 /**
50 * Get current reference point, i.e. last provided path point
51 * \return current reference point (fallback is a default constructed PathPoint)
52 */
53 const PathPoint& getReferencePoint() const;
54
55 /**
56 * Get concise list of path points
57 * \note previously given path points are only included if the algorithm
58 * presented in above mentioned document as "Method One" selects them
59 * \return list of path points, some given points might be omitted
60 */
61 const std::list<PathPoint>& getConcisePoints() const { return m_concise; }
62
63 /**
64 * Newest concise points covering at least a distance (crossing point included)
65 * \param distance minimum distance to cover
66 * \return view of the newest concise points
67 */
69 getConcisePointsMinLength(units::Length distance) const;
70
71 /// As above but capped at max_points
73 getConcisePointsMinLength(units::Length distance, std::size_t max_points) const;
74
75 /**
76 * Newest concise points covering at most a distance (crossing point excluded)
77 * \param distance maximum distance to cover
78 * \return view of the newest concise points
79 */
81 getConcisePointsMaxLength(units::Length distance) const;
82
83 /// As above but capped at max_points
85 getConcisePointsMaxLength(units::Length distance, std::size_t max_points) const;
86
87private:
88 void updateConcisePoints();
89 void truncateConcisePoints();
90 const PathPoint& starting() const;
91 const PathPoint& previous() const;
92 const PathPoint& next() const;
93
94 Parameters m_params;
95 boost::circular_buffer<PathPoint> m_samples;
96 std::list<PathPoint> m_concise;
97};
98
99} // namespace facilities
100} // namespace vanetza
101
102#endif /* PATH_HISTORY_HPP_1ITSMS5I */
void addSample(const PathPoint &)
const PathPoint & getReferencePoint() const
boost::iterator_range< std::list< PathPoint >::const_iterator > getConcisePointsMinLength(units::Length distance, std::size_t max_points) 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
As above but capped at max_points.
const std::list< PathPoint > & getConcisePoints() const
boost::iterator_range< std::list< PathPoint >::const_iterator > getConcisePointsMinLength(units::Length distance) const
boost::iterator_range< std::list< PathPoint >::const_iterator > getConcisePointsMaxLength(units::Length distance) const