Skeletal Animation Multithread Face
|
Class Exoskeleton. More...
#include <exoskeleton.h>
Public Member Functions | |
Exoskeleton () | |
Empty constructor. More... | |
void | initialize (const std::string &serial_com, unsigned int serial_baudrate) |
Initialize the exoskeleton. More... | |
std::vector< double > | incoming_data_callback (void) |
Read incoming data. More... | |
std::vector< double > | get_joint_angles (void) |
Get joint angles. More... | |
Private Attributes | |
const int | m_meas_num = 13 |
Measurements num. More... | |
std::vector< double > | m_raw_sensor_data |
Sensors data vector (raw). More... | |
std::shared_ptr< SerialCOM > | m_serial |
Serial communication handler. More... | |
std::future< std::vector< double > > | m_future_fun |
Future function handle. More... | |
bool | m_return_value = 0 |
Termination flag for callback function. More... | |
Class Exoskeleton.
This class is the interface between the hardware and the software. Its goal is to provide a callback function that reads asychronously the serial data from the SerialCOM:: class and translates it to joint angle values. It then sends the data to the animation loop and to the rendering engine
Definition at line 19 of file exoskeleton.h.
|
inline |
std::vector< double > Exoskeleton::get_joint_angles | ( | void | ) |
Get joint angles.
It is the point of entry that feeds the animation loop with the exoskeleton data. It returns a vector of the raw jont angle data converted to radians. It also manages the asynchronous threading.
Definition at line 55 of file exoskeleton.cpp.
std::vector< double > Exoskeleton::incoming_data_callback | ( | void | ) |
Read incoming data.
This is the callback function for reading asynchronously the incoming data from the serial port. The data come in the format:
Definition at line 37 of file exoskeleton.cpp.
void Exoskeleton::initialize | ( | const std::string & | serial_com, |
unsigned int | serial_baudrate | ||
) |
Initialize the exoskeleton.
It initialiazes the serial communication and sets the asychronous callback function. See https://en.cppreference.com/w/cpp/thread/async.
serial_com | The serial communication port. |
serial_baudrate | The serial communication baudrate. |
Definition at line 10 of file exoskeleton.cpp.
|
private |
Future function handle.
Definition at line 50 of file exoskeleton.h.
|
private |
Measurements num.
Definition at line 39 of file exoskeleton.h.
|
private |
Sensors data vector (raw).
Definition at line 42 of file exoskeleton.h.
|
private |
Termination flag for callback function.
Definition at line 53 of file exoskeleton.h.
|
private |
Serial communication handler.
Definition at line 47 of file exoskeleton.h.