File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,17 @@ namespace dynamicgraph
88
88
dst = src.data ;
89
89
}
90
90
91
+ // String
92
+ SOT_TO_ROS_IMPL (std::string)
93
+ {
94
+ dst.data = src;
95
+ }
96
+
97
+ ROS_TO_SOT_IMPL (std::string)
98
+ {
99
+ dst = src.data ;
100
+ }
101
+
91
102
// Vector
92
103
SOT_TO_ROS_IMPL (Vector)
93
104
{
@@ -242,6 +253,7 @@ namespace dynamicgraph
242
253
DG_BRIDGE_MAKE_SHPTR_IMPL (double );
243
254
DG_BRIDGE_MAKE_SHPTR_IMPL (int );
244
255
DG_BRIDGE_MAKE_SHPTR_IMPL (unsigned int );
256
+ DG_BRIDGE_MAKE_SHPTR_IMPL (std::string);
245
257
DG_BRIDGE_MAKE_SHPTR_IMPL (Vector);
246
258
DG_BRIDGE_MAKE_SHPTR_IMPL (specific::Vector3);
247
259
DG_BRIDGE_MAKE_SHPTR_IMPL (Matrix);
Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ namespace dynamicgraph
107
107
entity.add <specific::Twist> (signal, topic);
108
108
else if (type == " twistStamped" )
109
109
entity.add <std::pair<specific::Twist, Vector> > (signal, topic);
110
+ else if (type == " string" )
111
+ entity.add <std::string> (signal, topic);
110
112
else
111
113
throw std::runtime_error (" bad type" );
112
114
return Value ();
Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ namespace dynamicgraph
94
94
else if (type == " twistStamped" )
95
95
entity.add <std::pair<specific::Twist, dg::Vector> >
96
96
(signal, topic);
97
+ else if (type == " string" )
98
+ entity.add <std::string> (signal, topic);
97
99
else
98
100
throw std::runtime_error (" bad type" );
99
101
return Value ();
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ namespace dynamicgraph
6
6
const char * SotToRos<bool >::signalTypeName = " bool" ;
7
7
const char * SotToRos<double >::signalTypeName = " Double" ;
8
8
const char * SotToRos<int >::signalTypeName = " int" ;
9
+ const char * SotToRos<std::string>::signalTypeName = " string" ;
9
10
const char * SotToRos<unsigned int >::signalTypeName = " Unsigned" ;
10
11
const char * SotToRos<Matrix>::signalTypeName = " Matrix" ;
11
12
const char * SotToRos<Vector>::signalTypeName = " Vector" ;
Original file line number Diff line number Diff line change 9
9
# include < std_msgs/Float64.h>
10
10
# include < std_msgs/UInt32.h>
11
11
# include < std_msgs/Int32.h>
12
+ # include < std_msgs/String.h>
12
13
# include " dynamic_graph_bridge_msgs/Matrix.h"
13
14
# include " dynamic_graph_bridge_msgs/Vector.h"
14
15
@@ -146,6 +147,30 @@ namespace dynamicgraph
146
147
}
147
148
};
148
149
150
+ template <>
151
+ struct SotToRos <std::string>
152
+ {
153
+ typedef std::string sot_t ;
154
+ typedef std_msgs::String ros_t ;
155
+ typedef std_msgs::StringConstPtr ros_const_ptr_t ;
156
+ typedef dynamicgraph::Signal<sot_t , int > signal_t ;
157
+ typedef dynamicgraph::SignalPtr<sot_t , int > signalIn_t;
158
+ typedef boost::function<sot_t & (sot_t &, int )> callback_t ;
159
+
160
+ static const char * signalTypeName;
161
+
162
+ template <typename S>
163
+ static void setDefault (S& s)
164
+ {
165
+ s.setConstant (" " );
166
+ }
167
+
168
+ static void setDefault (sot_t & s)
169
+ {
170
+ s = std::string ();
171
+ }
172
+ };
173
+
149
174
template <>
150
175
struct SotToRos <Matrix>
151
176
{
You can’t perform that action at this time.
0 commit comments