Skip to content

Commit

Permalink
Merge branch 'catkin' into prepare-catkin-merge
Browse files Browse the repository at this point in the history
Conflicts:
	UseOROCOS-RTT.cmake
  • Loading branch information
Ruben Smits committed Oct 9, 2013
2 parents 73cb586 + 7e6c152 commit 7b4bfec
Show file tree
Hide file tree
Showing 21 changed files with 952 additions and 812 deletions.
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language:
- cpp
- python
python:
- "2.7"
compiler:
- gcc
before_install:
# Define some config vars
- export ROS_DISTRO=hydro
- export CI_SOURCE_PATH=$(pwd)
# Bootstrap a minimal ROS installation
- git clone https://raw.github.com/jhu-lcsr/ros_ci_tools /tmp/ros_ci_tools && export PATH=/tmp/ros_ci_tools:$PATH
- ros_ci_bootstrap
# Create isolated workspace based on the ros distro
- source /opt/ros/$ROS_DISTRO/setup.bash
- mkdir -p ~/ws_isolated/src
- cd ~/ws_isolated
- ln -s $CI_SOURCE_PATH src/
# Install dependencies for source repos
- rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y > /dev/null

install:
# Build in an isolated catkin workspace
- export EXTRA_CMAKE_ARGS="-DENABLE_TESTS=ON -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB"
- catkin_make_isolated --install -j2 --cmake-args $EXTRA_CMAKE_ARGS

script:
# Run tests
- pushd build_isolated/rtt && make check && popd
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,6 @@ INSTALL(EXPORT ${LIBRARY_EXPORT_FILE} DESTINATION "${CONFIG_FILE_PATH}"

# Package use file + helper files
INSTALL(FILES UseOROCOS-RTT.cmake UseOROCOS-RTT-helpers.cmake config/cmake_uninstall.cmake.in DESTINATION "${CONFIG_FILE_PATH}")

# Install package.xml
INSTALL(FILES package.xml DESTINATION share/rtt)
9 changes: 0 additions & 9 deletions Makefile

This file was deleted.

312 changes: 220 additions & 92 deletions UseOROCOS-RTT-helpers.cmake

Large diffs are not rendered by default.

1,181 changes: 604 additions & 577 deletions UseOROCOS-RTT.cmake

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<rosdep name="boost" />
<rosdep name="omniorb" />
<rosdep name="xpath-perl" />

<export>
<!-- The default target is gnulinux when using rospack. This is definately a crippled solution -->
Expand Down
4 changes: 2 additions & 2 deletions orocos-rtt-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ set(DOC_STRING "The Operating System target. One of [gnulinux lxrt macosx win32
set(OROCOS_TARGET_ENV $ENV{OROCOS_TARGET}) # MUST use helper variable, otherwise not picked up !!!
if(OROCOS_TARGET_ENV)
set(OROCOS_TARGET ${OROCOS_TARGET_ENV} CACHE STRING "${DOC_STRING}" FORCE)
message( "Detected OROCOS_TARGET environment variable. Using: ${OROCOS_TARGET}")
message(STATUS "- Detected OROCOS_TARGET environment variable. Using: ${OROCOS_TARGET}")
else()
if(NOT DEFINED OROCOS_TARGET)
if(MSVC)
Expand Down Expand Up @@ -151,7 +151,7 @@ set(OROCOS-RTT_USE_FILE_PATH ${SELF_DIR})
set(OROCOS-RTT_USE_FILE ${SELF_DIR}/UseOROCOS-RTT.cmake)

# Confirm found, not cached !
message("Orocos-RTT found in ${OROCOS-RTT_IMPORT_FILE}")
message(STATUS "Orocos-RTT found in ${OROCOS-RTT_IMPORT_FILE}")
set(OROCOS-RTT_FOUND TRUE)

endif()
Expand Down
6 changes: 3 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@

<buildtool_depend>cmake</buildtool_depend>

<build_depend>xpath-perl</build_depend>
<build_depend>boost</build_depend>
<build_depend>omniorb</build_depend>
<build_depend>rospack</build_depend>

<run_depend>boost</run_depend>
<run_depend>omniorb</run_depend>
<run_depend>rospack</run_depend>
<run_depend>xpath-perl</run_depend>

<export>
<build_type>
cmake
</build_type>
<build_type>cmake</build_type>
</export>

</package>
Expand Down
85 changes: 0 additions & 85 deletions rtt/deployment/ComponentLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,95 +381,10 @@ bool ComponentLoader::import( std::string const& package, std::string const& pat
return true;
}

// from here on: it's a package name or a path.
// package names must be found to return true.
// path will be scanned and will always return true, but will warn when invalid.
if ( importRosPackage(package) )
return true;

// Try the RTT_COMPONENT_PATH:
return importInstalledPackage(package, path_list);
}

bool ComponentLoader::importRosPackage(std::string const& package)
{
// check for rospack
#ifdef HAS_ROSLIB
using namespace rospack;
try {
bool found = false;
Rospack rpack;
rpack.setQuiet(true);
char* rpp = getenv("ROS_PACKAGE_PATH");
vector<string> paths;
if (rpp)
paths = splitPaths(rpp);
string ppath;
rpack.crawl(paths,false);
rpack.find(package, ppath);
if ( !ppath.empty() ) {
path rospath = path(ppath) / "lib" / "orocos";
path rospath_target = rospath / OROCOS_TARGET_NAME;
// + add all dependencies to paths:
vector<string> rospackresult;
rpack.setQuiet(false);
bool valid = rpack.deps(package, false, rospackresult); // false: also indirect deps.
if (!valid) {
log(Error) <<"The ROS package '"<< package <<"' in '"<< ppath << "' caused trouble. Bailing out."<<endlog();
return false;
}

for(vector<string>::iterator it = rospackresult.begin(); it != rospackresult.end(); ++it) {
if ( isImported(*it) ) {
log(Debug) <<"Package dependency '"<< *it <<"' already imported." <<endlog();
continue;
}
if ( rpack.find( *it, ppath ) == false )
throw *it;
path deppath = path(ppath) / "lib" / "orocos";
path deppath_target = path(deppath) / OROCOS_TARGET_NAME;
// if orocos directory exists and we could import it, mark it as loaded.
if ( is_directory( deppath_target ) ) {
log(Debug) << "Ignoring files under " << deppath.string() << " since " << deppath_target.string() << " was found."<<endlog();
found = true;
if ( import( deppath_target.string() ) ) {
loadedPackages.push_back( *it );
}
}
else if ( is_directory( deppath ) ) {
found = true;
if ( import( deppath.string() ) ) {
loadedPackages.push_back( *it );
}
}
}
// now that all deps are done, import the package itself:
if ( is_directory( rospath_target ) ) {
log(Debug) << "Ignoring files under " << rospath.string() << " since " << rospath_target.string() << " was found."<<endlog();
found = true;
if ( import( rospath_target.string() ) ) {
loadedPackages.push_back( package );
}
} else if ( is_directory( rospath ) ) {
found = true;
if ( import( rospath.string() ) ) {
loadedPackages.push_back( package );
}
}
// since it was a ROS package, we exit here.
if (!found) {
log(Debug) <<"The ROS package '"<< package <<"' in '"<< ppath << "' nor its dependencies contained a lib/orocos directory. I'll look in the RTT_COMPONENT_PATH next."<<endlog();
}
return found;
} else
log(Info) << "Not a ros package: " << package << endlog();
} catch(std::string arg) {
log(Info) << "While processing the dependencies of " << package << ": not a ros package: " << arg << endlog();
}
#endif
return false;
}

bool ComponentLoader::importInstalledPackage(std::string const& package, std::string const& path_list)
{
string paths;
Expand Down
5 changes: 0 additions & 5 deletions rtt/deployment/ComponentLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ namespace RTT {
*/
bool isCompatibleComponent(std::string const& filepath);

/**
* Returns true only if \a package is a ROS package and contained a lib/orocos directory.
*/
bool importRosPackage(std::string const& package);

/**
* Returns true if \a package is a subdir of the RTT_COMPONENT_PATH
*/
Expand Down
24 changes: 24 additions & 0 deletions rtt/internal/LocalOperationCaller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,30 @@ namespace RTT
return this->collectIfDone_impl(a1,a2,a3);
}

template<class T1, class T2, class T3, class T4>
SendStatus collect_impl( T1& a1, T2& a2, T3& a3, T4& a4) {
this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) );
return this->collectIfDone_impl(a1,a2,a3,a4);
}

template<class T1, class T2, class T3, class T4, class T5>
SendStatus collect_impl( T1& a1, T2& a2, T3& a3, T4& a4, T5& a5) {
this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) );
return this->collectIfDone_impl(a1,a2,a3,a4, a5);
}

template<class T1, class T2, class T3, class T4, class T5, class T6>
SendStatus collect_impl( T1& a1, T2& a2, T3& a3, T4& a4, T5& a5, T6& a6) {
this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) );
return this->collectIfDone_impl(a1,a2,a3,a4,a5,a6);
}

template<class T1, class T2, class T3, class T4, class T5, class T6, class T7>
SendStatus collect_impl( T1& a1, T2& a2, T3& a3, T4& a4, T5& a5, T6& a6, T7& a7) {
this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) );
return this->collectIfDone_impl(a1,a2,a3,a4,a5,a6,a7);
}

/**
* Invoke this operator if the method has no arguments.
*/
Expand Down
2 changes: 1 addition & 1 deletion rtt/os/TimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace RTT {
TimeService::nsecs
TimeService::getNSecs() const
{
return rtos_get_time_ns();
return ticks2nsecs(offset) + (use_clock) ? (rtos_get_time_ns()) : (0);
}

TimeService::nsecs
Expand Down
75 changes: 41 additions & 34 deletions rtt/transports/corba/TaskContextProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,38 +188,7 @@ namespace RTT
// Detect already added parts of an interface, does not yet detect removed parts...
if (CORBA::is_nil(mtask))
return;

log(Debug) << "Fetching Ports."<<endlog();
CDataFlowInterface_var dfact = mtask->ports();
TypeInfoRepository::shared_ptr type_repo = TypeInfoRepository::Instance();
if (dfact) {
CDataFlowInterface::CPortDescriptions_var objs = dfact->getPortDescriptions();
for ( size_t i=0; i < objs->length(); ++i) {
CPortDescription port = objs[i];
if (this->ports()->getPort( port.name.in() ))
continue; // already added.

TypeInfo const* type_info = type_repo->type(port.type_name.in());
if (!type_info)
{
log(Warning) << "remote port " << port.name
<< " has a type that cannot be marshalled over CORBA: " << port.type_name << ". "
<< "It is ignored by TaskContextProxy" << endlog();
}
else
{
PortInterface* new_port;
if (port.type == RTT::corba::CInput)
new_port = new RemoteInputPort( type_info, dfact.in(), port.name.in(), ProxyPOA() );
else
new_port = new RemoteOutputPort( type_info, dfact.in(), port.name.in(), ProxyPOA() );

this->ports()->addPort(*new_port);
port_proxies.push_back(new_port); // see comment in definition of port_proxies
}
}
}


CService_var serv = mtask->getProvider("this");
this->fetchServices(this->provides(), serv.in() );

Expand Down Expand Up @@ -258,6 +227,10 @@ namespace RTT
void TaskContextProxy::fetchServices(Service::shared_ptr parent, CService_ptr serv)
{
log(Debug) << "Fetching "<<parent->getName()<<" Service:"<<endlog();

// Fetch ports
this->fetchPorts(parent, serv);

// load command and method factories.
// methods:
log(Debug) << "Fetching Operations."<<endlog();
Expand Down Expand Up @@ -310,7 +283,7 @@ namespace RTT
storeProperty(*parent->properties(), prefix, new Property<PropertyBag>( pname, props[i].description.in()) );
log(Debug) << "Looked up PropertyBag " << tn.in() << " "<< pname <<": created."<<endlog();
} else
log(Error) << "Looked up Property " << tn.in() << " "<< pname <<": type not known. Check your RTT_COMPONENT_PATH."<<endlog();
log(Error) << "Looked up Property " << tn.in() << " "<< pname <<": type not known. Check your RTT_COMPONENT_PATH ( \""<<getenv("RTT_COMPONENT_PATH")<<" \")."<<endlog();
}
}

Expand Down Expand Up @@ -338,7 +311,7 @@ namespace RTT
parent->setValue( ti->buildConstant( attrs[i].in(), ds));
} else {
log(Error) << "Looking up Attribute " << tn.in();
Logger::log() <<": type not known. Check your RTT_COMPONENT_PATH."<<endlog();
Logger::log() <<": type not known. Check your RTT_COMPONENT_PATH ( \""<<getenv("RTT_COMPONENT_PATH")<<" \")."<<endlog();
}
}

Expand All @@ -358,6 +331,40 @@ namespace RTT
}
}

// Fetch remote ports and create local proxies
void TaskContextProxy::fetchPorts(RTT::Service::shared_ptr parent, CDataFlowInterface_ptr dfact)
{
log(Debug) << "Fetching Ports for service "<<parent->getName()<<"."<<endlog();
TypeInfoRepository::shared_ptr type_repo = TypeInfoRepository::Instance();
if (dfact) {
CDataFlowInterface::CPortDescriptions_var objs = dfact->getPortDescriptions();
for ( size_t i=0; i < objs->length(); ++i) {
CPortDescription port = objs[i];
if (parent->getPort( port.name.in() ))
continue; // already added.

TypeInfo const* type_info = type_repo->type(port.type_name.in());
if (!type_info)
{
log(Warning) << "remote port " << port.name
<< " has a type that cannot be marshalled over CORBA: " << port.type_name << ". "
<< "It is ignored by TaskContextProxy" << endlog();
}
else
{
PortInterface* new_port;
if (port.type == RTT::corba::CInput)
new_port = new RemoteInputPort( type_info, dfact, port.name.in(), ProxyPOA() );
else
new_port = new RemoteOutputPort( type_info, dfact, port.name.in(), ProxyPOA() );

parent->addPort(*new_port);
port_proxies.push_back(new_port); // see comment in definition of port_proxies
}
}
}
}

void TaskContextProxy::DestroyOrb()
{
try {
Expand Down
1 change: 1 addition & 0 deletions rtt/transports/corba/TaskContextProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ namespace RTT

void fetchRequesters(ServiceRequester* parent, CServiceRequester_ptr csrq);
void fetchServices(Service::shared_ptr parent, CService_ptr mtask);
void fetchPorts(Service::shared_ptr parent, CDataFlowInterface_ptr serv);
public:
~TaskContextProxy();

Expand Down
2 changes: 1 addition & 1 deletion rtt/typekit/Types.inc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ RTT_EXPORT_TEMPLATE_TYPE(int)
RTT_EXPORT_TEMPLATE_TYPE(unsigned int)
RTT_EXPORT_TEMPLATE_TYPE(float)
RTT_EXPORT_TEMPLATE_TYPE(char)
//RTT_EXPORT_TEMPLATE_TYPE(std::string)
RTT_EXPORT_TEMPLATE_TYPE(std::string)


1 change: 1 addition & 0 deletions rtt/types/CArrayTypeInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ namespace RTT
return false;
}

using TemplateValueFactory<T>::buildVariable;
virtual base::AttributeBase* buildVariable(std::string name,int sizehint) const
{
// There were two choices: create an empty carray, ie pointer-like behavior; OR create one with storage in the DS.
Expand Down
1 change: 1 addition & 0 deletions rtt/types/SequenceTypeInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace RTT
return false;
}

using TemplateValueFactory<T>::buildVariable;
base::AttributeBase* buildVariable(std::string name,int size) const
{
return SequenceTypeInfoBase<T>::buildVariable(name,size);
Expand Down
Loading

0 comments on commit 7b4bfec

Please sign in to comment.