diff --git a/CMakeLists.txt b/CMakeLists.txt index 25706ac4f224dc9a4620079ce5167f3d4dbf84e7..8f2b5a3f78d8db06bd5bf802a28dd8b153698b6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.3) -project(iri_tf_publisher_dynamic) +project(iri_dynamic_transform_publisher) ## Find catkin macros and libraries find_package(catkin REQUIRED) @@ -49,7 +49,7 @@ find_package(catkin REQUIRED COMPONENTS iri_base_algorithm tf) # ******************************************************************** # Add the dynamic reconfigure file # ******************************************************************** -generate_dynamic_reconfigure_options(cfg/TfPublisherDynamic.cfg) +generate_dynamic_reconfigure_options(cfg/config.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/tf_publisher_dynamic_alg.cpp src/tf_publisher_dynamic_alg_node.cpp) +add_executable(${PROJECT_NAME} src/dynamic_transform_publisher_alg.cpp src/dynamic_transform_publisher_alg_node.cpp) # ******************************************************************** # Add the libraries diff --git a/cfg/TfPublisherDynamic.cfg b/cfg/config.cfg similarity index 95% rename from cfg/TfPublisherDynamic.cfg rename to cfg/config.cfg index 49e58ef3eeff8a5516889171c9acdca0e8c070da..e892001a6186fbe43206075236e979b811db7f9a 100755 --- a/cfg/TfPublisherDynamic.cfg +++ b/cfg/config.cfg @@ -31,7 +31,7 @@ # Author: -PACKAGE='iri_tf_publisher_dynamic' +PACKAGE='iri_dynamic_transform_publisher' from dynamic_reconfigure.parameter_generator_catkin import * @@ -52,6 +52,6 @@ gen.add("pitch", double_t, 0, "pitch rotation in radians gen.add("yaw", double_t, 0, "yaw rotation in radians", 0.0, -3.14159, 3.14159) gen.add("show_rosrun", bool_t, 0, "outputs ROS_INFO with rosrun equivalent", False) -exit(gen.generate(PACKAGE, "TfPublisherDynamicAlgorithm", "TfPublisherDynamic")) +exit(gen.generate(PACKAGE, "DynamicTransformPublisherAlgorithm", "DynamicTransformPublisher")) diff --git a/include/tf_publisher_dynamic_alg.h b/include/dynamic_transform_publisher_alg.h similarity index 81% rename from include/tf_publisher_dynamic_alg.h rename to include/dynamic_transform_publisher_alg.h index 81cd699a9d84e050752298c41bb832a089d3f143..3faa564e584dd9982ee42a6b73536ac16ec590f4 100644 --- a/include/tf_publisher_dynamic_alg.h +++ b/include/dynamic_transform_publisher_alg.h @@ -22,25 +22,25 @@ // refer to the IRI wiki page for more information: // http://wikiri.upc.es/index.php/Robotics_Lab -#ifndef _tf_publisher_dynamic_alg_h_ -#define _tf_publisher_dynamic_alg_h_ +#ifndef _dynamic_transform_publisher_alg_h_ +#define _dynamic_transform_publisher_alg_h_ -#include <iri_tf_publisher_dynamic/TfPublisherDynamicConfig.h> +#include <iri_dynamic_transform_publisher/DynamicTransformPublisherConfig.h> -//include tf_publisher_dynamic_alg main library +//include dynamic_transform_publisher_alg main library /** * \brief IRI ROS Specific Driver Class * * */ -class TfPublisherDynamicAlgorithm +class DynamicTransformPublisherAlgorithm { protected: /** * \brief define config type * - * Define a Config type with the TfPublisherDynamicConfig. All driver implementations + * Define a Config type with the DynamicTransformPublisherConfig. All driver implementations * will then use the same variable type Config. */ pthread_mutex_t access_; @@ -51,10 +51,10 @@ class TfPublisherDynamicAlgorithm /** * \brief define config type * - * Define a Config type with the TfPublisherDynamicConfig. All driver implementations + * Define a Config type with the DynamicTransformPublisherConfig. All driver implementations * will then use the same variable type Config. */ - typedef iri_tf_publisher_dynamic::TfPublisherDynamicConfig Config; + typedef iri_dynamic_transform_publisher::DynamicTransformPublisherConfig Config; /** * \brief config variable @@ -72,7 +72,7 @@ class TfPublisherDynamicAlgorithm * Attributes from the main node driver class IriBaseDriver such as loop_rate, * may be also overload here. */ - TfPublisherDynamicAlgorithm(void); + DynamicTransformPublisherAlgorithm(void); /** * \brief Lock Algorithm @@ -116,7 +116,7 @@ class TfPublisherDynamicAlgorithm */ void config_update(Config& config, uint32_t level=0); - // here define all tf_publisher_dynamic_alg interface methods to retrieve and set + // here define all dynamic_transform_publisher_alg interface methods to retrieve and set // the driver parameters /** @@ -125,7 +125,7 @@ class TfPublisherDynamicAlgorithm * This destructor is called when the object is about to be destroyed. * */ - ~TfPublisherDynamicAlgorithm(void); + ~DynamicTransformPublisherAlgorithm(void); }; #endif diff --git a/include/tf_publisher_dynamic_alg_node.h b/include/dynamic_transform_publisher_alg_node.h similarity index 91% rename from include/tf_publisher_dynamic_alg_node.h rename to include/dynamic_transform_publisher_alg_node.h index 196ea538119bd4c9df30587d07217ede06ef8561..57f1886456b93c88c3efcd7023e1268c5ee97ae9 100644 --- a/include/tf_publisher_dynamic_alg_node.h +++ b/include/dynamic_transform_publisher_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 _tf_publisher_dynamic_alg_node_h_ -#define _tf_publisher_dynamic_alg_node_h_ +#ifndef _dynamic_transform_publisher_alg_node_h_ +#define _dynamic_transform_publisher_alg_node_h_ #include <iri_base_algorithm/iri_base_algorithm.h> -#include "tf_publisher_dynamic_alg.h" +#include "dynamic_transform_publisher_alg.h" // [publisher subscriber headers] @@ -40,7 +40,7 @@ * \brief IRI ROS Specific Algorithm Class * */ -class TfPublisherDynamicAlgNode : public algorithm_base::IriBaseAlgorithm<TfPublisherDynamicAlgorithm> +class DynamicTransformPublisherAlgNode : public algorithm_base::IriBaseAlgorithm<DynamicTransformPublisherAlgorithm> { private: // [publisher attributes] @@ -71,7 +71,7 @@ class TfPublisherDynamicAlgNode : public algorithm_base::IriBaseAlgorithm<TfPubl * This constructor initializes specific class attributes and all ROS * communications variables to enable message exchange. */ - TfPublisherDynamicAlgNode(void); + DynamicTransformPublisherAlgNode(void); /** * \brief Destructor @@ -79,7 +79,7 @@ class TfPublisherDynamicAlgNode : public algorithm_base::IriBaseAlgorithm<TfPubl * This destructor frees all necessary dynamic memory allocated within this * this class. */ - ~TfPublisherDynamicAlgNode(void); + ~DynamicTransformPublisherAlgNode(void); protected: /** diff --git a/package.xml b/package.xml index 2859c0824cd8ea0e8e1f5a441f7682934e84a9c0..3a0eb1feb74b3356a101d56368589ee27b16939c 100644 --- a/package.xml +++ b/package.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <package format="2"> - <name>iri_tf_publisher_dynamic</name> + <name>iri_dynamic_transform_publisher</name> <version>0.0.0</version> <description> - The iri_tf_publisher_dynamic package broadcasts a tf transform between two frames as defined with dynamic reconfigure parameters. + The iri_dynamic_transform_publisher package broadcasts a tf transform between two frames as defined with dynamic reconfigure parameters. Useful for dynamically adjust and find a desired static transform, to be replaced once found by a tf/static_transform_publisher node</description> <!-- One maintainer tag required, multiple allowed, one person per tag --> @@ -21,7 +21,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_tf_publisher_dynamic</url> --> + <!-- <url type="website">http://wiki.ros.org/iri_dynamic_transform_publisher</url> --> <!-- Author tags are optional, multiple are allowed, one per tag --> @@ -62,4 +62,4 @@ <!-- Other tools can request additional information be placed here --> </export> -</package> +</package> \ No newline at end of file diff --git a/src/dynamic_transform_publisher_alg.cpp b/src/dynamic_transform_publisher_alg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66c7159a706051cb8e79d42f848861aa23f956bc --- /dev/null +++ b/src/dynamic_transform_publisher_alg.cpp @@ -0,0 +1,23 @@ +#include "dynamic_transform_publisher_alg.h" + +DynamicTransformPublisherAlgorithm::DynamicTransformPublisherAlgorithm(void) +{ + pthread_mutex_init(&this->access_,NULL); +} + +DynamicTransformPublisherAlgorithm::~DynamicTransformPublisherAlgorithm(void) +{ + pthread_mutex_destroy(&this->access_); +} + +void DynamicTransformPublisherAlgorithm::config_update(Config& config, uint32_t level) +{ + this->lock(); + + // save the current configuration + this->config_=config; + + this->unlock(); +} + +// DynamicTransformPublisherAlgorithm Public API diff --git a/src/tf_publisher_dynamic_alg_node.cpp b/src/dynamic_transform_publisher_alg_node.cpp similarity index 76% rename from src/tf_publisher_dynamic_alg_node.cpp rename to src/dynamic_transform_publisher_alg_node.cpp index 46611f77839227347599b32dfc2017b6132b34f9..9689101b02e072c515aaffaa00be702a0b83c46b 100644 --- a/src/tf_publisher_dynamic_alg_node.cpp +++ b/src/dynamic_transform_publisher_alg_node.cpp @@ -1,7 +1,7 @@ -#include "tf_publisher_dynamic_alg_node.h" +#include "dynamic_transform_publisher_alg_node.h" -TfPublisherDynamicAlgNode::TfPublisherDynamicAlgNode(void) : - algorithm_base::IriBaseAlgorithm<TfPublisherDynamicAlgorithm>() +DynamicTransformPublisherAlgNode::DynamicTransformPublisherAlgNode(void) : + algorithm_base::IriBaseAlgorithm<DynamicTransformPublisherAlgorithm>() { //init class attributes if necessary //this->loop_rate_ = 2; //in [Hz] @@ -19,12 +19,12 @@ TfPublisherDynamicAlgNode::TfPublisherDynamicAlgNode(void) : // [init action clients] } -TfPublisherDynamicAlgNode::~TfPublisherDynamicAlgNode(void) +DynamicTransformPublisherAlgNode::~DynamicTransformPublisherAlgNode(void) { // [free dynamic memory] } -void TfPublisherDynamicAlgNode::mainNodeThread(void) +void DynamicTransformPublisherAlgNode::mainNodeThread(void) { // [fill msg structures] @@ -53,7 +53,7 @@ void TfPublisherDynamicAlgNode::mainNodeThread(void) /* [action requests] */ -void TfPublisherDynamicAlgNode::node_config_update(Config &config, uint32_t level) +void DynamicTransformPublisherAlgNode::node_config_update(Config &config, uint32_t level) { this->alg_.lock(); @@ -93,12 +93,12 @@ void TfPublisherDynamicAlgNode::node_config_update(Config &config, uint32_t leve this->alg_.unlock(); } -void TfPublisherDynamicAlgNode::addNodeDiagnostics(void) +void DynamicTransformPublisherAlgNode::addNodeDiagnostics(void) { } /* main function */ int main(int argc,char *argv[]) { - return algorithm_base::main<TfPublisherDynamicAlgNode>(argc, argv, "tf_publisher_dynamic_alg_node"); + return algorithm_base::main<DynamicTransformPublisherAlgNode>(argc, argv, "dynamic_transform_publisher_alg_node"); } diff --git a/src/tf_publisher_dynamic_alg.cpp b/src/tf_publisher_dynamic_alg.cpp deleted file mode 100644 index 147ae163b0a49d4282bb8ef8c05ab26efe9a6158..0000000000000000000000000000000000000000 --- a/src/tf_publisher_dynamic_alg.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "tf_publisher_dynamic_alg.h" - -TfPublisherDynamicAlgorithm::TfPublisherDynamicAlgorithm(void) -{ - pthread_mutex_init(&this->access_,NULL); -} - -TfPublisherDynamicAlgorithm::~TfPublisherDynamicAlgorithm(void) -{ - pthread_mutex_destroy(&this->access_); -} - -void TfPublisherDynamicAlgorithm::config_update(Config& config, uint32_t level) -{ - this->lock(); - - // save the current configuration - this->config_=config; - - this->unlock(); -} - -// TfPublisherDynamicAlgorithm Public API