File tree Expand file tree Collapse file tree 4 files changed +41
-1
lines changed Expand file tree Collapse file tree 4 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,17 @@ namespace dynamicgraph
44
44
template <typename D, typename S>
45
45
void converter (D& dst, const S& src);
46
46
47
+ // Boolean
48
+ SOT_TO_ROS_IMPL (bool )
49
+ {
50
+ dst.data = src;
51
+ }
52
+
53
+ ROS_TO_SOT_IMPL (bool )
54
+ {
55
+ dst = src.data ;
56
+ }
57
+
47
58
// Double
48
59
SOT_TO_ROS_IMPL (double )
49
60
{
@@ -216,6 +227,7 @@ namespace dynamicgraph
216
227
} \
217
228
struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
218
229
230
+ DG_BRIDGE_MAKE_SHPTR_IMPL (bool );
219
231
DG_BRIDGE_MAKE_SHPTR_IMPL (double );
220
232
DG_BRIDGE_MAKE_SHPTR_IMPL (unsigned int );
221
233
DG_BRIDGE_MAKE_SHPTR_IMPL (Vector);
Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ namespace dynamicgraph
78
78
const std::string& signal = values[1 ].value ();
79
79
const std::string& topic = values[2 ].value ();
80
80
81
- if (type == " double" )
81
+ if (type == " boolean" )
82
+ entity.add <bool > (signal, topic);
83
+ else if (type == " double" )
82
84
entity.add <double > (signal, topic);
83
85
else if (type == " unsigned" )
84
86
entity.add <unsigned int > (signal, topic);
Original file line number Diff line number Diff line change 3
3
namespace dynamicgraph
4
4
{
5
5
6
+ const char * SotToRos<bool >::signalTypeName = " bool" ;
6
7
const char * SotToRos<double >::signalTypeName = " Double" ;
7
8
const char * SotToRos<unsigned int >::signalTypeName = " Unsigned" ;
8
9
const char * SotToRos<Matrix>::signalTypeName = " Matrix" ;
Original file line number Diff line number Diff line change 5
5
6
6
# include < boost/format.hpp>
7
7
8
+ # include < std_msgs/Bool.h>
8
9
# include < std_msgs/Float64.h>
9
10
# include < std_msgs/UInt32.h>
10
11
# include " dynamic_graph_bridge_msgs/Matrix.h"
@@ -48,6 +49,30 @@ namespace dynamicgraph
48
49
template <typename SotType>
49
50
class SotToRos ;
50
51
52
+ template <>
53
+ struct SotToRos <bool >
54
+ {
55
+ typedef bool sot_t ;
56
+ typedef std_msgs::Bool ros_t ;
57
+ typedef std_msgs::BoolConstPtr ros_const_ptr_t ;
58
+ typedef dynamicgraph::Signal<sot_t , int > signal_t ;
59
+ typedef dynamicgraph::SignalPtr<sot_t , int > signalIn_t;
60
+ typedef boost::function<sot_t & (sot_t &, int )> callback_t ;
61
+
62
+ static const char * signalTypeName;
63
+
64
+ template <typename S>
65
+ static void setDefault (S& s)
66
+ {
67
+ s.setConstant (false );
68
+ }
69
+
70
+ static void setDefault (sot_t & s)
71
+ {
72
+ s = false ;
73
+ }
74
+ };
75
+
51
76
template <>
52
77
struct SotToRos <double >
53
78
{
You can’t perform that action at this time.
0 commit comments