FP Perception 0.1.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
fp_perception::DriverBase Class Referenceabstract

#include <driver_base.hpp>

Inheritance diagram for fp_perception::DriverBase:
Inheritance graph
[legend]

Public Member Functions

virtual ~DriverBase ()=default
 
virtual void initialize (const rclcpp::Node::SharedPtr &node)
 Initialize the driver.
 
virtual void deinitialize ()=0
 Deinitialize the driver.
 
virtual std::string getName () const
 Get the name of the driver.
 
virtual void test ()
 Test the driver.
 
void check_directory (std::string folder_name)
 Check if the test directory exists, create it if not.
 
const std::filesystem::path check_file (const std::string &file_name)
 

Protected Member Functions

void initialize_base (const rclcpp::Node::SharedPtr &node)
 Initializer base driver in place of constructor due to plugin semantics.
 
bool diagnostics_enabled () const
 
void enable_diagnostics (const std::string &hardware_id, const std::string &task_name, std::function< void(diagnostic_updater::DiagnosticStatusWrapper &)> task, std::chrono::milliseconds period=std::chrono::seconds(1))
 
void disable_diagnostics ()
 

Protected Attributes

rclcpp::Node::SharedPtr node_
 ROS node for the driver.
 
std::string name_
 Name of the driver.
 
std::mutex buffer_mutex_
 Mutex to protect access to the driver data.
 
std::condition_variable buffer_cv_
 Condition variable to notify when new data is available.
 
std::atomic< bool > is_running_ { false }
 Flag to indicate if the driver thread is running.
 
bool diagnostics_enabled_ { false }
 Flag to enable standard ROS diagnostics publishing.
 
std::unique_ptr< diagnostic_updater::Updater > diagnostics_updater_
 
rclcpp::TimerBase::SharedPtr diagnostics_timer_
 

Constructor & Destructor Documentation

◆ ~DriverBase()

virtual fp_perception::DriverBase::~DriverBase ( )
virtualdefault

Member Function Documentation

◆ check_directory()

void fp_perception::DriverBase::check_directory ( std::string  folder_name)
inline

Check if the test directory exists, create it if not.

This function checks if a directory named "test" exists in the current working directory. If it does not exist, it creates the directory.

Parameters
folder_nameThe name of the folder to check or create.

◆ check_file()

const std::filesystem::path fp_perception::DriverBase::check_file ( const std::string &  file_name)
inline

◆ deinitialize()

virtual void fp_perception::DriverBase::deinitialize ( )
pure virtual

◆ diagnostics_enabled()

bool fp_perception::DriverBase::diagnostics_enabled ( ) const
inlineprotected

◆ disable_diagnostics()

void fp_perception::DriverBase::disable_diagnostics ( )
inlineprotected

◆ enable_diagnostics()

void fp_perception::DriverBase::enable_diagnostics ( const std::string &  hardware_id,
const std::string &  task_name,
std::function< void(diagnostic_updater::DiagnosticStatusWrapper &)>  task,
std::chrono::milliseconds  period = std::chrono::seconds(1) 
)
inlineprotected

◆ getName()

virtual std::string fp_perception::DriverBase::getName ( ) const
inlinevirtual

Get the name of the driver.

Returns
std::string The name of the driver

◆ initialize()

virtual void fp_perception::DriverBase::initialize ( const rclcpp::Node::SharedPtr &  node)
inlinevirtual

Initialize the driver.

This function should be overridden in derived classes to provide specific initialization.

Parameters
nodeShared pointer to the ROS node

Reimplemented in fp_perception::MicrophoneAudioDriver, fp_perception::SpeakerAudioDriver, fp_perception::OpenAIImageAnalysisDriver, fp_perception::SentimentDriver, fp_perception::OpenAISpeechDriver, fp_perception::OpenAIDriver, fp_perception::DefaultDriver, and fp_perception::OpenCVDriver.

◆ initialize_base()

void fp_perception::DriverBase::initialize_base ( const rclcpp::Node::SharedPtr &  node)
inlineprotected

Initializer base driver in place of constructor due to plugin semantics.

Parameters
nodeshared pointer to the ROS node.

◆ test()

virtual void fp_perception::DriverBase::test ( )
inlinevirtual

Member Data Documentation

◆ buffer_cv_

std::condition_variable fp_perception::DriverBase::buffer_cv_
protected

Condition variable to notify when new data is available.

◆ buffer_mutex_

std::mutex fp_perception::DriverBase::buffer_mutex_
protected

Mutex to protect access to the driver data.

◆ diagnostics_enabled_

bool fp_perception::DriverBase::diagnostics_enabled_ { false }
protected

Flag to enable standard ROS diagnostics publishing.

◆ diagnostics_timer_

rclcpp::TimerBase::SharedPtr fp_perception::DriverBase::diagnostics_timer_
protected

◆ diagnostics_updater_

std::unique_ptr<diagnostic_updater::Updater> fp_perception::DriverBase::diagnostics_updater_
protected

◆ is_running_

std::atomic<bool> fp_perception::DriverBase::is_running_ { false }
protected

Flag to indicate if the driver thread is running.

◆ name_

std::string fp_perception::DriverBase::name_
protected

Name of the driver.

◆ node_

rclcpp::Node::SharedPtr fp_perception::DriverBase::node_
protected

ROS node for the driver.


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