FP Perception 0.1.2
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
fp_perception Namespace Reference

Classes

class  AlgorithmBase
 
struct  audio_buffer_request
 
struct  audio_data
 Struct to hold audio data. More...
 
class  AudioBuffer
 
class  AudioSinkDriver
 
class  AudioSourceDriver
 
class  DefaultDriver
 
class  DriverBase
 
class  DriverManager
 
struct  fp_perception_exception
 Base class for driver exceptions. More...
 
struct  image_analysis_request
 
struct  image_analysis_result
 
class  ImageAnalysisDriver
 
class  ImageAnalysisPipeline
 
class  MicrophoneAudioDriver
 MicrophoneAudioDriver class for handling audio input from a microphone. More...
 
class  OpenAIDriver
 
class  OpenAIImageAnalysisDriver
 
class  OpenAISpeechDriver
 
class  OpenCVDriver
 OpenCVDriver class for handling video input from a camera using OpenCV. More...
 
class  PerceptionServer
 
class  RestBase
 RestBase. More...
 
struct  RESTOption
 
struct  RESTRequest
 
struct  RESTResponse
 
struct  sentiment_request
 
struct  sentiment_result
 
class  SentimentAnalysisDriver
 
class  SentimentDriver
 SentimentDriver class for handling prompt_tools based sentument analysis. More...
 
class  SentimentPipeline
 
class  SpeakerAudioDriver
 SpeakerAudioDriver class for handling audio output to a speaker. More...
 
struct  speech_pipeline_result
 
class  SpeechPipeline
 
class  SpeechSynthesisDriver
 
struct  text_data
 
struct  transcription_request
 
struct  transcription_result
 
class  TranscriptionDriver
 
class  TranscriptionPipeline
 
struct  vision_frame
 
class  VisionSourceDriver
 

Enumerations

enum class  RESTOptionType { STRING = 0 , BOOL , INT , DOUBLE }
 

Functions

fp_perception_msgs::msg::PerceptionAudio audio_data_to_msg (const audio_data &data)
 Convert fp_perception::audio_data to fp_perception_msgs::msg::PerceptionAudio message.
 
audio_data msg_to_audio_data (const fp_perception_msgs::msg::PerceptionAudio &msg)
 Convert fp_perception_msgs::msg::PerceptionAudio message to audio_data.
 
fp_perception_msgs::msg::PerceptionText text_data_to_msg (const text_data &data)
 
text_data msg_to_text_data (const fp_perception_msgs::msg::PerceptionText &msg)
 
void writeWavStream (std::ostream &out, const audio_data &data)
 Write audio data to a WAV file using an output stream.
 
void writeWavFile (const std::string &filename, const audio_data &data)
 Write audio data to a WAV file.
 
audio_data readWavFile (const std::string &filepath)
 Read audio data from a WAV file.
 
std::vector< char > encodeWavToBytes (const fp_perception::audio_data &data)
 Encode audio data to a WAV file and return as a byte vector.
 
std::string getHostApiName (PaHostApiIndex host_api_index)
 Get the device ID by name.
 
std::string describePortAudioDevice (int device_id)
 
template<typename LoggerT >
void logPortAudioDevices (const LoggerT &logger)
 
int getDeviceIdByName (const std::string &target_name)
 

Enumeration Type Documentation

◆ RESTOptionType

enum class fp_perception::RESTOptionType
strong
Enumerator
STRING 
BOOL 
INT 
DOUBLE 

Function Documentation

◆ audio_data_to_msg()

fp_perception_msgs::msg::PerceptionAudio fp_perception::audio_data_to_msg ( const audio_data data)

Convert fp_perception::audio_data to fp_perception_msgs::msg::PerceptionAudio message.

Parameters
dataThe audio data to convert.
Returns
fp_perception_msgs::msg::PerceptionAudio The converted message.

◆ describePortAudioDevice()

std::string fp_perception::describePortAudioDevice ( int  device_id)
inline

◆ encodeWavToBytes()

std::vector< char > fp_perception::encodeWavToBytes ( const fp_perception::audio_data data)

Encode audio data to a WAV file and return as a byte vector.

Parameters
dataThe audio data to encode.
Returns
std::vector<char> Byte vector containing the WAV file data.
Exceptions
fp_perception_exceptionif there are issues writing the data.

◆ getDeviceIdByName()

int fp_perception::getDeviceIdByName ( const std::string &  target_name)
inline

◆ getHostApiName()

std::string fp_perception::getHostApiName ( PaHostApiIndex  host_api_index)
inline

Get the device ID by name.

This function searches for a PortAudio device by its name and returns its ID. If the device is not found, it throws an exception.

Parameters
target_nameThe name of the target device to search for.
Returns
int The ID of the found device.
Exceptions
fp_perception::fp_perception_exceptionif no devices are found or if the target device is not found.

◆ logPortAudioDevices()

template<typename LoggerT >
void fp_perception::logPortAudioDevices ( const LoggerT &  logger)
inline

◆ msg_to_audio_data()

audio_data fp_perception::msg_to_audio_data ( const fp_perception_msgs::msg::PerceptionAudio &  msg)

Convert fp_perception_msgs::msg::PerceptionAudio message to audio_data.

Parameters
msgThe message to convert.
Returns
audio_data The converted audio data.

◆ msg_to_text_data()

text_data fp_perception::msg_to_text_data ( const fp_perception_msgs::msg::PerceptionText &  msg)

◆ readWavFile()

audio_data fp_perception::readWavFile ( const std::string &  filepath)

Read audio data from a WAV file.

Parameters
filepathPath to the WAV file.
Returns
audio_data Struct containing samples, sample rate, and channel count.
Exceptions
fp_perception_exceptionon file errors or unsupported formats.

◆ text_data_to_msg()

fp_perception_msgs::msg::PerceptionText fp_perception::text_data_to_msg ( const text_data data)

◆ writeWavFile()

void fp_perception::writeWavFile ( const std::string &  filename,
const audio_data data 
)

Write audio data to a WAV file.

Parameters
filenameThe name of the file to write.
dataThe audio data to write.
Exceptions
fp_perception_exceptionif the file cannot be opened or if there are issues writing the data.

◆ writeWavStream()

void fp_perception::writeWavStream ( std::ostream &  out,
const audio_data data 
)

Write audio data to a WAV file using an output stream.

Parameters
outThe output stream to write the WAV data to.
dataThe audio data to write.
Exceptions
fp_perception_exceptionif the output stream is not valid or if there are issues writing the data.