Skip to content

Commit 92ff2a0

Browse files
authored
Merge branch 'toolchain-2.9' into fix-rtt_roscomm-rosservice-namespace
2 parents 424e09f + 2c599b3 commit 92ff2a0

File tree

15 files changed

+337
-170
lines changed

15 files changed

+337
-170
lines changed

rtt_dynamic_reconfigure/include/orocos/rtt_dynamic_reconfigure/server.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ typedef void (NotifyCallbackSignature)(uint32_t level);
7474
*/
7575
template <class ConfigType>
7676
struct Updater {
77-
virtual bool propertiesFromConfig(ConfigType &config, uint32_t level, RTT::PropertyBag &) { return false; }
78-
virtual bool configFromProperties(ConfigType &config, const RTT::PropertyBag &) { return false; }
77+
virtual bool propertiesFromConfig(ConfigType &, uint32_t, RTT::PropertyBag &) { return false; }
78+
virtual bool configFromProperties(ConfigType &, const RTT::PropertyBag &) { return false; }
7979
};
8080

8181
template <class ConfigType>

rtt_roscomm/include/rtt_roscomm/rtt_rosservice_proxy.h

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#include <rtt/internal/GlobalEngine.hpp>
88
#include <rtt/plugin/ServicePlugin.hpp>
99

10+
#include <boost/utility/enable_if.hpp>
11+
#include <boost/type_traits/is_void.hpp>
12+
1013
namespace rtt_roscomm {
1114

1215
//! Abstract ROS Service Proxy
@@ -48,7 +51,9 @@ class ROSServiceServerOperationCallerBase {
4851
};
4952

5053
template<class ROS_SERVICE_T, int variant = 0>
51-
struct ROSServiceServerOperationCallerWrapper;
54+
struct ROSServiceServerOperationCallerWrapper {
55+
typedef void ProxyOperationCallerType;
56+
};
5257

5358
// Default implementation of an OperationCaller that fowards ROS service calls to Orocos operations
5459
// that have the default bool(Request&, Response&) signature. You can add more variants of this class
@@ -68,7 +73,7 @@ struct ROSServiceServerOperationCallerWrapper<ROS_SERVICE_T,0> {
6873
template<class ROS_SERVICE_T, int variant = 0>
6974
class ROSServiceServerOperationCaller : public ROSServiceServerOperationCallerBase<ROS_SERVICE_T> {
7075
public:
71-
using typename ROSServiceServerOperationCallerBase<ROS_SERVICE_T>::Ptr;
76+
typedef typename ROSServiceServerOperationCallerBase<ROS_SERVICE_T>::Ptr Ptr;
7277

7378
//! The wrapper type for this variant
7479
typedef ROSServiceServerOperationCallerWrapper<ROS_SERVICE_T, variant> Wrapper;
@@ -77,14 +82,7 @@ class ROSServiceServerOperationCaller : public ROSServiceServerOperationCallerBa
7782
typedef typename Wrapper::ProxyOperationCallerType ProxyOperationCallerType;
7883
typedef boost::shared_ptr<ProxyOperationCallerType> ProxyOperationCallerTypePtr;
7984

80-
static Ptr connect(RTT::OperationInterfacePart* operation) {
81-
ProxyOperationCallerTypePtr proxy_operation_caller
82-
= boost::make_shared<ProxyOperationCallerType>(operation->getLocalOperation(), RTT::internal::GlobalEngine::Instance());
83-
if (proxy_operation_caller->ready()) {
84-
return Ptr(new ROSServiceServerOperationCaller<ROS_SERVICE_T, variant>(proxy_operation_caller));
85-
}
86-
return NextVariant<void>::connect(operation);
87-
}
85+
static Ptr connect(RTT::OperationInterfacePart* operation);
8886

8987
virtual bool call(typename ROS_SERVICE_T::Request& request, typename ROS_SERVICE_T::Response& response) const {
9088
// Check if the operation caller is ready, and then call it.
@@ -93,32 +91,41 @@ class ROSServiceServerOperationCaller : public ROSServiceServerOperationCallerBa
9391
}
9492

9593
private:
96-
template<typename Dummy> struct Void { typedef void type; };
94+
ROSServiceServerOperationCaller(const boost::shared_ptr<ProxyOperationCallerType>& impl)
95+
: proxy_operation_caller_(impl) {}
9796

98-
template<typename R = void, typename Enabled = void> struct EnableIfHasNextVariant { };
97+
ProxyOperationCallerTypePtr proxy_operation_caller_;
98+
};
9999

100-
template<typename R> struct EnableIfHasNextVariant<R,
101-
typename Void<typename ROSServiceServerOperationCallerWrapper<ROS_SERVICE_T, variant + 1>::ProxyOperationCallerType>::type> {
102-
typedef R type;
103-
};
100+
namespace {
104101

105-
template<typename R = void, typename Enabled = void>
106-
struct NextVariant {
107-
static Ptr connect(RTT::OperationInterfacePart*) { return Ptr(); }
108-
};
102+
template<class ROS_SERVICE_T, int variant, typename Enabled = void>
103+
struct ROSServiceServerOperationCallerWrapperNextVariant {
104+
typedef typename ROSServiceServerOperationCallerBase<ROS_SERVICE_T>::Ptr Ptr;
105+
static Ptr connect(RTT::OperationInterfacePart*) { return Ptr(); }
106+
};
109107

110-
template<typename R>
111-
struct NextVariant<R, typename EnableIfHasNextVariant<R>::type> {
112-
static Ptr connect(RTT::OperationInterfacePart* operation) {
113-
return ROSServiceServerOperationCaller<ROS_SERVICE_T, variant + 1>::connect(operation);
114-
}
115-
};
108+
template<class ROS_SERVICE_T, int variant>
109+
struct ROSServiceServerOperationCallerWrapperNextVariant<ROS_SERVICE_T, variant,
110+
typename boost::disable_if<boost::is_void<typename ROSServiceServerOperationCallerWrapper<ROS_SERVICE_T, variant + 1>::ProxyOperationCallerType> >::type> {
111+
typedef typename ROSServiceServerOperationCallerBase<ROS_SERVICE_T>::Ptr Ptr;
112+
static Ptr connect(RTT::OperationInterfacePart* operation) {
113+
return ROSServiceServerOperationCaller<ROS_SERVICE_T, variant + 1>::connect(operation);
114+
}
115+
};
116116

117-
ROSServiceServerOperationCaller(const boost::shared_ptr<ProxyOperationCallerType>& impl)
118-
: proxy_operation_caller_(impl) {}
117+
}
119118

120-
ProxyOperationCallerTypePtr proxy_operation_caller_;
121-
};
119+
template<class ROS_SERVICE_T, int variant>
120+
typename ROSServiceServerOperationCaller<ROS_SERVICE_T, variant>::Ptr
121+
ROSServiceServerOperationCaller<ROS_SERVICE_T, variant>::connect(RTT::OperationInterfacePart* operation) {
122+
ProxyOperationCallerTypePtr proxy_operation_caller
123+
= boost::make_shared<ProxyOperationCallerType>(operation->getLocalOperation(), RTT::internal::GlobalEngine::Instance());
124+
if (proxy_operation_caller->ready()) {
125+
return Ptr(new ROSServiceServerOperationCaller<ROS_SERVICE_T, variant>(proxy_operation_caller));
126+
}
127+
return ROSServiceServerOperationCallerWrapperNextVariant<ROS_SERVICE_T, variant>::connect(operation);
128+
}
122129

123130
template<class ROS_SERVICE_T>
124131
class ROSServiceServerProxy : public ROSServiceServerProxyBase

rtt_roscomm/src/templates/service/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ else()
66
#add_definitions( -DRTT_COMPONENT )
77
endif()
88

9-
include(AddFileDependencies)
10-
119
# Configure source and destination paths of generated files
1210
rtt_roscomm_destinations()
1311

@@ -89,8 +87,6 @@ configure_file(
8987
rtt_rosservice_proxies.cpp.in
9088
${CMAKE_CURRENT_BINARY_DIR}/rtt_rosservice_proxies.cpp @ONLY )
9189

92-
add_file_dependencies( ${CMAKE_CURRENT_BINARY_DIR}/rtt_rosservice_proxies.cpp ${SRV_FILES})
93-
9490
include_directories(
9591
${USE_OROCOS_INCLUDE_DIRS}
9692
${catkin_INCLUDE_DIRS}
@@ -105,7 +101,6 @@ target_link_libraries( rtt_${ROSPACKAGE}_rosservice_proxies ${catkin_LIBRARIES}
105101
if(DEFINED ${_package}_EXPORTED_TARGETS)
106102
add_dependencies( rtt_${ROSPACKAGE}_rosservice_proxies ${${_package}_EXPORTED_TARGETS})
107103
endif()
108-
add_file_dependencies( ${CMAKE_CURRENT_BINARY_DIR}/rtt_rosservice_proxies.cpp "${CMAKE_CURRENT_LIST_FILE}")
109104

110105
get_directory_property(_additional_make_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
111106
list(APPEND _additional_make_clean_files "${CMAKE_CURRENT_BINARY_DIR}/rtt_rosservice_proxies.cpp")

rtt_roscomm/src/templates/typekit/CMakeLists.txt

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ else()
66
#add_definitions( -DRTT_COMPONENT )
77
endif()
88

9-
include(AddFileDependencies)
10-
119
# mqueue transport
1210
OPTION(ENABLE_MQ "Build posix message queue transport plugin for ${_package}" OFF)
1311
if(ENABLE_MQ)
@@ -131,7 +129,7 @@ foreach( FILE ${MSG_FILES} )
131129

132130
# Necessary for create_boost_header.py command below
133131
set(_ROSMSG_GENERATED_BOOST_HEADER "${rtt_roscomm_GENERATED_HEADERS_OUTPUT_DIRECTORY}/orocos/${ROSMSGBOOSTHEADER}")
134-
list(APPEND ROSMSGS_GENERATED_BOOST_HEADERS ${_ROSMSG_GENERATED_BOOST_HEADER})
132+
list(APPEND ${_package}_GENERATED_BOOST_HEADERS ${_ROSMSG_GENERATED_BOOST_HEADER})
135133

136134
add_custom_command(
137135
OUTPUT ${_ROSMSG_GENERATED_BOOST_HEADER}
@@ -140,22 +138,18 @@ foreach( FILE ${MSG_FILES} )
140138
DEPENDS ${FILE} ${${_package}_EXPORTED_TARGETS} ${CREATE_BOOST_HEADER_EXE_PATH}
141139
VERBATIM)
142140

143-
#set_source_files_properties(${ROSMSGS_GENERATED_BOOST_HEADERS} PROPERTIES GENERATED TRUE)
144-
145141
# Message-specific typekit module
146142
configure_file(
147143
ros_msg_typekit_plugin.cpp.in
148144
${CMAKE_CURRENT_BINARY_DIR}/ros_${ROSMSGNAME}_typekit_plugin.cpp @ONLY )
149145
list(APPEND rtt-${_package}-typekit_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/ros_${ROSMSGNAME}_typekit_plugin.cpp )
150-
add_file_dependencies( ${CMAKE_CURRENT_BINARY_DIR}/ros_${ROSMSGNAME}_typekit.cpp ${FILE})
151146

152147
# Conversion header for CORBA
153148
if(ENABLE_CORBA)
154149
configure_file(
155150
ros_msg_corba_conversion.hpp.in
156151
${CMAKE_CURRENT_BINARY_DIR}/ros_${ROSMSGNAME}_corba_conversion.hpp @ONLY )
157152
list(APPEND rtt-${_package}-ros-transport-corba_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/ros_${ROSMSGNAME}_corba_conversion.hpp )
158-
add_file_dependencies( ${CMAKE_CURRENT_BINARY_DIR}/ros_${ROSMSGNAME}_corba_conversion.hpp ${FILE})
159153
endif()
160154

161155
# Types.hpp helper for extern templates
@@ -208,21 +202,28 @@ include_directories(
208202
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "Release")
209203
set(CMAKE_BUILD_TYPE MinSizeRel)
210204
endif()
205+
add_custom_target(rtt-${_package}-generate_boost_headers
206+
DEPENDS ${${_package}_GENERATED_BOOST_HEADERS}
207+
)
211208
orocos_typekit(rtt-${_package}-typekit ${rtt-${_package}-typekit_SOURCES})
212209
target_link_libraries(rtt-${_package}-typekit ${catkin_LIBRARIES} ${${_package}_LIBRARIES} ${USE_OROCOS_LIBRARIES})
210+
add_dependencies(rtt-${_package}-typekit rtt-${_package}-generate_boost_headers)
213211
orocos_typekit(rtt-${_package}-ros-transport ${rtt-${_package}-ros-transport_SOURCES})
214212
target_link_libraries(rtt-${_package}-ros-transport ${catkin_LIBRARIES} ${${_package}_LIBRARIES} ${USE_OROCOS_LIBRARIES})
213+
add_dependencies(rtt-${_package}-ros-transport rtt-${_package}-generate_boost_headers)
215214

216215
# Build mqueue transport plugin
217216
if(ENABLE_MQ)
218217
orocos_typekit(rtt-${_package}-ros-transport-mqueue ${rtt-${_package}-ros-transport-mqueue_SOURCES})
219218
target_link_libraries(rtt-${_package}-ros-transport-mqueue ${catkin_LIBRARIES} ${${_package}_LIBRARIES} ${USE_OROCOS_LIBRARIES} ${OROCOS-RTT_MQUEUE_LIBRARIES})
219+
add_dependencies(rtt-${_package}-ros-transport-mqueue rtt-${_package}-generate_boost_headers)
220220
endif()
221221

222222
# Build corba transport plugin
223223
if(ENABLE_CORBA)
224224
orocos_typekit(rtt-${_package}-ros-transport-corba ${rtt-${_package}-ros-transport-corba_SOURCES})
225225
target_link_libraries(rtt-${_package}-ros-transport-corba ${catkin_LIBRARIES} ${${_package}_LIBRARIES} ${USE_OROCOS_LIBRARIES} ${OROCOS-RTT_CORBA_LIBRARIES})
226+
add_dependencies(rtt-${_package}-ros-transport-corba rtt-${_package}-generate_boost_headers)
226227
endif()
227228

228229
# Add an explicit dependency between the typekits and message files
@@ -245,26 +246,13 @@ endif()
245246
# LIST(APPEND ${PROJECT_NAME}_EXPORTED_TARGETS "rtt-${_package}-ros-transport") # <-- This is already done in orocos_typekit().
246247
LIST(APPEND ${PROJECT_NAME}_EXPORTED_INCLUDE_DIRS "${rtt_roscomm_GENERATED_HEADERS_OUTPUT_DIRECTORY}/orocos" ${${_package}_INCLUDE_DIRS})
247248

248-
add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/ros_${_package}_typekit.cpp ${CMAKE_CURRENT_LIST_FILE} ${ROSMSGS_GENERATED_BOOST_HEADERS})
249-
add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/ros_${_package}_transport.cpp ${CMAKE_CURRENT_LIST_FILE} ${ROSMSGS_GENERATED_BOOST_HEADERS})
250-
251-
if(ENABLE_MQ)
252-
add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/ros_${_package}_transport_mqueue.cpp ${CMAKE_CURRENT_LIST_FILE} ${ROSMSGS_GENERATED_BOOST_HEADERS})
253-
endif()
254-
255-
if(ENABLE_CORBA)
256-
add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/ros_${_package}_transport_corba.cpp ${CMAKE_CURRENT_LIST_FILE} ${ROSMSGS_GENERATED_BOOST_HEADERS})
257-
endif()
258-
259249
get_directory_property(_additional_make_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
260250
list(APPEND _additional_make_clean_files "${rtt-${_package}-typekit_SOURCES};${rtt-${_package}-ros-transport_SOURCES};${rtt-${_package}-ros-transport-corba_SOURCES};${rtt-${_package}-ros-transport-mqueue_SOURCES};${rtt_roscomm_GENERATED_HEADERS_OUTPUT_DIRECTORY}/orocos/${_package}")
261251
set_directory_properties(PROPERTIES
262252
ADDITIONAL_MAKE_CLEAN_FILES "${_additional_make_clean_files}")
263253

264254
# Install generated header files (dependent packages might need them)
265255
if(DEFINED rtt_roscomm_GENERATED_HEADERS_INSTALL_DESTINATION)
266-
# install(FILES ${ROSMSGS_GENERATED_BOOST_HEADERS} DESTINATION ${rtt_roscomm_GENERATED_HEADERS_INSTALL_DESTINATION}/${_package}/boost/)
267-
# install(DIRECTORY "${rtt_roscomm_GENERATED_HEADERS_OUTPUT_DIRECTORY}/orocos/${_package}/typekit" DESTINATION ${rtt_roscomm_GENERATED_HEADERS_INSTALL_DESTINATION}/orocos/${_package})
268256
install(
269257
DIRECTORY "${rtt_roscomm_GENERATED_HEADERS_OUTPUT_DIRECTORY}/orocos/${_package}"
270258
DESTINATION "${rtt_roscomm_GENERATED_HEADERS_INSTALL_DESTINATION}/orocos")

rtt_tf/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ orocos_install_headers(include/rtt_tf/tf_interface.h)
1414

1515
orocos_generate_package(
1616
INCLUDE_DIRS include
17-
DEPENDS tf
18-
DEPENDS_TARGETS rtt_roscomm rtt_geometry_msgs
17+
DEPENDS tf tf2
18+
DEPENDS_TARGETS rtt_roscomm rtt_geometry_msgs rtt_tf2_msgs
1919
)
2020

2121
# Tests

rtt_tf/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
RTT TF
22
======
33

4-
This package provides an Orocos RTT component for utilizing the TF rigid body
5-
transform library from within Orocos. This component provides a "tf" service
4+
This package provides an Orocos RTT component for utilizing the [TF2 rigid body
5+
transform library](http://wiki.ros.org/tf2) from within Orocos. This component provides a "tf" service
66
with operations for requesting and broadcasting sing and batch transforms.
77

88
### Usage
99

10-
In general, a given process only needs a single TF component. This component
10+
In general, a given process only needs a single TF2 component. This component
1111
provides the following operations both on its bare interface and also on the
1212
provided "tf" RTT service.
1313

@@ -47,7 +47,7 @@ connectServices("my_component","tf");
4747
4848
The [rtt\_tf/tf\_interface.h](include/rtt_tf/tf_interface.h) header includes the
4949
`rtt_tf::TFInterface` class which adds a required service to a given RTT
50-
component. This can be used for more easily connecting with the TF component.
50+
component. This can be used for more easily connecting with the TF2 component.
5151
5252
It can be used to create the RTT service requester "tf" like so:
5353

rtt_tf/include/rtt_tf/tf_interface.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ namespace rtt_tf {
1818
lookupTransformAtTime("lookupTransformAtTime"),
1919
broadcastTransform("broadcastTransform"),
2020
broadcastTransforms("broadcastTransforms"),
21-
canTransform("canTransform")
21+
broadcastStaticTransform("broadcastStaticTransform"),
22+
broadcastStaticTransforms("broadcastStaticTransforms"),
23+
canTransform("canTransform"),
24+
canTransformAtTime("canTransformAtTime")
2225
{
2326
owner->requires("tf")->addOperationCaller(lookupTransform);
2427
owner->requires("tf")->addOperationCaller(lookupTransformAtTime);
2528
owner->requires("tf")->addOperationCaller(broadcastTransform);
2629
owner->requires("tf")->addOperationCaller(broadcastTransforms);
30+
owner->requires("tf")->addOperationCaller(broadcastStaticTransform);
31+
owner->requires("tf")->addOperationCaller(broadcastStaticTransforms);
2732
owner->requires("tf")->addOperationCaller(canTransform);
33+
owner->requires("tf")->addOperationCaller(canTransformAtTime);
2834
}
2935

3036
//! Check if the operations are ready
@@ -34,14 +40,20 @@ namespace rtt_tf {
3440
lookupTransformAtTime.ready() &&
3541
broadcastTransform.ready() &&
3642
broadcastTransforms.ready() &&
37-
canTransform.ready();
43+
broadcastStaticTransform.ready() &&
44+
broadcastStaticTransforms.ready() &&
45+
canTransform.ready() &&
46+
canTransformAtTime.ready();
3847
}
3948

4049
RTT::OperationCaller<geometry_msgs::TransformStamped(const std::string&, const std::string&)> lookupTransform;
4150
RTT::OperationCaller<geometry_msgs::TransformStamped(const std::string&, const std::string&, const ros::Time&)> lookupTransformAtTime;
4251
RTT::OperationCaller<void(const geometry_msgs::TransformStamped&)> broadcastTransform;
4352
RTT::OperationCaller<void(const std::vector<geometry_msgs::TransformStamped>&)> broadcastTransforms;
53+
RTT::OperationCaller<void(const geometry_msgs::TransformStamped&)> broadcastStaticTransform;
54+
RTT::OperationCaller<void(const std::vector<geometry_msgs::TransformStamped>&)> broadcastStaticTransforms;
4455
RTT::OperationCaller<bool(const std::string&, const std::string&)> canTransform;
56+
RTT::OperationCaller<bool(const std::string&, const std::string&, const ros::Time&)> canTransformAtTime;
4557
};
4658
}
4759

rtt_tf/package.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@
1616

1717
<build_depend>rtt</build_depend>
1818
<build_depend>tf</build_depend>
19+
<build_depend>tf2</build_depend>
1920
<build_depend>rtt_roscomm</build_depend>
2021
<build_depend>rtt_geometry_msgs</build_depend>
22+
<build_depend>rtt_tf2_msgs</build_depend>
2123

2224
<run_depend>rtt</run_depend>
2325
<run_depend>tf</run_depend>
26+
<run_depend>tf2</run_depend>
2427
<run_depend>rtt_roscomm</run_depend>
2528
<run_depend>rtt_geometry_msgs</run_depend>
29+
<run_depend>rtt_tf2_msgs</run_depend>
2630

2731
<export>
2832
<rtt_ros>
33+
<plugin_depend>rtt_tf2_msgs</plugin_depend>
2934
<plugin_depend>rtt_roscomm</plugin_depend>
3035
<plugin_depend>rtt_geometry_msgs</plugin_depend>
3136
</rtt_ros>

0 commit comments

Comments
 (0)