diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e2abf37fffa5977ae7cf7e14f09d4f9fcfbd1d6..215e92e66ede2c2246f801f951588f363af9da06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.3) -project(iri_image_modifier) +project(iri_image_inverter) ## Find catkin macros and libraries find_package(catkin REQUIRED) @@ -49,7 +49,7 @@ find_package(catkin REQUIRED COMPONENTS iri_base_algorithm cv_bridge image_trans # ******************************************************************** # Add the dynamic reconfigure file # ******************************************************************** -generate_dynamic_reconfigure_options(cfg/ImageModifier.cfg) +generate_dynamic_reconfigure_options(cfg/ImageInverter.cfg) # ******************************************************************** # Add run time dependencies here @@ -82,7 +82,7 @@ include_directories(${catkin_INCLUDE_DIRS}) # add_library(${PROJECT_NAME} <list of source files>) ## Declare a cpp executable -add_executable(${PROJECT_NAME} src/image_modifier_alg.cpp src/image_modifier_alg_node.cpp) +add_executable(${PROJECT_NAME} src/image_inverter_alg.cpp src/image_inverter_alg_node.cpp) # ******************************************************************** # Add the libraries diff --git a/README.md b/README.md index 747623fa1d3a35804b6d7a3edf0d568c8b4cb3b8..ce56e5c81acc5972a9db0fdcd73635a9caa768b7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Description -The iri_image_modifier project description +The iri_image_inverter project description # ROS Interface ### Topic publishers @@ -38,7 +38,7 @@ catkin_make - Standalone test - `roslaunch iri_image_modifier test.launch` + `roslaunch iri_image_inverter test.launch` ## Disclaimer diff --git a/cfg/ImageModifier.cfg b/cfg/ImageInverter.cfg similarity index 95% rename from cfg/ImageModifier.cfg rename to cfg/ImageInverter.cfg index 3f398a8c0888ad8ccaa792eb205f97c253987538..2c5a49715fc30ad517c0336fbcb90fd7e6dd5340 100755 --- a/cfg/ImageModifier.cfg +++ b/cfg/ImageInverter.cfg @@ -31,7 +31,7 @@ # Author: -PACKAGE='iri_image_modifier' +PACKAGE='iri_image_inverter' from dynamic_reconfigure.parameter_generator_catkin import * @@ -41,4 +41,4 @@ gen = ParameterGenerator() gen.add("rate", double_t, 0, "Main loop rate (Hz)", 10.0, 0.1, 1000.0) gen.add("invert", bool_t, 0, "Invert image colors", True) -exit(gen.generate(PACKAGE, "ImageModifierAlgorithm", "ImageModifier")) +exit(gen.generate(PACKAGE, "ImageInverterAlgorithm", "ImageInverter")) diff --git a/include/image_modifier_alg.h b/include/image_inverter_alg.h similarity index 86% rename from include/image_modifier_alg.h rename to include/image_inverter_alg.h index 9d7e1a60323a55ba783a992b17e8b19b95cc4d93..c3c631fccaf42264783111e6a04464c8d43f3b6a 100644 --- a/include/image_modifier_alg.h +++ b/include/image_inverter_alg.h @@ -22,25 +22,25 @@ // refer to the IRI wiki page for more information: // http://wikiri.upc.es/index.php/Robotics_Lab -#ifndef _image_modifier_alg_h_ -#define _image_modifier_alg_h_ +#ifndef _image_inverter_alg_h_ +#define _image_inverter_alg_h_ -#include <iri_image_modifier/ImageModifierConfig.h> +#include <iri_image_inverter/ImageInverterConfig.h> -//include image_modifier_alg main library +//include image_inverter_alg main library /** * \brief IRI ROS Specific Driver Class * * */ -class ImageModifierAlgorithm +class ImageInverterAlgorithm { protected: /** * \brief define config type * - * Define a Config type with the ImageModifierConfig. All driver implementations + * Define a Config type with the ImageInverterConfig. All driver implementations * will then use the same variable type Config. */ pthread_mutex_t access_; @@ -51,10 +51,10 @@ class ImageModifierAlgorithm /** * \brief define config type * - * Define a Config type with the ImageModifierConfig. All driver implementations + * Define a Config type with the ImageInverterConfig. All driver implementations * will then use the same variable type Config. */ - typedef iri_image_modifier::ImageModifierConfig Config; + typedef iri_image_inverter::ImageInverterConfig Config; /** * \brief config variable @@ -72,7 +72,7 @@ class ImageModifierAlgorithm * Attributes from the main node driver class IriBaseDriver such as loop_rate, * may be also overload here. */ - ImageModifierAlgorithm(void); + ImageInverterAlgorithm(void); /** * \brief Lock Algorithm @@ -116,7 +116,7 @@ class ImageModifierAlgorithm */ void config_update(Config& config, uint32_t level=0); - // here define all image_modifier_alg interface methods to retrieve and set + // here define all image_inverter_alg interface methods to retrieve and set // the driver parameters /** @@ -125,7 +125,7 @@ class ImageModifierAlgorithm * This destructor is called when the object is about to be destroyed. * */ - ~ImageModifierAlgorithm(void); + ~ImageInverterAlgorithm(void); }; #endif diff --git a/include/image_modifier_alg_node.h b/include/image_inverter_alg_node.h similarity index 94% rename from include/image_modifier_alg_node.h rename to include/image_inverter_alg_node.h index 00d448bc0717de54e8095203eec53d98d0398ef7..1191fcc1252f97a6a214232e44ad88365fd5d61b 100644 --- a/include/image_modifier_alg_node.h +++ b/include/image_inverter_alg_node.h @@ -22,11 +22,11 @@ // refer to the IRI wiki page for more information: // http://wikiri.upc.es/index.php/Robotics_Lab -#ifndef _image_modifier_alg_node_h_ -#define _image_modifier_alg_node_h_ +#ifndef _image_inverter_alg_node_h_ +#define _image_inverter_alg_node_h_ #include <iri_base_algorithm/iri_base_algorithm.h> -#include "image_modifier_alg.h" +#include "image_inverter_alg.h" // [publisher subscriber headers] #include <camera_info_manager/camera_info_manager.h> @@ -43,7 +43,7 @@ * \brief IRI ROS Specific Algorithm Class * */ -class ImageModifierAlgNode : public algorithm_base::IriBaseAlgorithm<ImageModifierAlgorithm> +class ImageInverterAlgNode : public algorithm_base::IriBaseAlgorithm<ImageInverterAlgorithm> { private: // [publisher attributes] @@ -86,7 +86,7 @@ class ImageModifierAlgNode : public algorithm_base::IriBaseAlgorithm<ImageModifi * This constructor initializes specific class attributes and all ROS * communications variables to enable message exchange. */ - ImageModifierAlgNode(void); + ImageInverterAlgNode(void); /** * \brief Destructor @@ -94,7 +94,7 @@ class ImageModifierAlgNode : public algorithm_base::IriBaseAlgorithm<ImageModifi * This destructor frees all necessary dynamic memory allocated within this * this class. */ - ~ImageModifierAlgNode(void); + ~ImageInverterAlgNode(void); protected: /** diff --git a/launch/node.launch b/launch/node.launch index b8586ff676835960e843d46c5cddaed95a490f1e..5d52a42cc1d71f384a3f01f74c2c03803077d4eb 100644 --- a/launch/node.launch +++ b/launch/node.launch @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <launch> - <arg name="node_name" default="iri_image_modifier"/> + <arg name="node_name" default="iri_image_inverter"/> <arg name="output" default="screen"/> <arg name="launch_prefix" default=""/> - <arg name="config_file" default="$(find iri_image_modifier)/config/params.yaml"/> + <arg name="config_file" default="$(find iri_image_inverter)/config/params.yaml"/> <arg name="image_in_topic" default="image_in"/> <arg name="image_out_topic" default="image_out"/> <node name="$(arg node_name)" - pkg ="iri_image_modifier" - type="iri_image_modifier" + pkg ="iri_image_inverter" + type="iri_image_inverter" output="$(arg output)" launch-prefix="$(arg launch_prefix)"> <rosparam file="$(arg config_file)" command="load"/> diff --git a/launch/test.launch b/launch/test.launch index 70fd931b96baa612db1b25b898708e6f605bb379..68b86770d681af66e5f21e62f31c4cdebef92de7 100644 --- a/launch/test.launch +++ b/launch/test.launch @@ -5,17 +5,17 @@ <arg name="launch_prefix" default=""/> <arg name="dr" default="true"/> - <include file="$(find iri_image_modifier)/launch/node.launch"> - <arg name="node_name" value="iri_image_modifier"/> + <include file="$(find iri_image_inverter)/launch/node.launch"> + <arg name="node_name" value="iri_image_inverter"/> <arg name="output" value="$(arg output)"/> <arg name="launch_prefix" value="$(arg launch_prefix)"/> </include> - <node name="rqt_reconfigure_iri_image_modifier" + <node name="rqt_reconfigure_iri_image_inverter" pkg ="rqt_reconfigure" type="rqt_reconfigure" if ="$(arg dr)" - args="iri_image_modifier"> + args="iri_image_inverter"> </node> -</launch> \ No newline at end of file +</launch> diff --git a/package.xml b/package.xml index 185161aa5a53568ece5e6910f48f8603373beb30..e76cd0dbf680381c824c3c1f92f780997329f1cb 100644 --- a/package.xml +++ b/package.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <package format="2"> - <name>iri_image_modifier</name> + <name>iri_image_inverter</name> <version>1.0.0</version> - <description>The iri_image_modifier package subscribe to an image and republishes it with chosen modifications made on it</description> + <description>The iri_image_inverter package subscribe to an image and republishes it with chosen modifications made on it</description> <!-- One maintainer tag required, multiple allowed, one person per tag --> <!-- Example: --> @@ -19,7 +19,7 @@ <!-- Url tags are optional, but multiple are allowed, one per tag --> <!-- Optional attribute type can be: website, bugtracker, or repository --> <!-- Example: --> - <!-- <url type="website">http://wiki.ros.org/iri_image_modifier</url> --> + <!-- <url type="website">http://wiki.ros.org/iri_image_inverter</url> --> <!-- Author tags are optional, multiple are allowed, one per tag --> diff --git a/src/image_inverter_alg.cpp b/src/image_inverter_alg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f4619f678838266c68e604160308e57c60dd9beb --- /dev/null +++ b/src/image_inverter_alg.cpp @@ -0,0 +1,23 @@ +#include "image_inverter_alg.h" + +ImageInverterAlgorithm::ImageInverterAlgorithm(void) +{ + pthread_mutex_init(&this->access_,NULL); +} + +ImageInverterAlgorithm::~ImageInverterAlgorithm(void) +{ + pthread_mutex_destroy(&this->access_); +} + +void ImageInverterAlgorithm::config_update(Config& config, uint32_t level) +{ + this->lock(); + + // save the current configuration + this->config_=config; + + this->unlock(); +} + +// ImageInverterAlgorithm Public API diff --git a/src/image_modifier_alg_node.cpp b/src/image_inverter_alg_node.cpp similarity index 79% rename from src/image_modifier_alg_node.cpp rename to src/image_inverter_alg_node.cpp index 066d42a490c3e616a6e33d26b9b0f01b53207676..e9a4a17fd2952f778891f7a1801a5cd6146b47be 100644 --- a/src/image_modifier_alg_node.cpp +++ b/src/image_inverter_alg_node.cpp @@ -1,14 +1,14 @@ -#include "image_modifier_alg_node.h" +#include "image_inverter_alg_node.h" -ImageModifierAlgNode::ImageModifierAlgNode(void) : - algorithm_base::IriBaseAlgorithm<ImageModifierAlgorithm>(), +ImageInverterAlgNode::ImageInverterAlgNode(void) : + algorithm_base::IriBaseAlgorithm<ImageInverterAlgorithm>(), image_camera_manager(ros::NodeHandle("~image")), it(this->private_node_handle_) { //init class attributes if necessary if(!this->private_node_handle_.getParam("rate", this->config_.rate)) { - ROS_WARN("ImageModifierAlgNode::ImageModifierAlgNode: param 'rate' not found"); + ROS_WARN("ImageInverterAlgNode::ImageInverterAlgNode: param 'rate' not found"); } else this->setRate(this->config_.rate); @@ -29,7 +29,7 @@ ImageModifierAlgNode::ImageModifierAlgNode(void) : // [init subscribers] - this->image_subscriber_ = this->it.subscribeCamera("image_in/image_raw", 1, &ImageModifierAlgNode::image_callback, this); + this->image_subscriber_ = this->it.subscribeCamera("image_in/image_raw", 1, &ImageInverterAlgNode::image_callback, this); pthread_mutex_init(&this->image_mutex_,NULL); @@ -42,17 +42,17 @@ ImageModifierAlgNode::ImageModifierAlgNode(void) : // [init action clients] } -ImageModifierAlgNode::~ImageModifierAlgNode(void) +ImageInverterAlgNode::~ImageInverterAlgNode(void) { // [free dynamic memory] pthread_mutex_destroy(&this->image_mutex_); } -void ImageModifierAlgNode::mainNodeThread(void) +void ImageInverterAlgNode::mainNodeThread(void) { //lock access to algorithm if necessary this->alg_.lock(); - ROS_DEBUG("ImageModifierAlgNode::mainNodeThread"); + ROS_DEBUG("ImageInverterAlgNode::mainNodeThread"); // [fill msg structures] // Initialize the topic message structure //this->image_Image_msg_.data = my_var; @@ -78,9 +78,9 @@ void ImageModifierAlgNode::mainNodeThread(void) } /* [subscriber callbacks] */ -void ImageModifierAlgNode::image_callback(const sensor_msgs::Image::ConstPtr& msg, const sensor_msgs::CameraInfoConstPtr& info) +void ImageInverterAlgNode::image_callback(const sensor_msgs::Image::ConstPtr& msg, const sensor_msgs::CameraInfoConstPtr& info) { - //ROS_INFO("ImageModifierAlgNode::image_callback: New Message Received"); + //ROS_INFO("ImageInverterAlgNode::image_callback: New Message Received"); //use appropiate mutex to shared variables if necessary //this->alg_.lock(); @@ -101,12 +101,12 @@ void ImageModifierAlgNode::image_callback(const sensor_msgs::Image::ConstPtr& ms //this->image_mutex_exit(); } -void ImageModifierAlgNode::image_mutex_enter(void) +void ImageInverterAlgNode::image_mutex_enter(void) { pthread_mutex_lock(&this->image_mutex_); } -void ImageModifierAlgNode::image_mutex_exit(void) +void ImageInverterAlgNode::image_mutex_exit(void) { pthread_mutex_unlock(&this->image_mutex_); } @@ -118,7 +118,7 @@ void ImageModifierAlgNode::image_mutex_exit(void) /* [action requests] */ -void ImageModifierAlgNode::node_config_update(Config &config, uint32_t level) +void ImageInverterAlgNode::node_config_update(Config &config, uint32_t level) { this->alg_.lock(); if(config.rate!=this->getRate()) @@ -127,12 +127,12 @@ void ImageModifierAlgNode::node_config_update(Config &config, uint32_t level) this->alg_.unlock(); } -void ImageModifierAlgNode::addNodeDiagnostics(void) +void ImageInverterAlgNode::addNodeDiagnostics(void) { } /* main function */ int main(int argc,char *argv[]) { - return algorithm_base::main<ImageModifierAlgNode>(argc, argv, "image_modifier_alg_node"); + return algorithm_base::main<ImageInverterAlgNode>(argc, argv, "image_inverter_alg_node"); } diff --git a/src/image_modifier_alg.cpp b/src/image_modifier_alg.cpp deleted file mode 100644 index 532ec1f5b4cd243771bc8cf60b9d8b19bd6f3d32..0000000000000000000000000000000000000000 --- a/src/image_modifier_alg.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "image_modifier_alg.h" - -ImageModifierAlgorithm::ImageModifierAlgorithm(void) -{ - pthread_mutex_init(&this->access_,NULL); -} - -ImageModifierAlgorithm::~ImageModifierAlgorithm(void) -{ - pthread_mutex_destroy(&this->access_); -} - -void ImageModifierAlgorithm::config_update(Config& config, uint32_t level) -{ - this->lock(); - - // save the current configuration - this->config_=config; - - this->unlock(); -} - -// ImageModifierAlgorithm Public API