Skip to content

Commit

Permalink
Merge pull request #14 from jhu-lcsr-forks/kdl-conversions-typekits
Browse files Browse the repository at this point in the history
Improving error reporting in ros.import service and moving rtt_kdl_conversions to the typekits directory
  • Loading branch information
Ruben Smits committed Jan 8, 2014
2 parents 1dce854 + d828b7e commit ded5a9c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 14 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ script:
- source devel/setup.bash
- rosrun rtt_roscomm_tests test_message_package.bash
- catkin_make run_tests
- catkin_test_results
#- catkin_make install
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ The packages in this repository provide:
plugin for publishing and subscribing to ROS topics as well as calling and
responding to ROS services.
* [**rtt\_rospack**](rtt_rospack) Plugin for locating ROS resources.
* [**rtt\_tf**](rtt_tf) RTT-Plugin which uses [tf](http://ros.org/wiki/tf) to
allow RTT components to lookup and publish transforms.
* [**rtt\_actionlib**](rtt_actionlib) RTT-Enabled
[actionlib](http://ros.org/wiki/actionlib) action server for providing
actions from ROS-integrated RTT components.
Expand Down
34 changes: 20 additions & 14 deletions rtt_ros/src/rtt_ros_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class ROSService : public RTT::Service {

boost::shared_ptr<RTT::ComponentLoader> loader = RTT::ComponentLoader::Instance();

bool found_packages = false;
// List of packages which could not be loaded
std::vector<std::string> missing_packages;

// Get the dependencies for a given ROS package --> deps
try {
Expand Down Expand Up @@ -196,34 +197,39 @@ class ROSService : public RTT::Service {
// Check if it's already been imported
if(*it == "rtt_ros" || loader->isImported(*it)) {
RTT::log(RTT::Debug) << "Package dependency '"<< *it <<"' already imported." << RTT::endlog();
found_packages = true;
continue;
}

// Import the dependency
RTT::log(RTT::Debug) << "Importing Orocos components from ROS package '"<<*it<<"'" << RTT::endlog();
if(loader->import(*it, path_list)) {
found_packages = true;
RTT::log(RTT::Debug) << "Importing Orocos components from ROS package \""<<*it<<"\" SUCCEEDED.";
} else {
if (*it != package) {
RTT::log(RTT::Debug) << "Could not load ROS package dependency \"" << *it << "\" of ROS package \"" << package << "\"" << RTT::endlog();
} else {
RTT::log(RTT::Warning) << "Could not import any plugins from ROS package \"" << package << "\"" << RTT::endlog();
}
// Temporarily store the name of the missing package
missing_packages.push_back(*it);
RTT::log(RTT::Debug) << "Importing Orocos components from ROS package \""<<*it<<"\" FAILED.";
}
RTT::log(RTT::Debug) << RTT::endlog();
}

} catch(std::string arg) {
RTT::log(RTT::Debug) << "While processing the dependencies of " << package << ": not a ros package: " << arg << RTT::endlog();
RTT::log(RTT::Debug) << "While processing the dependencies of " << package << ": Dependency is not a ros package: " << arg << RTT::endlog();
missing_packages.push_back(arg);
}

if(!found_packages) {
RTT::log(RTT::Warning) << "Could not load any plugins from ROS package \"" << package << "\" or it's dependencies." << RTT::endlog();
// Report success or failure
if(missing_packages.size() == 0) {
RTT::log(RTT::Info) << "Loaded plugins from ROS package \"" << package << "\" and its dependencies." << RTT::endlog();
} else {
RTT::log(RTT::Info) << "Loaded plugins from ROS package \"" << package << "\" or it's dependencies." << RTT::endlog();
RTT::log(RTT::Warning) << "Could not load RTT plugins from the following ROS packages (they might be empty, in which case this message can be ignored): "<< RTT::endlog();
for(std::vector<std::string>::iterator it = missing_packages.begin();
it != missing_packages.end();
++it)
{
RTT::log(RTT::Warning) << " - " << *it<< RTT::endlog();
}
}

return found_packages;
return missing_packages.size() > 0;
}

};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ded5a9c

Please sign in to comment.