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

#include <default_vision_driver.hpp>

Inheritance diagram for fp_perception::DefaultDriver:
Inheritance graph
[legend]
Collaboration diagram for fp_perception::DefaultDriver:
Collaboration graph
[legend]

Public Member Functions

 DefaultDriver ()=default
 
 ~DefaultDriver ()
 
void initialize (const rclcpp::Node::SharedPtr &node) override
 Initialize the driver.
 
void deinitialize () override
 Stop driver streaming.
 
vision_frame captureFrame () override
 Get the latest image data from the driver.
 
void test () override
 Test function to check the driver functionality by writing the image to a file.
 
- Public Member Functions inherited from fp_perception::DriverBase
virtual ~DriverBase ()=default
 
virtual std::string getName () const
 Get the name of 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 imageCallback (const sensor_msgs::msg::Image::ConstSharedPtr &msg)
 
void produce_diagnostics (diagnostic_updater::DiagnosticStatusWrapper &status)
 
- Protected Member Functions inherited from fp_perception::DriverBase
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

std::string interface_name_
 
image_transport::Subscriber image_sub_
 
sensor_msgs::msg::Image::ConstSharedPtr latest_image_
 
std::atomic< uint64_t > received_image_count_ { 0 }
 
- Protected Attributes inherited from fp_perception::DriverBase
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

◆ DefaultDriver()

fp_perception::DefaultDriver::DefaultDriver ( )
default

◆ ~DefaultDriver()

fp_perception::DefaultDriver::~DefaultDriver ( )
inline

Member Function Documentation

◆ captureFrame()

vision_frame fp_perception::DefaultDriver::captureFrame ( )
inlineoverridevirtual

Get the latest image data from the driver.

Returns
vision_frame The latest frame received from the subscribed ROS topic.
Exceptions
fp_perception_exceptionif not implemented in derived classes

Implements fp_perception::VisionSourceDriver.

◆ deinitialize()

void fp_perception::DefaultDriver::deinitialize ( )
inlineoverridevirtual

Stop driver streaming.

Implements fp_perception::DriverBase.

◆ imageCallback()

void fp_perception::DefaultDriver::imageCallback ( const sensor_msgs::msg::Image::ConstSharedPtr &  msg)
inlineprotected

◆ initialize()

void fp_perception::DefaultDriver::initialize ( const rclcpp::Node::SharedPtr &  node)
inlineoverridevirtual

Initialize the driver.

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

Parameters
nodeShared pointer to the ROS node

Reimplemented from fp_perception::DriverBase.

◆ produce_diagnostics()

void fp_perception::DefaultDriver::produce_diagnostics ( diagnostic_updater::DiagnosticStatusWrapper &  status)
inlineprotected

◆ test()

void fp_perception::DefaultDriver::test ( )
inlineoverridevirtual

Test function to check the driver functionality by writing the image to a file.

Reimplemented from fp_perception::DriverBase.

Member Data Documentation

◆ image_sub_

image_transport::Subscriber fp_perception::DefaultDriver::image_sub_
protected

◆ interface_name_

std::string fp_perception::DefaultDriver::interface_name_
protected

◆ latest_image_

sensor_msgs::msg::Image::ConstSharedPtr fp_perception::DefaultDriver::latest_image_
protected

◆ received_image_count_

std::atomic<uint64_t> fp_perception::DefaultDriver::received_image_count_ { 0 }
protected

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