Public Member Functions | Private Attributes | List of all members
hebi::Feedback::HighResAngleField Class Referencefinal

A message field for an angle measurement which does not lose precision at very high angles. More...

#include <feedback.hpp>

Public Member Functions

double get () const
 If the field has a value, returns that value as a double; otherwise, returns a default. More...
 
void get (int64_t *revolutions, float *radian_offset) const
 If the field has a value, returns that value in the int64 and float parameters passed in; otherwise, returns a default. More...
 
bool has () const
 True if (and only if) the field has a value. More...
 
 HighResAngleField (HebiFeedbackPtr internal, HebiFeedbackHighResAngleField field)
 
 operator bool () const
 Allows casting to a bool to check if the field has a value without directly calling has(). More...
 

Private Attributes

HebiFeedbackHighResAngleField const field_
 
HebiFeedbackPtr const internal_
 

Detailed Description

A message field for an angle measurement which does not lose precision at very high angles.

This field is represented as an int64_t for the number of revolutions and a float for the radian offset from that number of revolutions.

Definition at line 150 of file feedback.hpp.

Constructor & Destructor Documentation

hebi::Feedback::HighResAngleField::HighResAngleField ( HebiFeedbackPtr  internal,
HebiFeedbackHighResAngleField  field 
)

Definition at line 35 of file feedback.cpp.

Member Function Documentation

double hebi::Feedback::HighResAngleField::get ( ) const

If the field has a value, returns that value as a double; otherwise, returns a default.

Note that some precision might be lost converting to a double at very high number of revolutions.

Definition at line 50 of file feedback.cpp.

void hebi::Feedback::HighResAngleField::get ( int64_t *  revolutions,
float *  radian_offset 
) const

If the field has a value, returns that value in the int64 and float parameters passed in; otherwise, returns a default.

Note that this maintains the full precision of the underlying angle measurement, even for very large numbers of revolutions.

Parameters
revolutionsThe number of full revolutions
radian_offsetThe offset from the given number of full revolutions. Note that this is usually between 0 and 2*M_PI, but callers should not assume this.

Definition at line 64 of file feedback.cpp.

bool hebi::Feedback::HighResAngleField::has ( ) const

True if (and only if) the field has a value.

Definition at line 45 of file feedback.cpp.

hebi::Feedback::HighResAngleField::operator bool ( ) const
explicit

Allows casting to a bool to check if the field has a value without directly calling has().

This can be used as in the following (assuming 'parent' is a parent message, and this field is called 'myField')

Feedback::HighResAngleField& f = parent.myField();
if (f)
std::cout << "Field has value: " << f.get() << std::endl;
else
std::cout << "Field has no value!" << std::endl;

Definition at line 40 of file feedback.cpp.

Member Data Documentation

HebiFeedbackHighResAngleField const hebi::Feedback::HighResAngleField::field_
private

Definition at line 192 of file feedback.hpp.

HebiFeedbackPtr const hebi::Feedback::HighResAngleField::internal_
private

Definition at line 191 of file feedback.hpp.


The documentation for this class was generated from the following files:


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:10:59