space_vehicle.h
Go to the documentation of this file.
/*
* Copyright © 2012-2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef LOCATION_SERVICE_COM_LOMIRI_LOCATION_SPACE_VEHICLE_H_
#define LOCATION_SERVICE_COM_LOMIRI_LOCATION_SPACE_VEHICLE_H_
#include <com/lomiri/location/units/units.h>
#include <iostream>
#include <map>
namespace com
{
namespace lomiri
{
namespace location
{
struct SpaceVehicle
{
typedef std::uint32_t Id;
enum class Type
{
unknown,
beidou,
galileo,
glonass,
gps,
compass,
irnss,
qzss
};
struct Key
{
Type type = Type::unknown;
Id id = 0;
inline bool operator==(const SpaceVehicle::Key& rhs) const
{
return type == rhs.type && id == rhs.id;
}
inline bool operator<(const SpaceVehicle::Key& rhs) const
{
if (type != rhs.type)
return type < rhs.type;
return id < rhs.id;
}
};
inline bool operator==(const SpaceVehicle& rhs) const
{
return key == rhs.key &&
has_almanac_data == rhs.has_almanac_data &&
has_ephimeris_data == rhs.has_ephimeris_data &&
used_in_fix == rhs.used_in_fix &&
units::roughly_equals(azimuth, rhs.azimuth) &&
units::roughly_equals(elevation, rhs.elevation);
}
inline bool operator<(const SpaceVehicle& rhs) const
{
return key < rhs.key;
}
Key key;
float snr = -std::numeric_limits<float>::max();
bool has_almanac_data = false;
bool has_ephimeris_data = false;
bool used_in_fix = false;
units::Quantity<units::PlaneAngle> azimuth;
units::Quantity<units::PlaneAngle> elevation;
};
inline std::ostream& operator<<(std::ostream& out, const SpaceVehicle& sv)
{
static const std::map<SpaceVehicle::Type, std::string> lut =
{
{SpaceVehicle::Type::unknown, "unknown"},
{SpaceVehicle::Type::beidou, "beidou"},
{SpaceVehicle::Type::galileo, "galileo"},
{SpaceVehicle::Type::glonass, "glonass"},
{SpaceVehicle::Type::gps, "gps"},
{SpaceVehicle::Type::compass, "compass"},
{SpaceVehicle::Type::irnss, "irnss"},
{SpaceVehicle::Type::qzss, "qzss" }
};
return out << "("
<< "type: " << lut.at(sv.key.type) << ", "
<< "prn: " << sv.key.id << ", "
<< "snr: " << sv.snr << ", "
<< "has_almanac_data: " << sv.has_almanac_data << ", "
<< "has_ephimeris_data: " << sv.has_ephimeris_data << ", "
<< "used_in_fix: " << sv.used_in_fix << ", "
<< "azimuth: " << sv.azimuth << ", "
<< "elevation: " << sv.elevation
<< ")";
}
}
}
}
#endif // LOCATION_SERVICE_COM_LOMIRI_LOCATION_SPACE_VEHICLE_H_
com::lomiri::location::units::Quantity
boost::units::quantity< Unit, double > Quantity
Definition units.h:60
com::lomiri::location::units::roughly_equals
bool roughly_equals(const Quantity< Unit > &lhs, const Quantity< Unit > &rhs)
Definition units.h:69
com::lomiri::location
Definition accuracy.h:28
com::lomiri::location::operator<<
std::ostream & operator<<(std::ostream &out, const Accuracy< T > &update)
Definition accuracy.h:68
com::lomiri
Definition accuracy.h:26
com
Definition accuracy.h:24
com::lomiri::location::SpaceVehicle::Key
Uniquely identifies a space vehicle, given its type and its id.
Definition space_vehicle.h:53
com::lomiri::location::SpaceVehicle::Key::id
Id id
Unique id of the space vehicle.
Definition space_vehicle.h:55
com::lomiri::location::SpaceVehicle::Key::operator<
bool operator<(const SpaceVehicle::Key &rhs) const
Definition space_vehicle.h:62
com::lomiri::location::SpaceVehicle::Key::operator==
bool operator==(const SpaceVehicle::Key &rhs) const
Definition space_vehicle.h:57
com::lomiri::location::SpaceVehicle::Key::type
Type type
The positioning system this vehicle belongs to.
Definition space_vehicle.h:54
com::lomiri::location::SpaceVehicle
A space-vehicle as visible to providers.
Definition space_vehicle.h:34
com::lomiri::location::SpaceVehicle::Type
Type
Enumerates all known space-vehicle types.
Definition space_vehicle.h:40
com::lomiri::location::SpaceVehicle::Type::gps
@ gps
Fully operational worldwide.
Definition space_vehicle.h:45
com::lomiri::location::SpaceVehicle::Type::galileo
@ galileo
A global system being developed by the European Union and other partner countries,...
Definition space_vehicle.h:43
com::lomiri::location::SpaceVehicle::Type::qzss
@ qzss
Japanese regional system covering Asia and Oceania.
Definition space_vehicle.h:48
com::lomiri::location::SpaceVehicle::Type::compass
@ compass
People's Republic of China's global system, planned to be operational by 2020.
Definition space_vehicle.h:46
com::lomiri::location::SpaceVehicle::Type::glonass
@ glonass
Russia's global navigation system. Fully operational worldwide.
Definition space_vehicle.h:44
com::lomiri::location::SpaceVehicle::Type::unknown
@ unknown
Unknown (and thus invalid) type.
Definition space_vehicle.h:41
com::lomiri::location::SpaceVehicle::Type::irnss
@ irnss
India's regional navigation system, planned to be operational by 2014, covering India and Northern In...
Definition space_vehicle.h:47
com::lomiri::location::SpaceVehicle::Type::beidou
@ beidou
People's Republic of China's regional system, currently limited to Asia and the West Pacific.
Definition space_vehicle.h:42
com::lomiri::location::SpaceVehicle::key
Key key
Unique key identifying an instance.
Definition space_vehicle.h:86
com::lomiri::location::SpaceVehicle::operator==
bool operator==(const SpaceVehicle &rhs) const
Definition space_vehicle.h:71
com::lomiri::location::SpaceVehicle::azimuth
units::Quantity< units::PlaneAngle > azimuth
Azimuth of SV.
Definition space_vehicle.h:91
com::lomiri::location::SpaceVehicle::has_almanac_data
bool has_almanac_data
Almanac data available for this vehicle.
Definition space_vehicle.h:88
com::lomiri::location::SpaceVehicle::Id
std::uint32_t Id
Numeric Id of an individual SpaceVehicle.
Definition space_vehicle.h:36
com::lomiri::location::SpaceVehicle::operator<
bool operator<(const SpaceVehicle &rhs) const
Definition space_vehicle.h:81
com::lomiri::location::SpaceVehicle::elevation
units::Quantity< units::PlaneAngle > elevation
Elevation of SV.
Definition space_vehicle.h:92
com::lomiri::location::SpaceVehicle::used_in_fix
bool used_in_fix
This vehicle has been used to obtain a fix.
Definition space_vehicle.h:90
com::lomiri::location::SpaceVehicle::has_ephimeris_data
bool has_ephimeris_data
Ephimeris data is available for this vehicle.
Definition space_vehicle.h:89
com::lomiri::location::SpaceVehicle::snr
float snr
Signal to noise ratio;.
Definition space_vehicle.h:87
units.h