1 #ifndef __MARNAV__NMEA__XTR__HPP__
2 #define __MARNAV__NMEA__XTR__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(xtr
)
13 /// @brief XTR - Cross Track Error - Dead Reckoning
18 /// $--XTR,x.x,a,N*hh<CR><LF>
22 /// 1. Magnitude of cross track error
23 /// 2. Direction to steer
27 /// - N = Nautical Miles
29 class xtr
: public sentence
31 MARNAV_NMEA_SENTENCE_FRIENDS(xtr
)
34 constexpr static const sentence_id ID
= sentence_id::XTR
;
35 constexpr static const char * TAG
= "XTR";
38 xtr(const xtr
&) = default;
39 xtr
& operator=(const xtr
&) = default;
40 xtr(xtr
&&) = default;
41 xtr
& operator=(xtr
&&) = default;
44 xtr(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
45 virtual std::vector
<std::string
> get_data() const override
;
48 utils::optional
<double> cross_track_error_magnitude
;
49 utils::optional
<side
> direction_to_steer
;
50 utils::optional
<unit::distance
> cross_track_unit
;
53 decltype(cross_track_error_magnitude
) get_cross_track_error_magnitude() const
55 return cross_track_error_magnitude
;
57 decltype(direction_to_steer
) get_direction_to_steer() const { return direction_to_steer
; }
58 decltype(cross_track_unit
) get_cross_track_unit() const { return cross_track_unit
; }
60 void set_cross_track_error_magnitude(double t
) noexcept
62 cross_track_error_magnitude
= t
;
63 cross_track_unit
= unit::distance::nm
;
65 void set_direction_to_steer(side t
) noexcept
{ direction_to_steer
= t
; }