6#include "roo_logging.h"
10#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
51 float inKnots()
const {
return velocity_ * 1.9438444924f; }
54 bool isUnknown()
const {
return std::isnan(velocity_); }
57 return velocity_ < other.velocity_;
61 return velocity_ == other.velocity_;
65 return other.velocity_ < velocity_;
69 return !(other.velocity_ < velocity_);
73 return !(velocity_ < other.velocity_);
77 return !(velocity_ == other.velocity_);
100#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
102 std::string asString()
const;
106 String asArduinoString()
const;
114 explicit Velocity(
float velocity) : velocity_(velocity) {}
217roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Velocity& val);
Representation of length, internally stored as floating-point meters.
float inMeters() const
Returns the length in meters.
Representation of elapsed, internally stored as floating-point seconds.
float inSeconds() const
Returns the time in seconds.
Representation of velocity, internally stored as floating-point meters per second.
bool operator>=(const Velocity &other) const
Velocity & operator*=(float multi)
friend Velocity UnknownVelocity()
Returns a velocity object representing an unknown velocity.
float inMicrometersPerSecond() const
Returns the velocity in micrometers per second.
friend Velocity VelocityInMetersPerSecond(float)
Returns a velocity object equivalent to the specified velocity expressed in meters per second.
Velocity & operator-=(const Velocity &other)
bool operator!=(const Velocity &other) const
Velocity()
Creates a velocity object representing an 'unknown' velocity.
float inMillimetersPerSecond() const
Returns the velocity in millimeters per second.
float inKph() const
Returns the velocity in kilometers per hour.
bool operator<(const Velocity &other) const
float inKilometersPerSecond() const
Returns the velocity in kilometers per second.
float inMilesPerHour() const
Returns the velocity in miles per hour.
bool operator==(const Velocity &other) const
bool operator<=(const Velocity &other) const
Velocity & operator/=(float div)
float inMph() const
Returns the velocity in miles per hour.
bool isUnknown() const
Returns whether the object represents an unknown velocity.
float inMetersPerSecond() const
Returns the velocity in meters per second.
Velocity & operator+=(const Velocity &other)
float inKilometersPerHour() const
Returns the velocity in kilometers per hour.
bool operator>(const Velocity &other) const
For convenience conversion from roo_time::Duration.
Length LengthInMeters(float length)
Returns a length object equivalent to the specified length expressed in meters.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Velocity VelocityInMilesPerHour(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in miles per hour.
Velocity VelocityInMillimetersPerSecond(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in millimeters per second.
Velocity VelocityInKilometersPerHour(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in kilometers per hour.
Area operator+(Area a, Area b)
Velocity VelocityInMph(float velocity)
Velocity VelocityInMetersPerSecond(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in meters per second.
Time TimeInSeconds(float time)
Returns a time object equivalent to the specified time expressed in seconds.
Velocity VelocityInMicrometersPerSecond(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in micrometers per second.
Area operator-(Area a, Area b)
Velocity UnknownVelocity()
Returns a velocity object representing an unknown velocity.
Velocity VelocityInKph(float velocity)
Area operator/(Area a, float b)
Area operator*(Area a, float b)
Velocity VelocityInKilometersPerSecond(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in kilometers per second.