Comments (2)
Hello there!
Thanks!
I tried to keep the interfaces consistent, meaning member functions returning a velocity (quantity), to return units::velocity
, not a specific unit. To get a unit from a compatible quantity (e.g. velocity -> knots), you just use the member function get
, example:
auto v = rmc.get_sog(); // returns utils::optional<units::velocity>
// v is an optional,
// -> accesses its data assuming there is,
// get<...>() converts it into the desired unit
auto v_kn = v->get<units::knots>(); // v_kn is now units::knots
// for example also possible conversions from the same quantity:
auto v_mps = v->get<units::meters_per_second>();
auto v_kmh = v->get<units::kilometers_per_hour>();
This means, you get a velocity from rmc, then you decide which unit is useful for you.
If you need the numeric value (a double
is the default type), just use value()
, example:
auto v_kn = v->get<units::knots>();
std::cout << "SOG = " << v_kn.value() << '\n';
// or, of course, directly:
std::cout << "SOG = " << v->get<units::knots>().value() << '\n';
from marnav.
Hi @mariokonrad , this really helps. Thank you very much 👍
from marnav.
Related Issues (20)
- RMB: fromWayPointId is before toWayPointId HOT 2
- RMB does not have a status indicator HOT 5
- Broken link in README HOT 1
- Broken link in README HOT 2
- marnav::utils::mmsi::sar_id() missing HOT 1
- Invalid SNR GSV value. HOT 2
- Install instructions for ctags HOT 6
- GSV: Invalid satellite status for empty fields HOT 3
- rte message formatting look wrong HOT 3
- Error linking Linking CXX executable read_nmea_boostasio HOT 2
- SignalK and sensors support on raspberry Pi ideas HOT 1
- Checksum calculation without white space character HOT 6
- Missing support for NMEA NavTex messages (alerts) HOT 2
- Missing support for DSC NMEA alerts and messages
- Safety Messages NMEA ammendement, MOB, SMV, SM1, SM2, SM3, SM4 NMEA Messages HOT 1
- Problem with negative latitude or longitude to generate AIS message 1 HOT 12
- Build failure with GCC 12 on ARM64 HOT 3
- Problem with fmt version HOT 4
- a new tag (0.41.1 for instance) would be useful
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marnav.