Skip to content
Snippets Groups Projects
Commit 683121fd authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Removed the dependency from the iriutils library.

parent c0a678af
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,6 @@ find_package(catkin REQUIRED COMPONENTS iri_base_algorithm sensor_msgs image_tra ...@@ -16,7 +16,6 @@ find_package(catkin REQUIRED COMPONENTS iri_base_algorithm sensor_msgs image_tra
# ******************************************************************** # ********************************************************************
# find_package(<dependency> REQUIRED) # find_package(<dependency> REQUIRED)
find_package(OpenCV REQUIRED) find_package(OpenCV REQUIRED)
find_package(iriutils REQUIRED)
# ******************************************************************** # ********************************************************************
# Add topic, service and action definition here # Add topic, service and action definition here
...@@ -80,7 +79,6 @@ catkin_package( ...@@ -80,7 +79,6 @@ catkin_package(
include_directories(include) include_directories(include)
include_directories(${catkin_INCLUDE_DIRS}) include_directories(${catkin_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS}) include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${iriutils_INCLUDE_DIR})
## Declare a cpp library ## Declare a cpp library
# add_library(${PROJECT_NAME} <list of source files>) # add_library(${PROJECT_NAME} <list of source files>)
...@@ -95,10 +93,8 @@ add_library(${PROJECT_NAME}_nodelet src/blob_detector_alg.cpp src/blob_detector_ ...@@ -95,10 +93,8 @@ add_library(${PROJECT_NAME}_nodelet src/blob_detector_alg.cpp src/blob_detector_
# ******************************************************************** # ********************************************************************
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS}) target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
target_link_libraries(${PROJECT_NAME} ${iriutils_LIBRARY})
target_link_libraries(${PROJECT_NAME}_nodelet ${catkin_LIBRARIES}) target_link_libraries(${PROJECT_NAME}_nodelet ${catkin_LIBRARIES})
target_link_libraries(${PROJECT_NAME}_nodelet ${OpenCV_LIBS}) target_link_libraries(${PROJECT_NAME}_nodelet ${OpenCV_LIBS})
target_link_libraries(${PROJECT_NAME}_nodelet ${iriutils_LIBRARY})
# ******************************************************************** # ********************************************************************
# Add message headers dependencies # Add message headers dependencies
......
...@@ -28,18 +28,13 @@ ...@@ -28,18 +28,13 @@
#include "nodelet/nodelet.h" #include "nodelet/nodelet.h"
#include "blob_detector_alg_node.h" #include "blob_detector_alg_node.h"
#include "threadserver.h"
class BlobDetectorNodelet : public nodelet::Nodelet class BlobDetectorNodelet : public nodelet::Nodelet
{ {
private: private:
virtual void onInit();// initialization function virtual void onInit();// initialization function
BlobDetectorAlgNode *dev; BlobDetectorAlgNode *dev;
// thread attributes
CThreadServer *thread_server;
std::string spin_thread_id;
protected: protected:
static void *spin_thread(void *param); void spin_thread(void);
public: public:
BlobDetectorNodelet(); BlobDetectorNodelet();
~BlobDetectorNodelet(); ~BlobDetectorNodelet();
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<node pkg="libuvc_camera" type="camera_node" name="mycam"> <node pkg="libuvc_camera" type="camera_node" name="mycam">
<!-- Parameters used to find the camera --> <!-- Parameters used to find the camera -->
<param name="vendor" value="0x046d"/> <param name="vendor" value="0x046d"/>
<param name="product" value="0x0805"/> <param name="product" value="0x0802"/>
<param name="serial" value="AB659260"/> <param name="serial" value="BEE76360"/>
<!-- If the above parameters aren't unique, choose the first match: --> <!-- If the above parameters aren't unique, choose the first match: -->
<param name="index" value="0"/> <param name="index" value="0"/>
......
...@@ -10,32 +10,17 @@ void BlobDetectorNodelet::onInit() ...@@ -10,32 +10,17 @@ void BlobDetectorNodelet::onInit()
{ {
this->dev=new BlobDetectorAlgNode(this->getPrivateNodeHandle()); this->dev=new BlobDetectorAlgNode(this->getPrivateNodeHandle());
// initialize the thread // initialize the thread
std::cout << this->getName() << "," << this->getPrivateNodeHandle().getNamespace() << std::endl; boost::bind(&BlobDetectorNodelet::spin_thread,this);
this->thread_server=CThreadServer::instance();
this->spin_thread_id=getName() + "_blob_detector_nodelet_spin";
std::cout << this->spin_thread_id << std::endl;
this->thread_server->create_thread(this->spin_thread_id);
this->thread_server->attach_thread(this->spin_thread_id,this->spin_thread,this);
// start the spin thread
this->thread_server->start_thread(this->spin_thread_id);
} }
void *BlobDetectorNodelet::spin_thread(void *param) void BlobDetectorNodelet::spin_thread(void)
{ {
BlobDetectorNodelet *nodelet=(BlobDetectorNodelet *)param; this->dev->spin();
nodelet->dev->spin();
pthread_exit(NULL);
} }
BlobDetectorNodelet::~BlobDetectorNodelet() BlobDetectorNodelet::~BlobDetectorNodelet()
{ {
// kill the thread // kill the thread
this->thread_server->kill_thread(this->spin_thread_id);
this->thread_server->detach_thread(this->spin_thread_id);
this->thread_server->delete_thread(this->spin_thread_id);
this->spin_thread_id="";
if(this->dev!=NULL) if(this->dev!=NULL)
delete this->dev; delete this->dev;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment