Tetrapod Project
TeensySerial Class Reference

#include <teensy_serial.h>

Public Member Functions

 TeensySerial (int _number_of_motors)
 
 ~TeensySerial ()
 
bool areControlCommandsAvailable ()
 Checks if there is any available data on the serial port. More...
 
void receiveControlCommands (double &_control_command_type, double *_control_commands)
 Reads control command data available on the serial command and stores it. More...
 
void sendStates (double *_joint_positions, double *_joint_velocities, double *_joint_torques)
 Sends the joint states to the serial line. More...
 
void printTxBuffer ()
 

Private Attributes

int number_of_motors
 Number of motors. More...
 
int tx_buffer_size
 Transmit buffer size. More...
 
int rx_buffer_size
 Receive buffer size. More...
 
unsigned char * rx_buffer
 Receive buffer. More...
 
unsigned char * tx_buffer
 Transmit buffer. More...
 

Detailed Description

Definition at line 6 of file teensy_serial.h.

Constructor & Destructor Documentation

◆ TeensySerial()

TeensySerial::TeensySerial ( int  _number_of_motors)

Definition at line 3 of file teensy_serial.cpp.

◆ ~TeensySerial()

TeensySerial::~TeensySerial ( )

Definition at line 24 of file teensy_serial.cpp.

Member Function Documentation

◆ areControlCommandsAvailable()

bool TeensySerial::areControlCommandsAvailable ( )

Checks if there is any available data on the serial port.

Returns
If there is data available on the serial line true is returned, otherwise false

Definition at line 33 of file teensy_serial.cpp.

◆ receiveControlCommands()

void TeensySerial::receiveControlCommands ( double &  _control_command_type,
double *  _control_commands 
)

Reads control command data available on the serial command and stores it.

Parameters
[out]_control_command_typeA variable indicating whether position, velocity, or torque control should be used
[out]_control_commandsAn array of control command values

Definition at line 48 of file teensy_serial.cpp.

◆ sendStates()

void TeensySerial::sendStates ( double *  _joint_positions,
double *  _joint_velocities,
double *  _joint_torques 
)

Sends the joint states to the serial line.

Parameters
[out]_joint_positionsAn array of measured joint positions from the motor
[out]_joint_velocitiesAn array of measured joint velocities from the motor
[out]_joint_torquesAn array of measured joint torques from the motor

Definition at line 92 of file teensy_serial.cpp.

◆ printTxBuffer()

void TeensySerial::printTxBuffer ( )

Definition at line 120 of file teensy_serial.cpp.

Member Data Documentation

◆ number_of_motors

int TeensySerial::number_of_motors
private

Number of motors.

Definition at line 33 of file teensy_serial.h.

◆ tx_buffer_size

int TeensySerial::tx_buffer_size
private

Transmit buffer size.

Definition at line 36 of file teensy_serial.h.

◆ rx_buffer_size

int TeensySerial::rx_buffer_size
private

Receive buffer size.

Definition at line 39 of file teensy_serial.h.

◆ rx_buffer

unsigned char* TeensySerial::rx_buffer
private

Receive buffer.

Definition at line 42 of file teensy_serial.h.

◆ tx_buffer

unsigned char* TeensySerial::tx_buffer
private

Transmit buffer.

Definition at line 45 of file teensy_serial.h.


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