Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
darknet_ros::YoloObjectDetector Class Reference

#include <YoloObjectDetector.hpp>

Public Member Functions

 YoloObjectDetector (ros::NodeHandle nh)
 
 ~YoloObjectDetector ()
 

Private Types

using CheckForObjectsActionServer = actionlib::SimpleActionServer< darknet_ros_msgs::CheckForObjectsAction >
 Using. More...
 
using CheckForObjectsActionServerPtr = std::shared_ptr< CheckForObjectsActionServer >
 

Private Member Functions

detection * avgPredictions (network *net, int *nboxes)
 
void cameraCallback (const sensor_msgs::ImageConstPtr &msg)
 
void checkForObjectsActionGoalCB ()
 
void checkForObjectsActionPreemptCB ()
 
void * detectInThread ()
 
void * detectLoop (void *ptr)
 
void * displayInThread (void *ptr)
 
void * displayLoop (void *ptr)
 
void * fetchInThread ()
 
CvMatWithHeader_ getCvMatWithHeader ()
 
bool getImageStatus (void)
 
void init ()
 
bool isCheckingForObjects () const
 
bool isNodeRunning (void)
 
bool publishDetectionImage (const cv::Mat &detectionImage)
 
void * publishInThread ()
 
bool readParameters ()
 
void rememberNetwork (network *net)
 
void setupNetwork (char *cfgfile, char *weightfile, char *datafile, float thresh, char **names, int classes, int delay, char *prefix, int avg_frames, float hier, int w, int h, int frames, int fullscreen)
 
int sizeNetwork (network *net)
 
void yolo ()
 

Private Attributes

int actionId_
 
float * avg_
 
ros::Publisher boundingBoxesPublisher_
 
darknet_ros_msgs::BoundingBoxes boundingBoxesResults_
 
image buff_ [3]
 
int buffId_ [3]
 
int buffIndex_ = 0
 
image buffLetter_ [3]
 
cv::Mat camImageCopy_
 
CheckForObjectsActionServerPtr checkForObjectsActionServer_
 Check for objects action server. More...
 
std::vector< std::string > classLabels_
 
image ** demoAlphabet_
 
int demoClasses_
 
int demoDelay_ = 0
 
int demoDone_ = 0
 
int demoFrame_ = 3
 
float demoHier_ = .5
 
int demoIndex_ = 0
 
char ** demoNames_
 
char * demoPrefix_
 
float demoThresh_ = 0
 
double demoTime_
 
int demoTotal_ = 0
 
ros::Publisher detectionImagePublisher_
 Publisher of the bounding box image. More...
 
cv::Mat disp_
 
bool enableConsoleOutput_
 
float fps_ = 0
 
int frameHeight_
 
int frameWidth_
 Camera related parameters. More...
 
int fullScreen_
 
std_msgs::Header headerBuff_ [3]
 
std_msgs::Header imageHeader_
 
bool imageStatus_ = false
 
image_transport::Subscriber imageSubscriber_
 ROS subscriber and publisher. More...
 
image_transport::ImageTransport imageTransport_
 Advertise and subscribe to image topics. More...
 
bool isNodeRunning_ = true
 
float * lastAvg2_
 
float * lastAvg_
 
boost::shared_mutex mutexActionStatus_
 
boost::shared_mutex mutexImageCallback_
 
boost::shared_mutex mutexImageStatus_
 
boost::shared_mutex mutexNodeStatus_
 
network * net_
 
ros::NodeHandle nodeHandle_
 ROS node handle. More...
 
int numClasses_
 Class labels. More...
 
ros::Publisher objectPublisher_
 
float ** predictions_
 
RosBox_roiBoxes_
 
std::vector< int > rosBoxCounter_
 
std::vector< std::vector< RosBox_ > > rosBoxes_
 Detected objects. More...
 
int running_ = 0
 
bool viewImage_
 
int waitKeyDelay_
 
std::thread yoloThread_
 

Detailed Description

Definition at line 79 of file YoloObjectDetector.hpp.

Member Typedef Documentation

using darknet_ros::YoloObjectDetector::CheckForObjectsActionServer = actionlib::SimpleActionServer<darknet_ros_msgs::CheckForObjectsAction>
private

Using.

Definition at line 132 of file YoloObjectDetector.hpp.

Definition at line 133 of file YoloObjectDetector.hpp.

Constructor & Destructor Documentation

darknet_ros::YoloObjectDetector::YoloObjectDetector ( ros::NodeHandle  nh)
explicit

Constructor.

Definition at line 28 of file YoloObjectDetector.cpp.

darknet_ros::YoloObjectDetector::~YoloObjectDetector ( )

Destructor.

Definition at line 40 of file YoloObjectDetector.cpp.

Member Function Documentation

detection * darknet_ros::YoloObjectDetector::avgPredictions ( network *  net,
int *  nboxes 
)
private

Definition at line 275 of file YoloObjectDetector.cpp.

void darknet_ros::YoloObjectDetector::cameraCallback ( const sensor_msgs::ImageConstPtr &  msg)
private

Callback of camera.

Parameters
[in]msgimage pointer.

Definition at line 159 of file YoloObjectDetector.cpp.

void darknet_ros::YoloObjectDetector::checkForObjectsActionGoalCB ( )
private

Check for objects action goal callback.

Definition at line 187 of file YoloObjectDetector.cpp.

void darknet_ros::YoloObjectDetector::checkForObjectsActionPreemptCB ( )
private

Check for objects action preempt callback.

Definition at line 221 of file YoloObjectDetector.cpp.

void * darknet_ros::YoloObjectDetector::detectInThread ( )
private

Definition at line 293 of file YoloObjectDetector.cpp.

void * darknet_ros::YoloObjectDetector::detectLoop ( void *  ptr)
private

Definition at line 408 of file YoloObjectDetector.cpp.

void * darknet_ros::YoloObjectDetector::displayInThread ( void *  ptr)
private

Definition at line 382 of file YoloObjectDetector.cpp.

void * darknet_ros::YoloObjectDetector::displayLoop ( void *  ptr)
private

Definition at line 402 of file YoloObjectDetector.cpp.

void * darknet_ros::YoloObjectDetector::fetchInThread ( )
private

Definition at line 368 of file YoloObjectDetector.cpp.

CvMatWithHeader_ darknet_ros::YoloObjectDetector::getCvMatWithHeader ( )
private

Definition at line 512 of file YoloObjectDetector.cpp.

bool darknet_ros::YoloObjectDetector::getImageStatus ( void  )
private

Definition at line 517 of file YoloObjectDetector.cpp.

void darknet_ros::YoloObjectDetector::init ( )
private

Initialize the ROS connections.

Definition at line 72 of file YoloObjectDetector.cpp.

bool darknet_ros::YoloObjectDetector::isCheckingForObjects ( ) const
private

Check if a preempt for the check for objects action has been requested.

Returns
false if preempt has been requested or inactive.

Definition at line 226 of file YoloObjectDetector.cpp.

bool darknet_ros::YoloObjectDetector::isNodeRunning ( void  )
private

Definition at line 522 of file YoloObjectDetector.cpp.

bool darknet_ros::YoloObjectDetector::publishDetectionImage ( const cv::Mat &  detectionImage)
private

Publishes the detection image.

Returns
true if successful.

Definition at line 230 of file YoloObjectDetector.cpp.

void * darknet_ros::YoloObjectDetector::publishInThread ( )
private

Definition at line 527 of file YoloObjectDetector.cpp.

bool darknet_ros::YoloObjectDetector::readParameters ( )
private

Reads and verifies the ROS parameters.

Returns
true if successful.

Definition at line 48 of file YoloObjectDetector.cpp.

void darknet_ros::YoloObjectDetector::rememberNetwork ( network *  net)
private

Definition at line 263 of file YoloObjectDetector.cpp.

void darknet_ros::YoloObjectDetector::setupNetwork ( char *  cfgfile,
char *  weightfile,
char *  datafile,
float  thresh,
char **  names,
int  classes,
int  delay,
char *  prefix,
int  avg_frames,
float  hier,
int  w,
int  h,
int  frames,
int  fullscreen 
)
private

Definition at line 414 of file YoloObjectDetector.cpp.

int darknet_ros::YoloObjectDetector::sizeNetwork ( network *  net)
private

Definition at line 251 of file YoloObjectDetector.cpp.

void darknet_ros::YoloObjectDetector::yolo ( )
private

Definition at line 431 of file YoloObjectDetector.cpp.

Member Data Documentation

int darknet_ros::YoloObjectDetector::actionId_
private

Definition at line 212 of file YoloObjectDetector.hpp.

float* darknet_ros::YoloObjectDetector::avg_
private

Definition at line 191 of file YoloObjectDetector.hpp.

ros::Publisher darknet_ros::YoloObjectDetector::boundingBoxesPublisher_
private

Definition at line 151 of file YoloObjectDetector.hpp.

darknet_ros_msgs::BoundingBoxes darknet_ros::YoloObjectDetector::boundingBoxesResults_
private

Definition at line 156 of file YoloObjectDetector.hpp.

image darknet_ros::YoloObjectDetector::buff_[3]
private

Definition at line 175 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::buffId_[3]
private

Definition at line 177 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::buffIndex_ = 0
private

Definition at line 178 of file YoloObjectDetector.hpp.

image darknet_ros::YoloObjectDetector::buffLetter_[3]
private

Definition at line 176 of file YoloObjectDetector.hpp.

cv::Mat darknet_ros::YoloObjectDetector::camImageCopy_
private

Definition at line 203 of file YoloObjectDetector.hpp.

CheckForObjectsActionServerPtr darknet_ros::YoloObjectDetector::checkForObjectsActionServer_
private

Check for objects action server.

Definition at line 143 of file YoloObjectDetector.hpp.

std::vector<std::string> darknet_ros::YoloObjectDetector::classLabels_
private

Definition at line 140 of file YoloObjectDetector.hpp.

image** darknet_ros::YoloObjectDetector::demoAlphabet_
private

Definition at line 170 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::demoClasses_
private

Definition at line 171 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::demoDelay_ = 0
private

Definition at line 184 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::demoDone_ = 0
private

Definition at line 188 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::demoFrame_ = 3
private

Definition at line 185 of file YoloObjectDetector.hpp.

float darknet_ros::YoloObjectDetector::demoHier_ = .5
private

Definition at line 181 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::demoIndex_ = 0
private

Definition at line 187 of file YoloObjectDetector.hpp.

char** darknet_ros::YoloObjectDetector::demoNames_
private

Definition at line 169 of file YoloObjectDetector.hpp.

char* darknet_ros::YoloObjectDetector::demoPrefix_
private

Definition at line 200 of file YoloObjectDetector.hpp.

float darknet_ros::YoloObjectDetector::demoThresh_ = 0
private

Definition at line 180 of file YoloObjectDetector.hpp.

double darknet_ros::YoloObjectDetector::demoTime_
private

Definition at line 193 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::demoTotal_ = 0
private

Definition at line 192 of file YoloObjectDetector.hpp.

ros::Publisher darknet_ros::YoloObjectDetector::detectionImagePublisher_
private

Publisher of the bounding box image.

Definition at line 163 of file YoloObjectDetector.hpp.

cv::Mat darknet_ros::YoloObjectDetector::disp_
private

Definition at line 183 of file YoloObjectDetector.hpp.

bool darknet_ros::YoloObjectDetector::enableConsoleOutput_
private

Definition at line 197 of file YoloObjectDetector.hpp.

float darknet_ros::YoloObjectDetector::fps_ = 0
private

Definition at line 179 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::frameHeight_
private

Definition at line 160 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::frameWidth_
private

Camera related parameters.

Definition at line 159 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::fullScreen_
private

Definition at line 199 of file YoloObjectDetector.hpp.

std_msgs::Header darknet_ros::YoloObjectDetector::headerBuff_[3]
private

Definition at line 174 of file YoloObjectDetector.hpp.

std_msgs::Header darknet_ros::YoloObjectDetector::imageHeader_
private

Definition at line 202 of file YoloObjectDetector.hpp.

bool darknet_ros::YoloObjectDetector::imageStatus_ = false
private

Definition at line 206 of file YoloObjectDetector.hpp.

image_transport::Subscriber darknet_ros::YoloObjectDetector::imageSubscriber_
private

ROS subscriber and publisher.

Definition at line 149 of file YoloObjectDetector.hpp.

image_transport::ImageTransport darknet_ros::YoloObjectDetector::imageTransport_
private

Advertise and subscribe to image topics.

Definition at line 146 of file YoloObjectDetector.hpp.

bool darknet_ros::YoloObjectDetector::isNodeRunning_ = true
private

Definition at line 209 of file YoloObjectDetector.hpp.

float* darknet_ros::YoloObjectDetector::lastAvg2_
private

Definition at line 189 of file YoloObjectDetector.hpp.

float* darknet_ros::YoloObjectDetector::lastAvg_
private

Definition at line 190 of file YoloObjectDetector.hpp.

boost::shared_mutex darknet_ros::YoloObjectDetector::mutexActionStatus_
private

Definition at line 213 of file YoloObjectDetector.hpp.

boost::shared_mutex darknet_ros::YoloObjectDetector::mutexImageCallback_
private

Definition at line 204 of file YoloObjectDetector.hpp.

boost::shared_mutex darknet_ros::YoloObjectDetector::mutexImageStatus_
private

Definition at line 207 of file YoloObjectDetector.hpp.

boost::shared_mutex darknet_ros::YoloObjectDetector::mutexNodeStatus_
private

Definition at line 210 of file YoloObjectDetector.hpp.

network* darknet_ros::YoloObjectDetector::net_
private

Definition at line 173 of file YoloObjectDetector.hpp.

ros::NodeHandle darknet_ros::YoloObjectDetector::nodeHandle_
private

ROS node handle.

Definition at line 136 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::numClasses_
private

Class labels.

Definition at line 139 of file YoloObjectDetector.hpp.

ros::Publisher darknet_ros::YoloObjectDetector::objectPublisher_
private

Definition at line 150 of file YoloObjectDetector.hpp.

float** darknet_ros::YoloObjectDetector::predictions_
private

Definition at line 186 of file YoloObjectDetector.hpp.

RosBox_* darknet_ros::YoloObjectDetector::roiBoxes_
private

Definition at line 195 of file YoloObjectDetector.hpp.

std::vector<int> darknet_ros::YoloObjectDetector::rosBoxCounter_
private

Definition at line 155 of file YoloObjectDetector.hpp.

std::vector<std::vector<RosBox_> > darknet_ros::YoloObjectDetector::rosBoxes_
private

Detected objects.

Definition at line 154 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::running_ = 0
private

Definition at line 182 of file YoloObjectDetector.hpp.

bool darknet_ros::YoloObjectDetector::viewImage_
private

Definition at line 196 of file YoloObjectDetector.hpp.

int darknet_ros::YoloObjectDetector::waitKeyDelay_
private

Definition at line 198 of file YoloObjectDetector.hpp.

std::thread darknet_ros::YoloObjectDetector::yoloThread_
private

Definition at line 166 of file YoloObjectDetector.hpp.


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


darknet_ros
Author(s): Marko Bjelonic
autogenerated on Wed May 5 2021 02:58:30