obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
85 lines
2.4 KiB
C++
85 lines
2.4 KiB
C++
#ifndef POSITION_VECTOR_HPP_WJAGEOCS
|
|
#define POSITION_VECTOR_HPP_WJAGEOCS
|
|
|
|
#include <vanetza/common/bit_number.hpp>
|
|
#include <vanetza/geodesy/position.hpp>
|
|
#include <vanetza/geonet/address.hpp>
|
|
#include <vanetza/geonet/serialization.hpp>
|
|
#include <vanetza/geonet/timestamp.hpp>
|
|
#include <vanetza/geonet/units.hpp>
|
|
#include <boost/units/quantity.hpp>
|
|
#include <boost/units/systems/si/velocity.hpp>
|
|
#include <cstdint>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace geonet
|
|
{
|
|
|
|
using geodesy::GeodeticPosition;
|
|
|
|
class LongPositionVector
|
|
{
|
|
public:
|
|
static constexpr std::size_t length_bytes = 24;
|
|
typedef boost::units::quantity<boost::units::make_scaled_unit<
|
|
boost::units::si::velocity,
|
|
boost::units::scale<10, boost::units::static_rational<-2>>
|
|
>::type, BitNumber<uint_fast16_t, 15>> speed_u15t; // 1/100 m/s
|
|
|
|
Address gn_addr;
|
|
Timestamp timestamp; // ms since 2004-01-01 00:00:00.000
|
|
geo_angle_i32t latitude;
|
|
geo_angle_i32t longitude;
|
|
bool position_accuracy_indicator;
|
|
speed_u15t speed;
|
|
heading_u16t heading;
|
|
|
|
LongPositionVector();
|
|
GeodeticPosition position() const;
|
|
};
|
|
|
|
bool operator==(const LongPositionVector& lhs, const LongPositionVector& rhs);
|
|
bool operator!=(const LongPositionVector& lhs, const LongPositionVector& rhs);
|
|
|
|
/**
|
|
* Check if position vector is empty (default)
|
|
* \return true if all data fields are zero
|
|
*/
|
|
bool is_empty(const LongPositionVector&);
|
|
|
|
/**
|
|
* Check if position vector contains valid data,
|
|
* i.e. not empty and latitude, longitude, and heading values within range
|
|
* \return true if all data fields are valid
|
|
*/
|
|
bool is_valid(const LongPositionVector&);
|
|
|
|
void serialize(const LongPositionVector&, OutputArchive&);
|
|
void deserialize(LongPositionVector&, InputArchive&);
|
|
|
|
class ShortPositionVector
|
|
{
|
|
public:
|
|
static constexpr std::size_t length_bytes = 20;
|
|
|
|
ShortPositionVector() = default;
|
|
ShortPositionVector(const ShortPositionVector&) = default;
|
|
ShortPositionVector& operator=(const ShortPositionVector&) = default;
|
|
explicit ShortPositionVector(const LongPositionVector&);
|
|
|
|
Address gn_addr;
|
|
Timestamp timestamp;
|
|
geo_angle_i32t latitude;
|
|
geo_angle_i32t longitude;
|
|
};
|
|
|
|
bool operator==(const ShortPositionVector& lhs, const ShortPositionVector& rhs);
|
|
bool operator!=(const ShortPositionVector& lhs, const ShortPositionVector& rhs);
|
|
|
|
} // namespace geonet
|
|
} // namespace vanetza
|
|
|
|
#endif /* POSITION_VECTOR_HPP_WJAGEOCS */
|
|
|