38 sensor_option == GPSSensorOption::WithCovariance ||
39 sensor_option == GPSSensorOption::WithoutCovariance,
40 "Invalid GPSSensorOption");
41 explicit GPSSensor(
const std::string & name)
43 name, {{name +
"/" +
"status"},
44 {name +
"/" +
"service"},
45 {name +
"/" +
"latitude"},
46 {name +
"/" +
"longitude"},
47 {name +
"/" +
"altitude"}})
49 if constexpr (sensor_option == GPSSensorOption::WithCovariance)
51 interface_names_.emplace_back(name +
"/" +
"latitude_covariance");
52 interface_names_.emplace_back(name +
"/" +
"longitude_covariance");
53 interface_names_.emplace_back(name +
"/" +
"altitude_covariance");
62 int8_t
get_status()
const {
return static_cast<int8_t
>(state_interfaces_[0].get().get_value()); }
71 return static_cast<uint16_t
>(state_interfaces_[1].get().get_value());
79 double get_latitude()
const {
return state_interfaces_[2].get().get_value(); }
86 double get_longitude()
const {
return state_interfaces_[3].get().get_value(); }
93 double get_altitude()
const {
return state_interfaces_[4].get().get_value(); }
102 typename = std::enable_if_t<sensor_option == GPSSensorOption::WithCovariance, U>>
105 covariance_[0] = state_interfaces_[5].get().get_value();
106 covariance_[4] = state_interfaces_[6].get().get_value();
107 covariance_[8] = state_interfaces_[7].get().get_value();
122 if constexpr (sensor_option == GPSSensorOption::WithCovariance)
131 std::array<double, 9> covariance_{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};