diff --git a/src/converter.hh b/src/converter.hh index 4cc8e56bb48d03cb67c8273e591e4d03ab4f7550..e53cbf52f1a359e88c8b0c1c9ad62ce3696e9714 100644 --- a/src/converter.hh +++ b/src/converter.hh @@ -55,6 +55,17 @@ namespace dynamicgraph dst = src.data; } + // Unsigned + SOT_TO_ROS_IMPL(unsigned int) + { + dst.data = src; + } + + ROS_TO_SOT_IMPL(unsigned int) + { + dst = src.data; + } + // Vector SOT_TO_ROS_IMPL(ml::Vector) { @@ -210,6 +221,7 @@ namespace dynamicgraph struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n DG_BRIDGE_MAKE_SHPTR_IMPL(double); + DG_BRIDGE_MAKE_SHPTR_IMPL(unsigned int); DG_BRIDGE_MAKE_SHPTR_IMPL(ml::Vector); DG_BRIDGE_MAKE_SHPTR_IMPL(specific::Vector3); DG_BRIDGE_MAKE_SHPTR_IMPL(ml::Matrix); diff --git a/src/ros_export.cpp b/src/ros_export.cpp index 70a5f6e321f3eb65de40cf5c0d82050047c627f8..aafa3e182aa6275905de23fc6459cabd0e0c421e 100644 --- a/src/ros_export.cpp +++ b/src/ros_export.cpp @@ -6,6 +6,7 @@ #include <ros/ros.h> #include <std_msgs/Float64.h> +#include <std_msgs/UInt32.h> #include <dynamic-graph/factory.h> @@ -73,6 +74,8 @@ namespace dynamicgraph if (type == "double") entity.add<double> (signal, topic); + else if (type == "unsigned") + entity.add<unsigned int> (signal, topic); else if (type == "matrix") entity.add<ml::Matrix> (signal, topic); else if (type == "vector") diff --git a/src/ros_import.cpp b/src/ros_import.cpp index 4497b6e861d96b1d5f323b31d9dcbb9a416dd332..88279b0c17518566bf9173cf5c35b5e7464f2659 100644 --- a/src/ros_import.cpp +++ b/src/ros_import.cpp @@ -9,6 +9,7 @@ #include <ros/ros.h> #include <std_msgs/Float64.h> +#include <std_msgs/UInt32.h> #include <dynamic-graph/factory.h> #include <dynamic-graph/command.h> @@ -77,6 +78,8 @@ namespace dynamicgraph if (type == "double") entity.add<double> (signal, topic); + else if (type == "unsigned") + entity.add<unsigned int> (signal, topic); else if (type == "matrix") entity.add<ml::Matrix> (signal, topic); else if (type == "vector") diff --git a/src/sot_to_ros.cpp b/src/sot_to_ros.cpp index 1b52ae904108e5f48c674ae26aed77f987cd5aef..701087c5a1ad7508ff5dc7e9651ac4a0fd7fac30 100644 --- a/src/sot_to_ros.cpp +++ b/src/sot_to_ros.cpp @@ -4,6 +4,7 @@ namespace dynamicgraph { const char* SotToRos<double>::signalTypeName = "Double"; + const char* SotToRos<unsigned int>::signalTypeName = "Unsigned"; const char* SotToRos<ml::Matrix>::signalTypeName = "Matrix"; const char* SotToRos<ml::Vector>::signalTypeName = "Vector"; const char* SotToRos<specific::Vector3>::signalTypeName = "Vector3"; diff --git a/src/sot_to_ros.hh b/src/sot_to_ros.hh index 20881758669365f0a43528cda4025918426ac2ec..88787895408da4c2363186a6f3eaf0ad4dd9ff51 100644 --- a/src/sot_to_ros.hh +++ b/src/sot_to_ros.hh @@ -7,6 +7,7 @@ # include <jrl/mal/boost.hh> # include <std_msgs/Float64.h> +# include <std_msgs/UInt32.h> # include "dynamic_graph_bridge/Matrix.h" # include "dynamic_graph_bridge/Vector.h" @@ -67,6 +68,25 @@ namespace dynamicgraph } }; + template <> + struct SotToRos<unsigned int> + { + typedef unsigned int sot_t; + typedef std_msgs::UInt32 ros_t; + typedef std_msgs::UInt32ConstPtr ros_const_ptr_t; + typedef dynamicgraph::Signal<sot_t, int> signal_t; + typedef dynamicgraph::SignalPtr<sot_t, int> signalIn_t; + typedef boost::function<sot_t& (sot_t&, int)> callback_t; + + static const char* signalTypeName; + + template <typename S> + static void setDefault(S& s) + { + s.setConstant (0); + } + }; + template <> struct SotToRos<ml::Matrix> {