Skip to content

File utilities.h

FileList > utilities.h

Go to the source code of this file

  • #include <array>
  • #include <chrono>
  • #include <functional>
  • #include <string>
  • #include <string_view>
  • #include <utility>
  • #include "fpm_adapter.hpp"

Classes

Type Name
class Clock_t <class C>
class DynamicTimeInterval <typename Rep, typename Period>
A flexible time interval class that wraps std::chrono::duration.

Public Types

Type Name
typedef Clock_t< std::function< TimePoint(void)> > Clock
typedef std::chrono::high_resolution_clock DefaultClock
typedef DefaultClock::duration Duration
typedef DynamicTimeInterval< uint64_t, std::ratio< 1 > > TimeInterval
typedef DefaultClock::time_point TimePoint

Public Attributes

Type Name
const fixed_16_16 Gz = -9.80665
Acceleration due to gravity.
const int acceleration = 3000
Acceleration for the motors.
const int altitude = 1320
Default altitude for calculations.
const auto fireActionInterval = seconds(3)
The interval after which a fire action can be repeated.
const int maxSpeed = 1000
Maximum speed for the motors.
const int motorInterfaceType = 1
Stepper motor driver interface type.
const fixed_16_16 projectileSpeed = 20
Speed of the projectile.

Public Static Attributes

Type Name
constexpr fixed_16_16 deg2RadFactor = [**fixed\_16\_16**](classFixedAdapter.md)(0.01745329251)
Conversion factor from degrees to radians.
constexpr fixed_16_16 rad2DegFactor = [**fixed\_16\_16**](classFixedAdapter.md)(57.2957795131)
Conversion factor from radians to degrees.

Public Functions

Type Name
uint64_t microSinceEpoch ()
Gets the number of microseconds since the Unix epoch.
constexpr DynamicTimeInterval< uint64_t, std::micro > microseconds (const uint64_t micros)
Creates a time interval in microseconds.
uint64_t milliSinceEpoch ()
Gets the number of milliseconds since the Unix epoch.
constexpr DynamicTimeInterval< uint64_t, std::milli > milliseconds (const uint64_t millis, const DynamicTimeInterval< T, P > offset)
Creates a time interval in milliseconds with an optional offset.
constexpr DynamicTimeInterval< uint64_t, std::milli > milliseconds (const uint64_t millis)
Creates a time interval in milliseconds.
uint64_t nanoSinceEpoch ()
Gets the number of nanoseconds since the Unix epoch.
constexpr DynamicTimeInterval< uint64_t > seconds (uint64_t seconds, DynamicTimeInterval< T, P > offset)
Creates a time interval in seconds with an optional offset.
constexpr DynamicTimeInterval< uint64_t > seconds (uint64_t seconds)
Creates a time interval in seconds.
consteval std::string_view type_name ()
T unitSinceEpoch ()
Gets the number of std::chrono Units since the Unix epoch.

Public Types Documentation

typedef Clock

using Clock =  Clock_t<std::function<TimePoint(void)> >;

typedef DefaultClock

using DefaultClock =  std::chrono::high_resolution_clock;

typedef Duration

using Duration =  DefaultClock::duration;

typedef TimeInterval

using TimeInterval =  DynamicTimeInterval<uint64_t, std::ratio<1> >;

typedef TimePoint

using TimePoint =  DefaultClock::time_point;

Public Attributes Documentation

variable Gz

Acceleration due to gravity.

const fixed_16_16 Gz;

variable acceleration

Acceleration for the motors.

const int acceleration;

variable altitude

Default altitude for calculations.

const int altitude;

variable fireActionInterval

The interval after which a fire action can be repeated.

const auto fireActionInterval;

variable maxSpeed

Maximum speed for the motors.

const int maxSpeed;

variable motorInterfaceType

Stepper motor driver interface type.

const int motorInterfaceType;

variable projectileSpeed

Speed of the projectile.

const fixed_16_16 projectileSpeed;

Public Static Attributes Documentation

variable deg2RadFactor

Conversion factor from degrees to radians.

constexpr fixed_16_16 deg2RadFactor;

variable rad2DegFactor

Conversion factor from radians to degrees.

constexpr fixed_16_16 rad2DegFactor;

Public Functions Documentation

function microSinceEpoch

Gets the number of microseconds since the Unix epoch.

inline uint64_t microSinceEpoch () 

function microseconds

Creates a time interval in microseconds.

constexpr DynamicTimeInterval < uint64_t, std::micro > microseconds (
    const uint64_t micros
) 

function milliSinceEpoch

Gets the number of milliseconds since the Unix epoch.

inline uint64_t milliSinceEpoch () 

function milliseconds

Creates a time interval in milliseconds with an optional offset.

template<typename T, typename P>
constexpr DynamicTimeInterval < uint64_t, std::milli > milliseconds (
    const uint64_t millis,
    const DynamicTimeInterval < T, P > offset
) 

function milliseconds

Creates a time interval in milliseconds.

constexpr DynamicTimeInterval < uint64_t, std::milli > milliseconds (
    const uint64_t millis
) 

function nanoSinceEpoch

Gets the number of nanoseconds since the Unix epoch.

inline uint64_t nanoSinceEpoch () 

function seconds

Creates a time interval in seconds with an optional offset.

template<typename T, typename P>
constexpr DynamicTimeInterval < uint64_t > seconds (
    uint64_t seconds,
    DynamicTimeInterval < T, P > offset
) 

function seconds

Creates a time interval in seconds.

constexpr DynamicTimeInterval < uint64_t > seconds (
    uint64_t seconds
) 

function type_name

template<typename T>
consteval std::string_view type_name () 

function unitSinceEpoch

Gets the number of std::chrono Units since the Unix epoch.

template<typename T>
inline T unitSinceEpoch () 


The documentation for this class was generated from the following file utilities.h