Skip to content

Commit 1f54dca

Browse files
committed
Merge pull request #60 from jhu-lcsr-forks/hydro-devel-merged
Fixes minus ldeployer
2 parents 8a53d09 + 7ad3b66 commit 1f54dca

File tree

25 files changed

+151
-100
lines changed

25 files changed

+151
-100
lines changed

rtt_dynamic_reconfigure/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ catkin_package(
99
)
1010

1111
include_directories(
12-
include/orocos
12+
BEFORE
1313
${catkin_INCLUDE_DIRS}
14+
include/orocos
1415
)
1516

1617
orocos_library(rtt_dynamic_reconfigure src/auto_config.cpp)

rtt_dynamic_reconfigure/include/orocos/rtt_dynamic_reconfigure/auto_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ namespace rtt_dynamic_reconfigure {
100100

101101
template <>
102102
struct Updater<AutoConfig> {
103-
static bool propertiesFromConfig(AutoConfig &config, uint32_t, RTT::PropertyBag &bag) { RTT::refreshProperties(bag, config); }
104-
static bool configFromProperties(AutoConfig &config, const RTT::PropertyBag &bag) { RTT::updateProperties(config, bag); }
103+
static bool propertiesFromConfig(AutoConfig &config, uint32_t, RTT::PropertyBag &bag) { return RTT::refreshProperties(bag, config); }
104+
static bool configFromProperties(AutoConfig &config, const RTT::PropertyBag &bag) { return RTT::updateProperties(config, bag); }
105105
};
106106

107107
template <>

rtt_dynamic_reconfigure/include/orocos/rtt_dynamic_reconfigure/server.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <rtt/OperationCaller.hpp>
4545

4646
#include <rtt/internal/DataSources.hpp>
47+
#include <rtt/internal/GlobalEngine.hpp>
4748

4849
#include <ros/ros.h>
4950

@@ -530,6 +531,10 @@ class Server : public RTT::Service
530531
notify_callback_ = getOwner()->provides()->getLocalOperation("notifyPropertiesUpdate");
531532
}
532533

534+
// update_callback_ and notify_callback_ are called from the ROS spinner thread -> set GlobalEngine as caller engine
535+
update_callback_.setCaller(RTT::internal::GlobalEngine::Instance());
536+
notify_callback_.setCaller(RTT::internal::GlobalEngine::Instance());
537+
533538
// refresh once
534539
refresh();
535540
}
@@ -636,10 +641,6 @@ bool getProperty(const std::string &name, const RTT::PropertyBag &bag, ValueType
636641

637642
} // namespace rtt_dynamic_reconfigure
638643

639-
#include <rtt/plugin/ServicePlugin.hpp>
640-
//#define RTT_DYNAMIC_RECONFIGURE_SERVICE_PLUGIN(CONFIG, NAME) \
641-
// ORO_SERVICE_NAMED_PLUGIN(rtt_dynamic_reconfigure::Server<CONFIG>, NAME)
642-
643644
#define RTT_DYNAMIC_RECONFIGURE_SERVICE_PLUGIN(CONFIG, NAME) \
644645
extern "C" {\
645646
RTT_EXPORT bool loadRTTPlugin(RTT::TaskContext* tc); \

rtt_ros/CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,8 @@ orocos_generate_package(
6060
DEPENDS rostime
6161
)
6262

63-
install(PROGRAMS
64-
scripts/rtt-upgrade-2.5
65-
# Wrapper scripts
66-
scripts/deployer
67-
scripts/orocreate-pkg
68-
scripts/orogen
69-
scripts/orogen-unregister
70-
scripts/rttlua
71-
scripts/rttlua-tlsf
72-
scripts/rttscript
73-
scripts/typegen
63+
install(DIRECTORY scripts/
64+
USE_SOURCE_PERMISSIONS
7465
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
7566

7667
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} )

rtt_ros_msgs/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ find_package(catkin REQUIRED COMPONENTS message_generation std_msgs)
3737
## Generate services in the 'srv' folder
3838
add_service_files(
3939
FILES
40+
Eval.srv
4041
RunScript.srv
4142
GetPeerList.srv
4243
)

rtt_ros_msgs/srv/Eval.srv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
string code
2+
---
3+
bool success

rtt_roscomm/rtt_roscomm_pkg_template/package.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
</description>
2020
<maintainer email="orocos-dev@lists.mech.kuleuven.be">Orocos Developers</maintainer>
21-
<author>create_rtt_msgs</author>
2221
<license>BSD</license>
2322

2423
<buildtool_depend>catkin</buildtool_depend>

rtt_rosdeployment/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include_directories(${catkin_INCLUDE_DIRS})
88
orocos_use_package(ocl-deployment)
99

1010
orocos_plugin(rtt_rosdeployment src/rtt_rosdeployment_service.cpp)
11-
target_link_libraries(rtt_rosdeployment ${catkin_LIBRARIES})
11+
target_link_libraries(rtt_rosdeployment ${catkin_LIBRARIES} ${OROCOS-RTT_RTT-SCRIPTING_LIBRARY})
1212

1313
orocos_generate_package(
1414
DEPENDS rtt_ros_msgs

rtt_rosdeployment/package.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
<export>
2626
<rtt_ros>
2727
<plugin_depend>rtt_rosnode</plugin_depend>
28-
<plugin_depend>rtt_ros_msgs</plugin_depend>
28+
<!--
29+
rtt_ros_msgs is not an RTT plugin
30+
<plugin_depend>rtt_ros_msgs</plugin_depend>
31+
-->
2932
</rtt_ros>
3033
</export>
3134
</package>

rtt_rosdeployment/src/rtt_rosdeployment_service.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#include <rtt/plugin/Plugin.hpp>
44
#include <rtt/plugin/ServicePlugin.hpp>
55
#include <rtt/internal/GlobalService.hpp>
6+
#include <rtt/scripting/Scripting.hpp>
67

8+
#include <rtt_ros_msgs/Eval.h>
79
#include <rtt_ros_msgs/RunScript.h>
810
#include <rtt_ros_msgs/GetPeerList.h>
911

@@ -24,16 +26,23 @@ class ROSDeploymentService : public RTT::Service
2426

2527
ros::NodeHandle nh_;
2628

29+
ros::ServiceServer eval_service_;
2730
ros::ServiceServer run_script_service_;
2831
ros::ServiceServer get_peer_list_service_;
2932

33+
bool eval_cb(
34+
rtt_ros_msgs::Eval::Request& request,
35+
rtt_ros_msgs::Eval::Response& response);
36+
3037
bool run_script_cb(
3138
rtt_ros_msgs::RunScript::Request& request,
3239
rtt_ros_msgs::RunScript::Response& response);
3340

3441
bool get_peer_list_cb(
3542
rtt_ros_msgs::GetPeerList::Request& request,
3643
rtt_ros_msgs::GetPeerList::Response& response);
44+
45+
RTT::OperationCaller<bool(std::string const&)> eval_;
3746
};
3847

3948

@@ -44,13 +53,25 @@ ROSDeploymentService::ROSDeploymentService(OCL::DeploymentComponent* deployer) :
4453
{
4554
if(deployer_) {
4655
// Create services
56+
eval_service_ = nh_.advertiseService("eval",&ROSDeploymentService::eval_cb,this);
4757
run_script_service_ = nh_.advertiseService("run_script",&ROSDeploymentService::run_script_cb,this);
4858
get_peer_list_service_ = nh_.advertiseService("get_peer_list",&ROSDeploymentService::get_peer_list_cb,this);
59+
60+
eval_ = deployer_->getProvider<RTT::Scripting>("scripting")->eval;
4961
} else {
5062
RTT::log(RTT::Error) << "Attempted to load the rosdeployment service on a TaskContext which is not an OCL::DeploymentComponent. No ROS services will be advertised." << RTT::endlog();
5163
}
5264
}
5365

66+
bool ROSDeploymentService::eval_cb(
67+
rtt_ros_msgs::Eval::Request& request,
68+
rtt_ros_msgs::Eval::Response& response)
69+
{
70+
if (!eval_.ready()) return false;
71+
response.success = eval_(request.code);
72+
return true;
73+
}
74+
5475
bool ROSDeploymentService::run_script_cb(
5576
rtt_ros_msgs::RunScript::Request& request,
5677
rtt_ros_msgs::RunScript::Response& response)

0 commit comments

Comments
 (0)