This wiki has only information for the RTT 1.x releases. For RTT 2.x, look at the Toolchain wiki.
From recent discussion on ML, simply a place to put down ideas before we forget them ...
Orocos to run in real-time
<quote> Actually it's an option of the omniidl compiler... the command to use is
omniidl -bcxx -Wba myIdlFile.idl
This will become definately a FAQ item :-) <quote>
<quote> When your text is not appearing on your wiki page, it's because you ended your wiki page with an indented line. So if your last line is:
this is my last line
the wiki code clears the whole page. It's clearly a Drupal/wiki module thing/bug. <quote>
Check out OCL's HmiConsoleOutput component.
You can take a look at the CODING_STYLE.txt file. Also, we worked out the indentation rules for Eclipse and Emacs.
end
The tutorials and example code are split in two parts, one for new users and one for experienced users of the RTT.
There are several sources where you can find code and tutorials. Click below to read the rest of this post.The tutorials and example code are split in two parts, one for new users and one for experienced users of the RTT.
There are several sources where you can find code and tutorials. Some code is listed in wiki pages, other is downloadable in a separate package and finally you can find code snippets in the manuals too.
RTT Examples Get started with simple, ready-to-compile examples of how to create a component
Naming connections, not ports: Orocos' best kept secret
Using omniORBpy to interact with a component from Python
These advanced examples are mainly about extending and configuring the RTT for your specific needs.
Using plugins and toolkits to support custom data types
Using non-periodic components to implement a simple TCP client
Using XML substitution to manage complex deployments
This is a work in progress and only for RTT 1.x !
Problem: You want to pass custom types between distributed components, be able to see the value(s) of your custom type with in a deployer, and be able to read/write the custom type to/from XML files.
Solution: Develop two plugins that tell Orocos about your custom types.
<!-- break -->
An RTT transport plugin provides methods to transport your custom types across CORBA, and hence between distributed Orocos components.
This is a multi-part example demonstrating plugins for two boost::posix_time types: ptime and time_duration.
For additional information on plugins and their development, see [1].
Also, the KDL toolkit and transport plugins are good examples. See src/bindings/rtt in the KDL source.
. |-- BoostToolkit.cpp |-- BoostToolkit.hpp |-- CMakeLists.txt |-- config | |-- FindACE.cmake | |-- FindCorba.cmake | |-- FindOmniORB.cmake | |-- FindOrocos-OCL.cmake | |-- FindOrocos-RTT.cmake | |-- FindTAO.cmake | |-- UseCorba.cmake | `-- UseOrocos.cmake |-- corba | |-- BoostCorbaConversion.hpp | |-- BoostCorbaToolkit.cpp | |-- BoostCorbaToolkit.hpp | |-- BoostTypes.idl | |-- CMakeLists.txt | `-- tests | |-- CMakeLists.txt | |-- corba-combined.cpp | |-- corba-recv.cpp | `-- corba-send.cpp `-- tests |-- CMakeLists.txt |-- combined.cpp |-- no-toolkit.cpp |-- recv.cpp |-- recv.hpp |-- send.cpp `-- send.hpp
The toolkit plugin is in the root directory, with supporting test files in the tests directory.
CMake support files are in the config directory.
The transport plugin is in the corba directory, with supporting test files in the corba/tests directory.
Currently, this example does not yet
NB I could not find a method to get at the underlying raw 64-bit or 96-bit boost representation of ptime. Hence, the transport plugin inefficiently transports a ptime type using two separate data values. If you know of a method to get at the raw representation, I would love to know. Good luck in template land ...
Attachment | Size |
---|---|
BoostToolkit.hpp | 2.64 KB |
BoostToolkit.cpp | 3.58 KB |
CMakeLists.txt | 1.83 KB |
corba/BoostCorbaToolkit.hpp | 934 bytes |
corba/BoostCorbaToolkit.cpp | 1.34 KB |
corba/QBoostCorbaConversion.hpp | 5.18 KB |
corba/CMakeLists.txt | 738 bytes |
plugins.tar_.bz2 | 14.24 KB |
This is a work in progress
This part creates components that use your custom type, and demonstrates that Orocos does not know anything about these types.
cd /path/to/plugins mkdir build cd build cmake .. -DOROCOS_TARGET=macosx -DENABLE_CORBA=OFF make
For other operating systems substitute the appopriate value for "macosx" when setting OROCOS_TARGET (e.g. "gnulinux").
Tested in Mac OS X Leopard 10.5.7.
In a shell
cd /path/to/plugins/build ./no-toolkit
This starts a test case that uses an OCL taskbrowser to show two components: send and recv. If you issue a "ls" or "ls Send" command, you will get output similar to the following:
Data Flow Ports: RW(C) unknown_t ptime = (unknown_t) RW(C) unknown_t timeDuration = (unknown_t)
Each component has two ports, named ptime and time_duration. Notice that both ports are connected "(C)", but that Orocos considers each an unknown type with unknown value.
Part 2 Toolkit plugin will build a toolkit plugin that allows Orocos to understand these types.
This is a work in progress
This part creates a toolkit plugin making our types known to Orocos.
Everything needed for this part was built in Part 1.
In a shell
cd /path/to/plugins/build ./combined
The combined tests uses an OCL taskbrowser to show two components: send and recv. Typing an "ls" or "ls Send" command, as in Part 1, you will get something like the following:
RW(C) boost_ptime ptime = 2009-Aug-09 16:14:19.724622 RW(C) boost_timeduration timeDuration = 00:00:00.200005
Note that Orocos now knows the correct types (eg boost_ptime) and can display each ports value. Issue multiple ls commands and you will see the values change. The ptime is simply the date and time at which the send component set the port value, and the duration is the time between port values being set on each iteration (ie this should approximately be the period of the send component).
namespace Examples { /// \remark these do not need to be in the same namespace as the plugin /// put the time onto the stream std::ostream& operator<<(std::ostream& os, const boost::posix_time::ptime& t); /// put the time onto duration the stream std::ostream& operator<<(std::ostream& os, const boost::posix_time::time_duration& d); /// get a time from the stream std::istream& operator>>(std::istream& is, boost::posix_time::ptime& t); /// get a time duration from the stream std::istream& operator>>(std::istream& is, boost::posix_time::time_duration& d);
class BoostPlugin : public RTT::ToolkitPlugin { public: virtual std::string getName(); virtual bool loadTypes(); virtual bool loadConstructors(); virtual bool loadOperators(); }; /// The singleton for the Toolkit. extern BoostPlugin BoostToolkit;
/// provide ptime type to RTT type system /// \remark the 'true' argument indicates that we supply stream operators struct BoostPtimeTypeInfo : public RTT::TemplateTypeInfo<boost::posix_time::ptime,true> { BoostPtimeTypeInfo(std::string name) : RTT::TemplateTypeInfo<boost::posix_time::ptime,true>(name) {}; bool decomposeTypeImpl(const boost::posix_time::ptime& img, RTT::PropertyBag& targetbag); bool composeTypeImpl(const RTT::PropertyBag& bag, boost::posix_time::ptime& img); }; /// provide time duration type to RTT type system /// \remark the 'true' argument indicates that we supply stream operators struct BoostTimeDurationTypeInfo : public RTT::TemplateTypeInfo<boost::posix_time::time_duration,true> { BoostTimeDurationTypeInfo(std::string name) : RTT::TemplateTypeInfo<boost::posix_time::time_duration,true>(name) {}; bool decomposeTypeImpl(const boost::posix_time::time_duration& img, RTT::PropertyBag& targetbag); bool composeTypeImpl(const RTT::PropertyBag& bag, boost::posix_time::time_duration& img); }; } // namespace Exampels
The toolkit plugin implementation is in the BoostToolkit.cpp file.
namespace Examples { using namespace RTT; using namespace RTT::detail; using namespace std; std::ostream& operator<<(std::ostream& os, const boost::posix_time::ptime& t) { os << boost::posix_time::to_simple_string(t); return os; } std::ostream& operator<<(std::ostream& os, const boost::posix_time::time_duration& d) { os << boost::posix_time::to_simple_string(d); return os; } std::istream& operator>>(std::istream& is, boost::posix_time::ptime& t) { is >> t; return is; } std::istream& operator>>(std::istream& is, boost::posix_time::time_duration& d) { is >> d; return is; }
BoostPlugin BoostToolkit; std::string BoostPlugin::getName() { return "Boost"; }
bool BoostPlugin::loadTypes() { TypeInfoRepository::shared_ptr ti = TypeInfoRepository::Instance(); /* each quoted name here (eg "boost_ptime") must _EXACTLY_ match that in the associated TypeInfo::composeTypeImpl() and TypeInfo::decomposeTypeImpl() functions (in this file), as well as the name registered in the associated Corba plugin's registerTransport() function (see corba/BoostCorbaToolkit.cpp) */ ti->addType( new BoostPtimeTypeInfo("boost_ptime") ); ti->addType( new BoostTimeDurationTypeInfo("boost_timeduration") ); return true; }
bool BoostPlugin::loadConstructors() { // no constructors for these particular types return true; } bool BoostPlugin::loadOperators() { // no operators for these particular types return true; }
bool BoostPtimeTypeInfo::decomposeTypeImpl(const boost::posix_time::ptime& source, PropertyBag& targetbag) { targetbag.setType("boost_ptime"); assert(0); return true; } bool BoostPtimeTypeInfo::composeTypeImpl(const PropertyBag& bag, boost::posix_time::ptime& result) { if ( "boost_ptime" == bag.getType() ) // ensure is correct type { // \todo assert(0); } return false; }
ORO_TOOLKIT_PLUGIN(Examples::BoostToolkit)
cmake_minimum_required(VERSION 2.6) # pick up additional cmake package files (eg FindXXX.cmake) from this directory list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/config")
find_package(Orocos-RTT 1.6.0 REQUIRED corba) find_package(Orocos-OCL 1.6.0 REQUIRED taskbrowser)
include(${CMAKE_SOURCE_DIR}/config/UseOrocos.cmake)
create_component(BoostToolkit-${OROCOS_TARGET} VERSION 1.0.0 BoostToolkit.cpp) TARGET_LINK_LIBRARIES(BoostToolkit-${OROCOS_TARGET} boost_date_time)
SUBDIRS(tests)
The send component regularly updates the current time on its ptime port, and the duration between ptime port updates on its timeDuration port.
class Send : public RTT::TaskContext { public: RTT::DataPort<boost::posix_time::ptime> ptime_port; RTT::DataPort<boost::posix_time::time_duration> timeDuration_port; public: Send(std::string name); virtual ~Send(); virtual bool startHook(); virtual void updateHook(); protected: boost::posix_time::ptime lastNow; };
The implementation is very simple, and will not be discussed in detail here.
#include "send.hpp" Send::Send(std::string name) : RTT::TaskContext(name), ptime_port("ptime"), timeDuration_port("timeDuration") { ports()->addPort(&ptime_port); ports()->addPort(&timeDuration_port); } Send::~Send() { } bool Send::startHook() { // just set last to now lastNow = boost::posix_time::microsec_clock::local_time(); return true; } void Send::updateHook() { boost::posix_time::ptime now; boost::posix_time::time_duration delta; // send the current time, and the duration since the last updateHook() now = boost::posix_time::microsec_clock::local_time(); delta = now - lastNow; ptime_port.Set(now); timeDuration_port.Set(delta); lastNow = now; }
The recv component has the same ports but does nothing. It is simply an empty receiver component, that allows us to view its ports within the deployer.
class Recv : public RTT::TaskContext { public: RTT::DataPort<boost::posix_time::ptime> ptime_port; RTT::DataPort<boost::posix_time::time_duration> timeDuration_port; public: Recv(std::string name); virtual ~Recv(); };
And the recv implementation.
#include "recv.hpp" Recv::Recv(std::string name) : RTT::TaskContext(name), ptime_port("ptime"), timeDuration_port("timeDuration") { ports()->addPort(&ptime_port); ports()->addPort(&timeDuration_port); } Recv::~Recv() { }
Now the combined test program just combines one of each test component directly within the same executable.
#include <rtt/RTT.hpp> #include <rtt/PeriodicActivity.hpp> #include <rtt/TaskContext.hpp> #include <rtt/os/main.h> #include <rtt/Ports.hpp> #include <ocl/TaskBrowser.hpp> #include "send.hpp" #include "recv.hpp" #include "../BoostToolkit.hpp" using namespace std; using namespace Orocos; int ORO_main(int argc, char* argv[]) { RTT::Toolkit::Import(Examples::BoostToolkit);
Recv recv("Recv"); PeriodicActivity recv_activity(ORO_SCHED_OTHER, 0, 0.1, recv.engine()); Send send("Send"); PeriodicActivity send_activity(ORO_SCHED_OTHER, 0, 0.2, send.engine()); if ( connectPeers( &send, &recv ) == false ) { log(Error) << "Could not connect peers !"<<endlog(); return -1; } if ( connectPorts( &send, &recv) == false ) { log(Error) << "Could not connect ports !"<<endlog(); return -1; }
send.configure(); recv.configure(); send_activity.start(); recv_activity.start(); TaskBrowser browser( &recv ); browser.setColorTheme( TaskBrowser::whitebg ); browser.loop();
send_activity.stop(); recv_activity.stop(); return 0; }
The differences between the combined and no-toolkit test programs will be covered in Part 2, but essentially amounts to not loading the toolkit.
Part 3 Transport plugin will build a transport plugin allowing Orocos to communicate these types across CORBA.
'This is a work in progress''
This part builds a transport plugin allowing Orocos to communicate these types across CORBA.
In a shell
cd /path/to/plugins mkdir build cd build cmake .. -DOROCOS_TARGET=macosx -DENABLE_CORBA=ON make
The only difference from building in Part 1, is to turn ON CORBA.
For other operating systems substitute the appopriate value for "macosx" when setting OROCOS_TARGET (e.g. "gnulinux").
Tested in Mac OS X Leopard 10.5.7.
In a shell
cd /path/to/plugins/build/corba/tests ./corba-recv
In a second shell
cd /path/to/plugins/build/corba/tests ./corba-send
Now the same exact two test components of Parts 1 and 2 are in separate processes. Typing ls in either process will present the same values (subject to network latency delays, which typically are not human perceptible) - the data and types are now being communicated between deployers.
Now, the transport plugin is responsible for communicating the types between deployers, while the toolkit plugin is responsible for knowing each type and being able to display it. Separate responsibilities. Separate plugins.
NB for the example components, send must be started after recv. Starting only corba-recv and issuing ls will display the default values for each type. Also, quitting the send component and then attempting to use the recv component will lockup the recv deployer. These limitations are not due to the plugins - they are simply due to the limited functionality of these test cases.
Running the same two corba test programs but without loading the transport plugin, is instructive as to what happens when you do not match up certain things in the toolkit sources. This is very important!
In a shell
cd /path/to/plugins/build/corba/tests ./corba-recv-no-toolkit
Data Flow Ports: RW(U) boost_ptime ptime = not-a-date-time RW(U) boost_timeduration timeDuration = 00:00:00
In a second shell
cd /path/to/plugins/build/corba/tests ./corba-send-no-toolkit
The send component without the transport plugin fails to start, with:
$ ./build/corba/tests/corba-send-no-toolkit 0.008 [ Warning][./build/corba/tests/corba-send-no-toolkit::main()] Forcing priority (0) of thread to 0. 0.008 [ Warning][PeriodicThread] Forcing priority (0) of thread to 0. 0.027 [ Warning][SingleThread] Forcing priority (0) of thread to 0. 5.078 [ Warning][./build/corba/tests/corba-send-no-toolkit::main()] ControlTask 'Send' already bound \ to CORBA Naming Service. 5.078 [ Warning][./build/corba/tests/corba-send-no-toolkit::main()] Trying to rebind... done. New \ ControlTask bound to Naming Service. 5.130 [ Warning][./build/corba/tests/corba-send-no-toolkit::main()] Can not create a proxy for data \ connection. 5.130 [ ERROR ][./build/corba/tests/corba-send-no-toolkit::main()] Dynamic cast failed \ for 'PN3RTT14DataSourceBaseE', 'unknown_t', 'unknown_t'. Do your typenames not match? Assertion failed: (doi && "Dynamic cast failed! See log file for details."), function createConnection, \ file /opt/install/include/rtt/DataPort.hpp, line 462. Abort trap
*** corba/tests/corba-recv.cpp 2009-07-29 22:08:32.000000000 -0400 --- corba/tests/corba-recv-no-toolkit.cpp 2009-08-09 16:32:03.000000000 -0400 *************** *** 11,17 **** #include <rtt/os/main.h> #include <rtt/Ports.hpp> - #include "../BoostCorbaToolkit.hpp" #include "../../BoostToolkit.hpp" // use Boost RTT Toolkit test components --- 11,16 ---- *************** *** 27,33 **** int ORO_main(int argc, char* argv[]) { RTT::Toolkit::Import( Examples::BoostToolkit ); - RTT::Toolkit::Import( Examples::Corba::corbaBoostPlugin ); Recv recv("Recv"); PeriodicActivity recv_activity( --- 26,31 ----
We define the CORBA types in corba/BoostTypes.idl. This is a file in CORBA's Interface Description Language (IDL). There are plenty of references on the web, for instance [1].
// must be in RTT namespace to match some rtt/corba code module RTT { module Corba {
struct time_duration { short hours; short minutes; short seconds; long nanoseconds; };
// can't get at underlying type, so send this way (yes, more overhead) // see BoostCorbaConversion.hpp::struct AnyConversion<boost::posix_time::ptime> // for further details. struct ptime { // julian day long date; time_duration time_of_day; }; }; };
Note that CORBA IDL knows about certain types already, e.g. short and long, and that we can use our time_duration structure in later structures.
We will come back to this IDL file during the build process.
The actual plugin is defined in corba/BoostCorbaToolkit.hpp. This is the equivalent of the BoostToolkit.hpp file, except for a transport plugin.
namespace Examples { namespace Corba { class CorbaBoostPlugin : public RTT::TransportPlugin { public: /// register this transport into the RTT type system bool registerTransport(std::string name, RTT::TypeInfo* ti); /// return the name of this transport type (ie "CORBA") std::string getTransportName() const; /// return the name of this transport std::string getName() const; }; // the global instance extern CorbaBoostPlugin corbaBoostPlugin; // namespace } }
The implementation of the plugin is in corba/BoostCorbaToolkit.cpp, and is very straight forward.
namespace Examples { namespace Corba { bool CorbaBoostPlugin::registerTransport(std::string name, TypeInfo* ti) { assert( name == ti->getTypeName() ); // name must match that in plugin::loadTypes() and // typeInfo::composeTypeInfo(), etc if ( name == "boost_ptime" ) return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new CorbaTemplateProtocol< boost::posix_time::ptime >() ); if ( name == "boost_timeduration" ) return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new CorbaTemplateProtocol< boost::posix_time::time_duration >() ); return false; }
std::string CorbaBoostPlugin::getTransportName() const { return "CORBA"; } std::string CorbaBoostPlugin::getName() const { return "CorbaBoost"; }
For a CORBA transport plugin, the name returned by getTransportName() should be CORBA.
CorbaBoostPlugin corbaBoostPlugin; // namespace } } ORO_TOOLKIT_PLUGIN(Examples::Corba::corbaBoostPlugin);
I will only cover the code for converting one of the types. The other is very similar - you can examine it yourself in the source file.
#include "BoostTypesC.h" #include <rtt/corba/CorbaConversion.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> // no I/O
// must be in RTT namespace to match some rtt/corba code namespace RTT {
template<> struct AnyConversion< boost::posix_time::time_duration > { // define the Corba and standard (ie non-Corba) types we are using typedef Corba::time_duration CorbaType; typedef boost::posix_time::time_duration StdType;
The last four of the following six functions are required by the CORBA library, to enable conversion between the CORBA and non-CORBA types. The two convert functions are their for convenience, and to save replicating code.
// convert CorbaType to StdTypes static void convert(const CorbaType& orig, StdType& ret) { ret = boost::posix_time::time_duration(orig.hours, orig.minutes, orig.seconds, orig.nanoseconds); } // convert StdType to CorbaTypes static void convert(const StdType& orig, CorbaType& ret) { ret.hours = orig.hours(); ret.minutes = orig.minutes(); ret.seconds = orig.seconds(); ret.nanoseconds = orig.fractional_seconds(); }
static CorbaType* toAny(const StdType& orig) { CorbaType* ret = new CorbaType(); convert(orig, *ret); return ret; } static StdType get(const CorbaType* orig) { StdType ret; convert(*orig, ret); return ret; } static bool update(const CORBA::Any& any, StdType& ret) { CorbaType* orig; if ( any >>= orig ) { convert(*orig, ret); return true; } return false; } static CORBA::Any_ptr createAny( const StdType& t ) { CORBA::Any_ptr ret = new CORBA::Any(); *ret <<= toAny( t ); return ret; } };
The same six functions then follow for our boost::ptime type. They are not covered in detail here.
IF (ENABLE_CORBA) INCLUDE(${CMAKE_SOURCE_DIR}/config/UseCorba.cmake)
FILE( GLOB IDLS [^.]*.idl ) FILE( GLOB CPPS [^.]*.cpp ) ORO_ADD_CORBA_SERVERS(CPPS HPPS ${IDLS} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/. )
CREATE_COMPONENT(BoostToolkit-corba-${OROCOS_TARGET} VERSION 1.0.0 ${CPPS}) TARGET_LINK_LIBRARIES(BoostToolkit-corba-${OROCOS_TARGET} ${OROCOS-RTT_CORBA_LIBRARIES} ${CORBA_LIBRARIES})
SUBDIRS(tests) ENDIF (ENABLE_CORBA)
The corba-send test program instantiates a send component, and uses an RTT ControlTaskProxy to represent the remote receive component.
#include <rtt/corba/ControlTaskServer.hpp> #include <rtt/corba/ControlTaskProxy.hpp> #include <rtt/RTT.hpp> #include <rtt/PeriodicActivity.hpp> #include <rtt/TaskContext.hpp> #include <rtt/os/main.h> #include <rtt/Ports.hpp> #include <ocl/TaskBrowser.hpp> #include "../BoostCorbaToolkit.hpp" #include "../../BoostToolkit.hpp" #include "../../tests/send.hpp" using namespace std; using namespace Orocos; using namespace RTT::Corba; int ORO_main(int argc, char* argv[]) { RTT::Toolkit::Import( Examples::BoostToolkit ); RTT::Toolkit::Import( Examples::Corba::corbaBoostPlugin );
Send send("Send"); PeriodicActivity send_activity( ORO_SCHED_OTHER, 0, 1.0 / 10, send.engine()); // 10 Hz // start Corba and find the remote task ControlTaskProxy::InitOrb(argc, argv); ControlTaskServer::ThreadOrb();
TaskContext* recv = ControlTaskProxy::Create( "Recv" ); assert(NULL != recv);
if ( connectPeers( recv, &send ) == false ) { log(Error) << "Could not connect peers !"<<endlog(); } // create data object at recv's side if ( connectPorts( recv, &send) == false ) { log(Error) << "Could not connect ports !"<<endlog(); }
send.configure(); send_activity.start(); log(Info) << "Starting task browser" << endlog(); OCL::TaskBrowser tb( recv ); tb.loop(); send_activity.stop();
ControlTaskProxy::DestroyOrb(); return 0; }
The receive test program has a similar structure to the send test program.
#include <rtt/corba/ControlTaskServer.hpp> #include <rtt/corba/ControlTaskProxy.hpp> #include <rtt/RTT.hpp> #include <rtt/PeriodicActivity.hpp> #include <rtt/TaskContext.hpp> #include <rtt/os/main.h> #include <rtt/Ports.hpp> #include "../BoostCorbaToolkit.hpp" #include "../../BoostToolkit.hpp" #include "../../tests/recv.hpp" #include <ocl/TaskBrowser.hpp> using namespace std; using namespace Orocos; using namespace RTT::Corba; int ORO_main(int argc, char* argv[]) { RTT::Toolkit::Import( Examples::BoostToolkit ); RTT::Toolkit::Import( Examples::Corba::corbaBoostPlugin ); Recv recv("Recv"); PeriodicActivity recv_activity( ORO_SCHED_OTHER, 0, 1.0 / 5, recv.engine()); // 5 Hz // Setup Corba and Export: ControlTaskServer::InitOrb(argc, argv); ControlTaskServer::Create( &recv ); ControlTaskServer::ThreadOrb();
// Wait for requests: recv.configure(); recv_activity.start(); OCL::TaskBrowser tb( &recv ); tb.loop(); recv_activity.stop();
// Cleanup Corba: ControlTaskServer::ShutdownOrb(); ControlTaskServer::DestroyOrb(); return 0; }
The no-toolkit versions of the test programs are identical, except they simply do not load the transport plugin, making it impossible to transport the boost types over CORBA.
Now located at http://orocos.org/wiki/rtt/examples-and-tutorials
Problem: How to reuse a component when you need the ports to have different names?
Solution: Name the connection between ports in the deployer. This essentially allows you to rename ports. Unfortunately, this extremely useful feature is not documented anywhere (as of July, 2009). <!-- break -->
Problem: How to reuse a component when you need the ports to have different names?
Solution: Name the connection between ports in the deployer. This essentially allows you to rename ports. Unfortunately, this extremely useful feature is not documented anywhere (as of July, 2009). <!-- break -->
This example occurs in three parts
class HMI : public RTT::TaskContext { protected: // *** OUTPUTS *** /// desired cartesian position RTT::WriteDataPort<KDL::Frame> cartesianPosition_desi_port; public: HMI(std::string name); virtual ~HMI(); protected: /// set the desired cartesian position to an initial value /// \return true virtual bool startHook(); };
class Robot : public RTT::TaskContext { protected: // *** INPUTS *** /// desired cartesian position RTT::ReadDataPort<KDL::Frame> cartesianPosition_desi_port; public: Robot(std::string name); virtual ~Robot(); };
class OneAxisFilter : public RTT::TaskContext { protected: // *** INPUTS *** /// desired cartesian position RTT::ReadDataPort<KDL::Frame> inputPosition_port; // *** OUTPUTS *** /// desired cartesian position RTT::WriteDataPort<KDL::Frame> outputPosition_port; // *** CONFIGURATION *** /// specify which axis to filter (should be one of "x", "y", or "z") RTT::Property<std::string> axis_prop; public: OneAxisFilter(std::string name); virtual ~OneAxisFilter(); protected: /// validate axis_prop value /// \return true if axis_prop value is valid, otherwise false virtual bool configureHook(); /// filter one translational axis (as specified by axis_prop) virtual void updateHook(); };
The component implementations are not given in this example, as they are not the interesting part of the solution, but are available in the Files section above.
The interesting part is in the deployment files ...
This part simply connects the HMI and robot together (see deployment file Connect-1.xml).
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "cpf.dtd"> <properties> <simple name="Import" type="string"> <value>liborocos-rtt</value> </simple> <simple name="Import" type="string"> <value>liborocos-kdl</value> </simple> <simple name="Import" type="string"> <value>liborocos-kdltk</value> </simple> <simple name="Import" type="string"> <value>libConnectionNaming</value> </simple>
<struct name="HMI" type="HMI"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Ports" type="PropertyBag"> <simple name="cartesianPosition_desi" type="string"> <value>cartesianPosition_desi</value></simple> </struct> </struct>
<simple name="portName" type="string"> <value>connectionName</value> </simple>
<struct name="Robot" type="Robot"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Peers" type="PropertyBag"> <simple type="string"><value>HMI</value></simple> </struct> <struct name="Ports" type="PropertyBag"> <simple name="cartesianPosition_desi" type="string"> <value>cartesianPosition_desi</value></simple> </struct> </struct> </properties>
Now, the deployer uses connection names when connecting components between peers, not port names. So it attempts to connect a Robot.cartesianPosition_desi connection to a Vehicle. cartesianPosition_desi connection (which in this part, matches the port names).
Build the library, and then run this part with
cd /path/to/ConnectionNaming/build deployer-macosx -s ../Connect-1.xml
Examine the HMI and Robot components, and note that each has a connected port, and the port values match.
This part adds a filter component between the HMI and the robot (see Connect-2.xml)
As with Part 1, the first part of the file loads the appropriate libraries (left out here, as it is identical to Part 1).
<struct name="HMI" type="HMI"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Ports" type="PropertyBag"> <simple name="cartesianPosition_desi" type="string"> <value>unfiltered_cartesianPosition_desi</value></simple> </struct> </struct>
<struct name="Filter" type="OneAxisFilter"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Peers" type="PropertyBag"> <simple type="string"><value>HMI</value></simple> </struct> <struct name="Ports" type="PropertyBag"> <simple name="inputPosition" type="string"> <value>unfiltered_cartesianPosition_desi</value></simple> <simple name="outputPosition" type="string"> <value>filtered_cartesianPosition_desi</value></simple> </struct> <simple name="PropertyFile" type="string"> <value>../Filter1.cpf</value></simple> </struct>
<struct name="Robot" type="Robot"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Peers" type="PropertyBag"> <simple type="string"><value>Filter</value></simple> </struct> <struct name="Ports" type="PropertyBag"> <simple name="cartesianPosition_desi" type="string"> <value>filtered_cartesianPosition_desi</value></simple> </struct> </struct>
Run this part with
cd /path/to/ConnectionNaming/build deployer-macosx -s ../Connect-2.xml
Examine all three components, and note that all ports are connected, and in particular, that the HMI and Filter.inputPosition ports match while the Filter.outputPosition and Vehicle ports match (ie they have the 'x' axis filtered out).
Using connection naming allows us to connect ports of different names. This is particularly useful with a generic component like this filter, as in one deployment it may connect to a component with ports named cartesianPosition_desi, while in another deployment it may connect to ports named CartDesiPos, or any other names. The filter component is now decoupled from the actual port names used to deploy it.
This part adds a second filter between the first filter and the robot.
As with Parts 1 and 2, the libraries are loaded first.
<struct name="HMI" type="HMI"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Ports" type="PropertyBag"> <simple name="cartesianPosition_desi" type="string"> <value>unfiltered_cartesianPosition_desi</value></simple> </struct> </struct>
<struct name="Filter1" type="OneAxisFilter"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Peers" type="PropertyBag"> <simple type="string"><value>HMI</value></simple> </struct> <struct name="Ports" type="PropertyBag"> <simple name="inputPosition" type="string"> <value>unfiltered_cartesianPosition_desi</value></simple> <simple name="outputPosition" type="string"> <value>filtered_cartesianPosition_desi</value></simple> </struct> <simple name="PropertyFile" type="string"> <value>../Filter1.cpf</value></simple> </struct>
<struct name="Filter2" type="OneAxisFilter"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Peers" type="PropertyBag"> <simple type="string"><value>HMI</value></simple> </struct> <struct name="Ports" type="PropertyBag"> <simple name="inputPosition" type="string"> <value>filtered_cartesianPosition_desi</value></simple> <simple name="outputPosition" type="string"> <value>double_filtered_cartesianPosition_desi</value></simple> </struct> <simple name="PropertyFile" type="string"> <value>../Filter2.cpf</value></simple> </struct>
<struct name="Robot" type="Robot"> <struct name="Activity" type="PeriodicActivity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Peers" type="PropertyBag"> <simple type="string"><value>Filter2</value></simple> </struct> <struct name="Ports" type="PropertyBag"> <simple name="cartesianPosition_desi" type="string"> <value>double_filtered_cartesianPosition_desi</value></simple> </struct> </struct>
Run this part with
cd /path/to/ConnectionNaming/build deployer-macosx -s ../Connect-3.xml
Examine all components, and note which ports are connected, and what their values are. Note that the vehicle has two axes knocked out (x and y).
In a shell
cd /path/to/ConnectionNaming mkdir build cd build cmake .. -DOROCOS_TARGET=macosx make
For other operating systems substitute the appopriate value for "macosx" when setting OROCOS_TARGET (e.g. "gnulinux").
Tested in Mac OS X Leopard 10.5.7.
Attachment | Size |
---|---|
HMI.hpp | 2.16 KB |
Robot.hpp | 1.99 KB |
OneAxisFilter.hpp | 2.52 KB |
HMI.cpp | 2.04 KB |
Robot.cpp | 1.94 KB |
OneAxisFilter.cpp | 2.92 KB |
Connect-1.xml | 1.96 KB |
Connect-2.xml | 2.91 KB |
Connect-3.xml | 3.85 KB |
connectionNaming.tar_.bz2 | 7.01 KB |
Now located at http://orocos.org/wiki/rtt/examples-and-tutorials
Solution: Use a non-periodic component. This example outlines one method to structure the component, to deal with the non-blocking reads while still being responsive to other components, being able to run a state machine, etc.
<!-- break -->
The .cpf file has a .txt extension simply to keep the wiki happy. To use the file, rename it to SimpleNonPeriodicClient.cpf.
This is the class definition
class SimpleNonPeriodicClient : public RTT::TaskContext { protected: // DATA INTERFACE // *** OUTPUTS *** /// the last read data RTT::WriteDataPort<std::string> lastRead_port; /// the number of items sucessfully read RTT::Attribute<int> countRead_attr; // *** CONFIGURATION *** // name to listen for incoming connections on, either FQDN or IPv4 addres RTT::Property<std::string> hostName_prop; // port to listen on RTT::Property<int> hostPort_prop; // timeout in seconds, when waiting for connection RTT::Property<int> connectionTimeout_prop; // timeout in seconds, when waiting to read RTT::Property<int> readTimeout_prop; public: SimpleNonPeriodicClient(std::string name); virtual ~SimpleNonPeriodicClient(); protected: /// reset count and lastRead, attempt to connect to remote virtual bool startHook(); /// attempt to read and process one packet virtual void updateHook(); /// close the socket and cleanup virtual void stopHook(); /// cause updateHook() to return virtual bool breakUpdateHook(); /// Socket used to connect to remote host QTcpSocket* socket; /// Flag indicating to updateHook() that we want to quit bool quit; };
The component has a series of properties specifying the remote host and port to connect to, as well as timeout parameters. It also uses an RTT Attribute to count the number of successful reads that have occurred, and stores the last read data as a string in a RTT data port.
#include "SimpleNonPeriodicClient.hpp" #include <rtt/Logger.hpp> #include <ocl/ComponentLoader.hpp> #include <QTcpSocket>
The class definition is included as well as the RTT logger, and importantly, the OCL component loader that turns this class into a deployable componet in a shared library.
Most importantly, all Qt related headers come after all Orocos headers. This is required as Qt redefines certain words (eg "slot", "emit") which when used in our or Orocos code cause compilation errors.
SimpleNonPeriodicClient::SimpleNonPeriodicClient(std::string name) : RTT::TaskContext(name), lastRead_port("lastRead", ""), countRead_attr("countRead", 0), hostName_prop("HostName", "Name to listen for incoming connections on (FQDN or IPv4)", ""), hostPort_prop("HostPort", "Port to listen on (1024-65535 inclusive)", 0), connectionTimeout_prop("ConnectionTimeout", "Timeout in seconds, when waiting for connection", 0), readTimeout_prop("ReadTimeout", "Timeout in seconds, when waiting for read", 0), socket(new QTcpSocket), quit(false) { ports()->addPort(&lastRead_port); attributes()->addAttribute(&countRead_attr); properties()->addProperty(&hostName_prop); properties()->addProperty(&hostPort_prop); properties()->addProperty(&connectionTimeout_prop); properties()->addProperty(&readTimeout_prop); }
The constuctor simply sets up the data interface elements (ie the port, attribute and properties), and gives them appropriate initial values. Note that some of these initial values are illegal, which would aid in any validation code in a configureHook() (which has not been done in this example).
SimpleNonPeriodicClient::~SimpleNonPeriodicClient() { delete socket; }
The destructor cleans up by deleting the socket we allocated in the constructor.
Now to the meat of it
bool SimpleNonPeriodicClient::startHook() { bool rc = false; // prove otherwise std::string hostName = hostName_prop.rvalue(); int hostPort = hostPort_prop.rvalue(); int connectionTimeout = connectionTimeout_prop.rvalue(); quit = false; // attempt to connect to remote host/port log(Info) << "Connecting to " << hostName << ":" << hostPort << endlog(); socket->connectToHost(hostName.c_str(), hostPort); if (socket->waitForConnected(1000 * connectionTimeout)) // to millseconds { log(Info) << "Connected" << endlog(); rc = true; } else { log(Error) << "Error connecting: " << socket->error() << ", " << socket->errorString().toStdString() << endlog(); // as we now return false, this component will fail to start. } return rc; }
If the connection does not occur successfully, then startHook() will return false which prevents the component from actually being started. No reconnection is attempted (see Assumptions above)
void SimpleNonPeriodicClient::updateHook() { // wait for some data to arrive, timing out if necessary int readTimeout = readTimeout_prop.rvalue(); log(Debug) << "Waiting for data with timeout=" << readTimeout << " seconds" << endlog(); if (!socket->waitForReadyRead(1000 * readTimeout)) { log(Error) << "Error waiting for data: " << socket->error() << ", " << socket->errorString().toStdString() << ". Num bytes = " << socket->bytesAvailable() << endlog(); log(Error) << "Disconnecting" << endlog(); // disconnect socket, and do NOT call this function again // ie no engine()->getActivity()->trigger() socket->disconnectFromHost(); return; } // read and print whatever data is available, but stop if instructed // to quit while (!quit && (0 < socket->bytesAvailable())) { #define BUFSIZE 10 char str[BUFSIZE + 1]; // +1 for terminator qint64 numRead; numRead = socket->read((char*)&str[0], min(BUFSIZE, socket->bytesAvailable())); str[BUFSIZE] = '\0'; // forcibly terminate if (0 < numRead) { log(Info) << "Got " << numRead << " bytes : '" << &str[0] << "'" << endlog(); countRead_attr.set(countRead_attr.get() + 1); lastRead_port.Set(&str[0]); } } // if not quitting then trigger another immediate call to this function, to // get the next batch of data if (!quit) { engine()->getActivity()->trigger(); } }
The updateHook() function attempts to wait until data is available, and then reads the data BUFSIZE characters at a time. If it times out waiting for data, then it errors out and disconnects the port. This is not a robust approach and a real algorithm would deal with this differently.
As data may be continually arriving and/or we get more than BUFSIZE characters at a time, the while loop may iterate several times. The quit flag will indicate if the user wants to stop the component, and that we should stop reading characters.
Of particular note is the last line
engine()->getActivity()->trigger();
void SimpleNonPeriodicClient::stopHook() { if (socket->isValid() && (QAbstractSocket::ConnectedState == socket->state())) { log(Info) << "Disconnecting" << endlog(); socket->disconnectFromHost(); } }
bool SimpleNonPeriodicClient::breakUpdateHook() { quit = true; return true; }
We could have also done something like socket->abort() to forcibly terminate any blocked socket->waitForReadyRead() calls.
When using system calls (e.g. read() ) instead of Qt classes you could attempt to send a signal to interrupt the system call, however, this might not have the desired effect when the component is deployed ... the reader is advised to be careful here.
ORO_CREATE_COMPONENT(SimpleNonPeriodicClient)
In a shell
cd /path/to/SimpleNonPeriodicClient mkdir build cd build cmake .. -DOROCOS_TARGET=macosx make
For other operating systems substitute the appopriate value for "macosx" when setting OROCOS_TARGET (e.g. "gnulinux").
Tested in Mac OS X Leopard 10.5.7, and Ubuntu Jaunty Linux.
Start one shell and run netcat to act as the server (NB 50001 is the HostPort value from your SimpleNonPeriodicClient.cpf file)
nc -l 50001
Start a second shell and deploy the SimpleNonPeriodicClient component
cd /path/to/SimpleNonPeriodicClient/build deployer-macosx -s ../SimpleNonPeriodicClient.xml
Now type in the first shell and when you hit enter, then netcat will send the data and it will be printed by the SimpleNonPeriodicClient component (where N is the size of the buffer in updateHook()).
Points to note:
Attachment | Size |
---|---|
SimpleNonPeriodicClient.cpp | 7.42 KB |
SimpleNonPeriodicClient.hpp | 3.11 KB |
SimpleNonPeriodicClient.xml | 1 KB |
SimpleNonPeriodicClient-cpf.txt | 748 bytes |
SimpleNonPeriodicClient.tar_.bz2 | 7.72 KB |
The netcat shell, with the text the user typed in.
nc -l 50001 The quick brown fox jumps over the lazy dog.
The deployer shell, showing the text read in chunks, as well as the updated port and attribute within the component.
deployer-macosx -s ../SimpleNonPeriodicClient.xml -linfo 0.009 [ Info ][deployer-macosx::main()] No plugins present in /usr/lib/rtt/macosx/plugins 0.009 [ Info ][DeploymentComponent::loadComponents] Loading '../SimpleNonPeriodicClient.xml'. 0.010 [ Info ][DeploymentComponent::loadComponents] Validating new configuration... 0.011 [ Info ][DeploymentComponent::loadLibrary] Storing orocos-rtt 0.011 [ Info ][DeploymentComponent::loadLibrary] Loaded shared library 'liborocos-rtt-macosx.dylib' 0.054 [ Info ][DeploymentComponent::loadLibrary] Loaded multi component library 'libSimpleNonPeriodicClient.dylib' 0.054 [ Warning][DeploymentComponent::loadLibrary] Component type name SimpleNonPeriodicClient already used: overriding. 0.054 [ Info ][DeploymentComponent::loadLibrary] Loaded component type 'SimpleNonPeriodicClient' 0.055 [ Info ][DeploymentComponent::loadLibrary] Storing SimpleNonPeriodicClient 0.058 [ Info ][DeploymentComponent::loadComponent] Adding SimpleNonPeriodicClient as new peer: OK. 0.058 [ Warning][SingleThread] Forcing priority (0) of thread to 0. 0.058 [ Info ][NonPeriodicActivity] SingleThread created with priority 0 and period 0. 0.058 [ Info ][NonPeriodicActivity] Scheduler type was set to `4'. 0.059 [ Info ][PropertyLoader:configure] Configuring TaskContext 'SimpleNonPeriodicClient' with '../SimpleNonPeriodicClient.cpf'. 0.059 [ Info ][DeploymentComponent::configureComponents] Configured Properties of SimpleNonPeriodicClient from ../SimpleNonPeriodicClient.cpf 0.059 [ Info ][DeploymentComponent::configureComponents] Re-setting activity of SimpleNonPeriodicClient 0.059 [ Info ][DeploymentComponent::configureComponents] Configuration successful. 0.060 [ Info ][DeploymentComponent::startComponents] Connecting to 127.0.0.1:50001 0.064 [ Info ][DeploymentComponent::startComponents] Connected 0.065 [ Info ][DeploymentComponent::startComponents] Startup successful. 0.065 [ Info ][deployer-macosx::main()] Successfully loaded, configured and started components from ../SimpleNonPeriodicClient.xml Switched to : Deployer 0.066 [ Info ][SimpleNonPeriodicClient] Entering Task Deployer This console reader allows you to browse and manipulate TaskContexts. You can type in a command, event, method, expression or change variables. (type 'help' for instructions) TAB completion and HISTORY is available ('bash' like) In Task Deployer[S]. (Status of last Command : none ) (type 'ls' for context info) :4.816 [ Info ][SimpleNonPeriodicClient] Got 10 bytes : 'The quick ' 4.816 [ Info ][SimpleNonPeriodicClient] Got 10 bytes : 'brown fox ' 7.448 [ Info ][SimpleNonPeriodicClient] Got 10 bytes : 'jumps over' 7.448 [ Info ][SimpleNonPeriodicClient] Got 10 bytes : ' the lazy ' 12.448 [ ERROR ][SimpleNonPeriodicClient] Error waiting for data: 5, Network operation timed out. Num bytes = 5 12.448 [ ERROR ][SimpleNonPeriodicClient] Disconnecting In Task Deployer[S]. (Status of last Command : none ) (type 'ls' for context info) :ls SimpleNonPeriodicClient Listing TaskContext SimpleNonPeriodicClient : Configuration Properties: string HostName = 127.0.0.1 (Name to listen for incoming connections on (FQDN or IPv4)) int HostPort = 50001 (Port to listen on (1024-65535 inclusive)) int ConnectionTimeout = 5 (Timeout in seconds, when waiting for connection) int ReadTimeout = 5 (Timeout in seconds, when waiting for read) Execution Interface: Attributes : int countRead = 4 Methods : activate cleanup configure error getErrorCount getPeriod getWarningCount inFatalError inRunTimeError inRunTimeWarning isActive isConfigured isRunning resetError start stop trigger update warning Commands : (none) Events : (none) Data Flow Ports: W(U) string lastRead = the lazy Task Objects: this ( The interface of this TaskContext. ) scripting ( Access to the Scripting interface. Use this object in order to load or query programs or state machines. ) engine ( Access to the Execution Engine. Use this object in order to address programs or state machines which may or may not be loaded. ) marshalling ( Read and write Properties to a file. ) lastRead ( (No description set for this Port) ) Peers : (none) In Task Deployer[S]. (Status of last Command : none ) (type 'ls' for context info) :quit 18.089 [ Info ][DeploymentComponent::stopComponents] Stopped SimpleNonPeriodicClient 18.089 [ Info ][DeploymentComponent::cleanupComponents] Cleaned up SimpleNonPeriodicClient 18.090 [ Info ][DeploymentComponent::startComponents] Disconnected and destroyed SimpleNonPeriodicClient 18.090 [ Info ][DeploymentComponent::startComponents] Kick-out successful. 18.091 [ Info ][Logger] Orocos Logging Deactivated.
Problem: You deploy multiple configurations of your system, perhaps choosing between a real and simulated robot, some real and simulated device, etc. You want to parameterize the deployments to reduce the number of files you have to write for the varying configuration combinations
Solution: Use the XML ENTITY element.
There is a top-level file per configuration, which specifies all the parameters. Each top-level file then includes a child file which instantiates components, etc.
One top level file
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "cpf.dtd" [ <!-- internal entities for substituion --> <!ENTITY name "Console"> <!ENTITY lib "liborocos-rtt"> <!-- external entity for file substitution --> <!ENTITY FILE_NAME SYSTEM "test-entity-child.xml"> ] > <properties> &FILE_NAME; </properties>
The internal entity values are used to substitute component names, and other basic parameters. The external entity value (&FILE_NAME) is used to include child files, so that the entity values defined in the top-level file are available within the child file. Using the Orocos' builtin include statement does not make the top-level entity values available within the child file.
The child file simply substitutes the two internal entities for a library name, and a component name.
<properties> <simple name="Import" type="string"> <value>&lib;</value> </simple> <simple name="Import" type="string"> <value>liborocos-ocl-common</value> </simple> <struct name="&name;" type="OCL::HMIConsoleOutput"> </struct> </properties>
The other top level file differs from the first top level file only in the name of the component.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "cpf.dtd" [ <!ENTITY name "Console2"> <!ENTITY lib "liborocos-rtt"> <!ENTITY file SYSTEM "test-entity-child.xml"> ] > <properties> &file; </properties>
You can use relative paths within the external entity filename. I have had inconsistent success with this - sometimes the relative path is needed, and other times it isn't. I think that it only needs the path relative to the file being included from, so if that file is already loaded on a relative path then you need to specify the child file only relative to the parent file, and not the current working directory that you started the deployment in.
Attachment | Size |
---|---|
test-entity.xml | 1.56 KB |
test-entity2.xml | 278 bytes |
test-entity-child.xml | 307 bytes |
This page collects notes and issues on the use of real-time logging. Its contents will eventually become the documentation for this feature.
This feature has been integrated in the Orocos 1.x and 2.x branches but is still considered under development. However, if you need a real-time logging infrastructure (ie text messages to users), this is exactly where you need to be. If you need a real-time data stream logging of ports, use the OCL's Reporting NetCDFReporting Component instead.
It is noted in the text where Orocos 1.x and 2.x differ.
Categories can not be created in real-time: They live on the normal heap via new/delete. Create all categories in your component's constructor or during configureHook() or similar.
NDC's are not supported. They involve std::string and std::vector which we currently can't replace.
Works only with OCL's deployers: If you use a non-deployer mechanism to bring up your system, you will need to add code to ensure that the log4cpp framework creates our OCL::Category objects, and not the default (non-real-time) log4cpp::Category objects. This should be done early in your application, prior to any components and categories being created.
log4cpp::HierarchyMaintainer::set_category_factory( OCL::logging::Category::createOCLCategory);
This is not currently dealt with, but could be in future implementations.
In RTT/OCL 1.x, multiple appenders connected to the same category will, receive only some of the incoming logging events. This is as each appender will pop different elements from the category's buffer. This issue has been solved in 2.x.
The size of the buffer between a category and its appenders is currently fixed (see ocl/logging/Category.cpp). This will be fixed lateron on the 2.x branch. Note that that fixed size plus the default consumption rate of the FileAppender means you can exhaust the default TLSF memory pool in very short order. For a complex application (~40 components, 400 Hz cycle rate) we increased the default buffer size to 200, increased the memory pool to 10's of kilobytes (or megabytes) and increased the FileAppender consumption rate to 500 messages per second.
We can use standard log viewers for Log4j in two ways:
These log viewers are compatible:
As at October 2010, assumes you are using for RTT 1.x:
And for RTT 2.x, use the Orocos Toolchain 2.2 or later from :
then build in the following order, with these options ON:
The deployer now defaults to a 20k real-time memory pool (see OCL CMake option ORO_DEFAULT_RTALLOC_SIZE), all Orocos RTT::Logger calls end up inside of log4cpp, and the default for RTT::Logger logging events is to log to a file "orocos.log". Same as always. But now you can configure all logging in one place!
IMPORTANT Be aware that there are two logging hierarchies at work here:
In time, hopefully these two will evolve into just the latter.
We're assuming here that you used 'orocreate-pkg' to setup a new application. So you're using the UseOrocos CMake macros.
Both steps will make sure that your libraries link with the Orocos logging libraries and that include files are found.
The deployer's have command line options for this
deployer-macosx --rtalloc-mem-size 10k deployer-corba-macosx --rtalloc-mem-size 30m deployer-corba-macosx --rtalloc 10240 # understands shortened, but unique, options
NOTE: this feature is not available on the official release. Skip to the next section (Configuring OCL::logging) if you're not using the log4cpp branch of the RTT
You can use any of log4cpp's configurator approaches to configure, but the deployer's already know about PropertyConfigurator's. You can pass a log4cpp property file to the deployer and that will be used to configure the first of the hierarchies above - the non-real-time, logging used by RTT::Logger. For example
deployer-macosx --rtt-log4cpp-config-file /z/l/log4cpp.conf
# root category logs to application (this level is also the default for all # categories who's level is NOT explicitly set in this file) log4j.rootCategory=DEBUG, applicationAppender # orocos setup log4j.category.org.orocos.rtt=INFO, orocosAppender log4j.additivity.org.orocos.rtt=false # do not also log to parent categories log4j.appender.orocosAppender=org.apache.log4j.FileAppender log4j.appender.orocosAppender.fileName=orocos-log4cpp.log log4j.appender.orocosAppender.layout=org.apache.log4j.PatternLayout log4j.appender.orocosAppender.layout.ConversionPattern=%d{%Y%m%dT%T.%l} [%-5p] %m%n
IMPORTANT Note the direction of the category name, from org to rtt. This is specific to log4cpp and other log4j-style frameworks. Using a category "rtt.orocos.org" and sub-category "scripting.rtt.orocos.org" won't do what you, nor log4cpp, expect.
This is how you would setup logging from a Deployer XML file. If you prefer to use a script, see the next section.
See ocl/logging/tests/xxx.xml for complete examples and more detail, but in short
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "cpf.dtd"> <properties> <simple name="Import" type="string"> <value>liborocos-logging</value> </simple> <simple name="Import" type="string"> <value>libTestComponent</value> </simple> <struct name="TestComponent" type="OCL::logging::test::Component"> <struct name="Activity" type="Activity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> </struct> <struct name="AppenderA" type="OCL::logging::FileAppender"> <struct name="Activity" type="Activity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Properties" type="PropertyBag"> <simple name="Filename" type="string"><value>appendera.log</value></simple> <simple name="LayoutName" type="string"><value>pattern</value></simple> <simple name="LayoutPattern" type="string"><value>%d [%t] %-5p %c %x - %m%n</value></simple> </struct> </struct> <struct name="LoggingService" type="OCL::logging::LoggingService"> <struct name="Activity" type="Activity"> <simple name="Period" type="double"><value>0.5</value></simple> <simple name="Priority" type="short"><value>0</value></simple> <simple name="Scheduler" type="string"><value>ORO_SCHED_OTHER</value></simple> </struct> <simple name="AutoConf" type="boolean"><value>1</value></simple> <simple name="AutoStart" type="boolean"><value>1</value></simple> <struct name="Properties" type="PropertyBag"> <struct name="Levels" type="PropertyBag"> <simple name="org.orocos.ocl.logging.tests.TestComponent" type="string"><value>info</value></simple> </struct> <struct name="Appenders" type="PropertyBag"> <simple name="org.orocos.ocl.logging.tests.TestComponent" type="string"><value>AppenderA</value></simple> </struct> </struct> <struct name="Peers" type="PropertyBag"> <simple type="string"><value>AppenderA</value></simple> </struct> </struct> </properties>
Run this XML file, save it in 'setup_logging.xml' and use it:
deployer-gnulinux -s setuplogging.xml
This is how you would setup logging from a Lua script file. If you prefer to use a XML, see the previous section.
require("rttlib") -- Set this to true to write the property files the first time. write_props=false tc = rtt.getTC() depl = tc:getPeer("deployer") -- Create components. Enable BUILD_LOGGING and BUILD_TESTS for this to -- work. depl:loadComponent("TestComponent","OCL::logging::test::Component") depl:setActivity("TestComponent", 0.5, 0, 0) depl:loadComponent("AppenderA", "OCL::logging::FileAppender") depl:setActivity("AppenderA", 0.5, 0, 0) depl:loadComponent("LoggingService", "OCL::logging::LoggingService") depl:setActivity("LoggingService", 0.5, 0, 0) test = depl:getPeer("TestComponent") aa = depl:getPeer("AppenderA") ls = depl:getPeer("LoggingService") depl:addPeer("AppenderA","LoggingService") -- Load marshalling service to read/write components depl:loadService("LoggingService","marshalling") depl:loadService("AppenderA","marshalling") if write_props then ls:provides("marshalling"):writeProperties("logging_properties.cpf") aa:provides("marshalling"):writeProperties("appender_properties.cpf") print("Wrote property files. Edit them and set write_props=false") os.exit(0) else ls:provides("marshalling"):loadProperties("logging_properties.cpf") aa:provides("marshalling"):loadProperties("appender_properties.cpf") end test:configure() aa:configure() ls:configure() test:start() aa:start() ls:start()
To run this script, save it in 'setup_logging.lua' and do:
rttlua-gnulinux -i setup_logging.lua
// TestComponent.hpp #include <ocl/LoggingService.hpp> #include <ocl/Category.hpp> class Component : public RTT::TaskContext { ... /// Our logging category OCL::logging::Category* logger; };
// TestComponent.cpp #include <rtt/rt_string.hpp> Component::Component(std::string name) : RTT::TaskContext(name), logger(dynamic_cast<OCL::logging::Category*>( &log4cpp::Category::getInstance("org.orocos.ocl.logging.tests.TestComponent"))) { } bool Component::startHook() { bool ok = (0 != logger); if (!ok) { log(Error) << "Unable to find existing OCL category '" << categoryName << "'" << endlog(); } return ok; } void Component::updateHook() { // RTT 1.X logger->error(OCL::String("Had an error here")); logger->debug(OCL::String("Some debug data ...")); // RTT 2.X logger->error(RTT::rt_string("Had an error here")); logger->debug(RTT::rt_string("Some debug data ...")); logger->getRTStream(log4cpp::Priority::DEBUG) << "Some debug data and a double value " << i; }
IMPORTANT YOu must dynamic_cast to an OCL::logging::Category* to get the logger, as shown in the constructor above. Failure to do this can lead to trouble. You must also use explicitly use OCL::String() syntax when logging. Failure to do this produces compiler errors, as otherwise the system defaults to std::string and then you are no longer real-time. See the FAQ below for more description.
And the output of the above looks something like this:
// file orocos.log, from RTT::Logger configured with log4cpp 20100414T09:50:11.844 [INFO] ControlTask 'HMI' found CORBA Naming Service. 20100414T09:50:11.845 [WARN] ControlTask 'HMI' already bound to CORBA Naming Service.
20100414T21:41:22.539 [INFO ] components.HMI Started servicing::HMI 20100414T21:41:23.039 [DEBUG] components.Robot Motoman robot started 20100414T21:41:42.539 [INFO ] components.ConnectionMonitor Connected
20100414T21:41:41.982 [INFO ] org.orocos.rtt Thread created with scheduler type '1', priority 0 and period 0. 20100414T21:41:41.982 [INFO ] org.orocos.rtt Creating Proxy interface for HMI 20100414T21:41:42.016 [DEBUG] org.me.myapp Connections made successfully 20100414T21:41:44.595 [DEBUG] org.me.myapp.Robot Request position hold
The last one is the most interesting. All RTT::Logger calls have been sent to the same appender as the application logs to. This means you can use the exact same logging statements in both your components (when they use OCL::Logging) and in your GUI code (when they use log4cpp directly). Less maintenance, less hassle, only one (more) tool to learn. The configuration file for the last example looks something like
# root category logs to application (this level is also the default for all # categories who's level is NOT explicitly set in this file) log4j.rootCategory=DEBUG, applicationAppender # orocos setup log4j.category.org.orocos.rtt=INFO, applicationAppender log4j.additivity.org.orocos.rtt=false # do not also log to parent categories # application setup log4j.category.org.me =INFO, applicationAppender log4j.additivity.org.me=false # do not also log to parent categories log4j.category.org.me.gui=WARN log4j.category.org.me.gui.Robot=DEBUG log4j.category.org.me.gui.MainWindow=INFO log4j.appender.applicationAppender=org.apache.log4j.FileAppender log4j.appender.applicationAppender.fileName=application.log log4j.appender.applicationAppender.layout=org.apache.log4j.PatternLayout log4j.appender.applicationAppender.layout.ConversionPattern=%d{%Y%m%dT%T.%l} [%-5p] %c %m%n
A: Make sure you are using an OCL::logging::Category* and not a log4cpp::Category. The latter will silently compile and run, but it will discard all logging statements. This situation can also mask the fact that you are accidentally using std::string and not OCL::String. For example
log4cpp::Category* logger = log4cpp::Category::getInstance(name); logger->debug("Hello world")
OCL::logging::Category* logger = dynamic_cast<OCL::logging::Category*>(&log4cpp::Category::getInstance(name)); logger->debug("Hello world")
/path/to/log4cpp/include/log4cpp/Category.hh: In member function ‘virtual bool MyComponent::configureHook()’: /path/to/log4cpp/include/log4cpp/Category.hh:310: error: ‘void log4cpp::Category::debug(const char*, ...)’ is inaccessible /path/to/my/source/MyComponent.cpp:64: error: within this context
OCL::logging::Category* logger = dynamic_cast<OCL::logging::Category*>(&log4cpp::Category::getInstance(name)); logger->debug(OCL::String("Hello world"))
This page describes a working example of using omniORBpy to interact with an Orocos component. The example is very simple, and is intended for people who do not know where to start developing a CORBA client.
Your first stop is: http://omniorb.sourceforge.net/omnipy3/omniORBpy/ The omniORBpy version 3 User’s Guide. Read chapters 1 and 2. Optionally read chapter 6. The example works with and without naming services.
Once you are comfortable with omniORBpy, do the following (I assume you are kind enough to be a Linux user working on a console):
wget http://www.orocos.org/stable/examples/rtt/rtt-examples-1.10.0.tar.gz tar xf rtt-examples-1.10.0.tar.gz cd rtt-examples-1.10.0/corba-example/ make smallnet
svn co http://svn.mech.kuleuven.be/repos/orocos/trunk/rtt/src/corba/ mkdir omniclt cp corba/*idl omnictl/ cd omniclt
omniidl -bpython *idl
cp ~/orocosclient.py .
sudo ../smallnet
If you get something like
0.011 [ Warning][SmallNetwork] ControlTask 'ComponentA' could not find CORBA Naming Service. 0.011 [ Warning][SmallNetwork] Writing IOR to 'std::cerr' and file 'ComponentA.ior' IOR:0...10100
sudo ../smallnet -ORBInitRef NameService=corbaname::127.0.0.1
InitRef=NameService=corbaname::127.0.0.1
python orocosclient.py
If you are not able to make your naming service work, try using the component's IOR. After running you smallnet server, copy the complete IOR printed on screen and paste it as argument to the python program (including the word "IOR:")
python orocosclient.py IOR:0...10100
Look at the IDLs and the code to understand how things work. I am no python expert, so if the coding style looks weird to you, my apologies. Good luck!
Attachment | Size |
---|---|
orocosclient.py_.txt | 1.99 KB |
Future home of FAQ
cd BASE_DIR svn co ... cd rtt debchange -v 1.8.0-0 cd debian ./create-control.sh gnulinux # optionally add "lxrt", "xenomai" svn add *1.8*install cd .. export DEB_BUILD_OPTIONS="parallel=2" # or 4, 8, depending on your computer svn-br # or svn-b
Packages are built into BASE_DIR/build-area.
cd BASE_DIR git clone http://git.gitorious.org/orocos-toolchain/rtt.git cd rtt debchange -v 2.3.0-1 cd debian ./create-control.sh gnulinux # optionally add "lxrt", "xenomai" git add *2.3*install git commit -sm"2.3 release install files" cd .. export DEB_BUILD_OPTIONS="parallel=2" # or 4, 8, depending on your computer git-buildpackage --git-upstream-branch=origin
Packages are built into BASE_DIR/build-area.
cd BASE_DIR dpkg-scanpackages build_area /dev/null | gzip -9c > Packages.gz
Now open/etc/apt/sources.list in your favorite editor, and append the following lines to the bottom (substituting the full path to your repos for /path/to/BASE_DIR/).
# Orocos packages deb file:///path/to/BASE_DIR/ ./
Open Synaptic, reload, search for orocos and install.
Follow the same basic approach first for KDL, then for OCL
NB KDL and OCL will happily both build into "build_area" alongside RTT.
orocos-ocl-gnulinux1.8-bin and liborocos-ocl-gnulinux1.8-dev packages).
# 1.x: svn co ... cd quicky mkdir build && cd build cmake .. make # one of the following two exports, depending on your situation export LD_LIBRARY_PATH=. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:. deployer-gnulinux -s ../quicky.xml ls Quicky # you should see Data_W != 0
orocreate-pkg testme cd testme #non-ROS: make install #ROS: make deployer-gnulinux > import("testme") > displayComponentTypes()
In the first shell start the naming service and the deployer
Naming_Service -m 0 -ORBDottedDecimalAddresses 1 -ORBListenEndpoints iiop://127.0.0.1:2809 -ORBDaemon export NameServiceIOR=corbaloc:iiop:127.0.0.1:2809/NameService deployer-corba-gnulinux -s ../quicky.xml -- -ORBDottedDecimalAddresses 1 ls Quicky # you should see Data_W != 0
In the second shell run the taskbrowser and see the Quicky component running in the deployer
export NameServiceIOR=corbaloc:iiop:127.0.0.1:2809/NameService ctaskbrowser-gnulinux Deployer -ORBDottedDecimalAddresses 1 ls Quicky # you should see Data_W != 0
If the v1.8 files have already been committed to the repository, then you don't need the debchange and svn add commands when building the packages.
[1] http://www.debian.org/doc/manuals/repository-howto/repository-howto#setting-up [2] http://orocos.org/wiki/rtt/frequently-asked-questions-faq/using-corba
This page describes how to re-build debian packages for another Debian/Ubuntu release than they were prepared for.
Note1: This only applies if you want to use the same version as the version in the package repository. If you want a newer version, consult How to build Debian packages.
Note2: The steps below will rebuild Orocos for all targets in the repository, so lxrt, xenomai and gnulinux. If you care only for one of these targets, see also How to build Debian packages.
First, make sure you added this deb-src line to your sources.list file:
deb-src http://www.fmtc.be/debian etch main
sudo apt-get update apt-get source orocos-rtt sudo apt-get build-dep orocos-rtt sudo apt-get install devscripts build-essential fakeroot dpatch cd orocos-rtt-1.6.0 dpkg-buildpackage -rfakeroot -uc -us cd .. for i in *.deb; do sudo dpkg -i \$i; done
You can repeat the same process for orocos-ocl.
Outlines how to use CORBA to distribute applications. Differs by CORBA implementation and whether you are using DNS names or IP addresses. Examples below support the ACE/TAO and OmniORB CORBA implementations.
Sample system:
If you have working forward and reverse DNS entries (ie dig machine1.me.home returns 192.168.12.132, and dig -x 192.168.12.132 returns machine1.me.home)
machine1 \$ Naming_Service -m 0 -ORBListenEndpoints iiop://machine1.me.home:2809 \ -ORBDaemon & machine1 \$ export NameServiceIOR=corbaloc:iiop:machine1.me.home:2809/NameService machine1 \$ deployer-corba-gnulinux -s demo.xml machine2 \$ export NameServiceIOR=corbaloc:iiop:machine1.me.home:2809/NameService machine2 \$ ./demogui
OmniORB does not support the NameServiceIOR environment variable
machine1 \$ omniNames -start & machine1 \$ deployer-corba-gnulinux -s demo.xml machine2 \$ ./demogui -ORBInitRef NameService=corbaloc:iiop:machine1.me.home:2809/NameService
Note that if you swap which machines run the deployer and demogui, then change the above to
machine1 \$ omniNames -start & machine2 \$ deployer-corba-gnulinux -s demo.xml -- \ -ORBInitRef NameService=corbaloc:iiop:machine1.me.home:2809/NameService machine1 \$ ./demogui
If you don't have DNS or you must use IP addresses for some reason.
machine1 \$ Naming_Service -m 0 -ORBDottedDecimalAddresses 1 \ -ORBListenEndpoints iiop://192.168.12.132:2809 -ORBDaemon & machine1 \$ export NameServiceIOR=corbaloc:iiop:192.168.12.132:2809/NameService machine1 \$ deployer-corba-gnulinux -s demo.xml -- -ORBDottedDecimalAddresses 1 machine2 \$ export NameServiceIOR=corbaloc:iiop:192.168.12.132:2809/NameService machine2 \$ ./demogui -ORBDottedDecimalAddresses 1
For more information on the ORBListenEndPoints syntax and possibilities, see http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/TAO/docs/ORBEndpoint.html
machine1 \$ omniNames -start & machine1 \$ deployer-corba-gnulinux -s demo.xml machine2 \$ ./demogui -ORBInitRef NameService=corbaloc:iiop:192.168.12.132:2809/NameService
And the reverse
machine1 \$ omniNames -start & machine2 \$ deployer-corba-gnulinux -s demo.xml -- \ -ORBInitRef NameService=corbaloc:iiop:192.168.12.132:2809/NameService machine1 \$ ./demogui
Certain distro's and certain CORBA versions will exhibit problems even with localhost only scenarios (demonstrated with OmniORB under Ubuntu Jackaloupe). If you can not connect to the name service running on the same machine, substitue the primary network interface's IP address for localhost in any NameService value.
For example, instead of
machine1 \$ omniNames -start & machine2 \$ deployer-corba-gnulinux -s demo.xml
or even
machine1 \$ omniNames -start & machine2 \$ deployer-corba-gnulinux -s demo.xml -- \ -ORBInitRef NameService=corbaloc:iiop:localhost:2809/NameService
use
machine1 \$ omniNames -start & machine2 \$ deployer-corba-gnulinux -s demo.xml -- \ -ORBInitRef NameService=corbaloc:iiop:192.168.12.132:2809/NameService
NB as of RTT v1.8.2 and OmniORB v4.1.0, programs like demogui (which use RTT::ControlTaskProxy::InitOrb() to initialize CORBA) do not support -ORBDottedDecimalAddresses (in case you try to use it).
Computers that have multiple network interfaces present additional problems. The following is for omniORB (verified with a mix of v4.1.3 on Mac OS X, andv v4.1.1 on Ubuntu Hardy), for a system running a name server, a deployer, and a GUI. The example system has a 192.168.1.0 wired subnet and a 10.0.10.0 wireless subnet, and you have a mobile vehicle that has to communicate over the wireless subnet but it also has a wired interface.
The problem may appear as one of
The solution is to forcibly specify the endPoint parameter to the name server. In the omniorb.cfg file on the computer running the name server, add (for the example networks above)
endPoint = giop:tcp:10.0.10.14:
If the above still does not work, then set the endPoint parameter in all computer's config files (note that the end point is the IP adrs of each computer, so it will be (say) 10.0.10.14 for the computer running the name server and the deployer, and (say) 10.0.10.21 for the computer running the GUI). This will force everyone onto the wireless network, instead of relying on what the name server is publishing.
To debug this problem see the debugging section below, but after starting the name server you will see it output its published endpoints (right after the configuration dump). Also, if you get the lockup then adding the debug settings will cause the GUI or deployer to output each message and what direction/IP it is going on. If they have strayed on to the wired network it will be visibly obvious.
NB we found that the clientTransportRule and serverTransportRule parameters had no affect on this problem.
NB the above solution works now matter which computer the name server is running on (ie with the deployer, or with the GUI).
Add the following to the omniorb.cfg file
dumpConfiguration = 1 traceLevel = 25
ACE/TAO http://www.cs.wustl.edu/~schmidt/TAO.html
OmniORB http://omniorb.sourceforge.net/
For general installation instructions specific to each software version, see the top level wiki page for each project (eg. RTT, KDL, etc) and look for Installation in the left toolbar.
See below for specific additional instructions.
Installing via Macports on Mac OS X
To install from source on *NIX systems such as Linux and Mac OS X, see the installation page specific to your software version (e.g. v1.8 RTT).
To install from source on Windows, see the following wiki pages (also check the forums, a lot of good material is in there also).
The Orocos Real-Time Toolkit and Component Library have been prepared as Debian packages for Debian Etch. The pages
How to re-build Debian packages
contain instructions for building your own packages on other distributions, like Ubuntu.
Copy/paste the following commands, and enter your password when asked (only works in Ubuntu Feisty or later and Debian Etch or later):
wget -q -O - http://www.orocos.org/keys/psoetens.gpg | sudo apt-key add - sudo wget -q http://www.fmtc.be/debian/sources.list.d/fmtc.list -O /etc/apt/sources.list.d/fmtc.list
Next, for Debian Etch, type:
sudo apt-get update sudo apt-get install liborocos-rtt-corba-gnulinux1.8-dev
For your application development, you'll most likely use the Orocos Component library as well:
sudo apt-get install orocos-ocl-gnulinux1.8-dev orocos-ocl-gnulinux1.8-bin
We recommend using the pkg-config tool to discover the compilation flags required to compile your application with the RTT or OCL. This is described in the installation manual.
These are instructions to install the latest version of each of RTT, KDL, BFL and OCL, on Mac OS X using Macports.
Macports does not have official ports for these Orocos projects, however, the approach below is the recommended way to load unofficial ports in to Macports. [1]
These instructions use /opt/myports to hold the Orocos port files. You can substitute any other directory for MYPORTDIR (ie /opt/myports). Instructions are for bash shell - change appropriately for your own shell.
1. Download the Portfile files from this page's Attachments (at bottom of page).
2. Execute the following commands (substituting /opt/myports for the location you wish to store the Orocos port files, and ~/Downloads for the directory you downloaded the portfiles to)
export MYPORTDIR=/opt/myports export DOWNLOADDIR=~/Downloads mkdir \$MYPORTDIR cd \$MYPORTDIR mkdir devel cd devel mkdir orocos-rtt orocos-kdl orocos-bfl orocos-ocl cp \$DOWNLOADDIR/orocos-rtt-Portfile.txt orocos-rtt/Portfile cp \$DOWNLOADDIR/orocos-kdl-Portfile.txt orocos-kdl/Portfile cp \$DOWNLOADDIR/orocos-bfl-Portfile.txt orocos-bfl/Portfile cp \$DOWNLOADDIR/orocos-ocl-Portfile.txt orocos-ocl/Portfile
cd \$MYPORTDIR/devel mkdir orocos-rtt/files cp \$DOWNLOADDIR/rtt-patch-config-check_depend.cmake.diff orocos-rtt/files/patch-config-check_depend.cmake.diff
You should now have a tree that looks like
tree /opt/myports/ /opt/myports/ `-- devel |-- orocos-bfl | `-- Portfile |-- orocos-kdl | `-- Portfile |-- orocos-ocl | `-- Portfile `-- orocos-rtt |-- Portfile `-- files `-- patch-config-check_depend.cmake.diff
3. Edit /opt/local/etc/macports/sources.conf with superuser privileges (ie via sudo), and add the follwing line before the rsync:///rsync.macports.org/...' line.
# (substitute your ''MYPORTDIR'' value from above) file:///opt/myports
4. Execute these commands to tell Macports about your new ports.
cd \$MYPORTDIR sudo portindex
5. Now install each port with the following commands (the following commands add the optional CORBA support, via omniORB in Macports, as well as the helloworld and other useful parts of OCL)
sudo port install orocos-rtt +corba sudo port install orocos-kdl +corba sudo port install orocos-bfl sudo port install orocos-ocl +corba+deployment+motion_control+reporting+taskbrowser+helloworld
6. Verify installation by downloading test-macports.xml from this page's Attachments, and then using these commands
deployer-macosx -s /path/to/test-macports.xml
export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib
To build against MacPorts-installed Orocos, add the following to your environment before CMake'ing your project
export CMAKE_PREFIX_PATH=/opt/local
If you use Makefiles or autoconf to build your project, you'll need to tell those build systems to find Orocos headers, libraries and binaries under /opt/local. Instructions are not provided here for that.
To run using MacPorts-installed OROCOS, add the following to your environment
export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib:/opt/local/lib/rtt/macosx/plugins
(Not yet tested)
... sudo port uninstall orocos-rtt
Current limitations
dyld: Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/\ Frameworks/ImageIO.framework/Versions/A/ImageIO Expected in: /opt/local/lib/libJPEG.dylib
[1] Macports guide with detailed information on the port system.
[2] http://www.nabble.com/Incorrect-libjpeg.dylib-after-installing-ImageMagick-td22625866.html
Original bug report for this and accompanying forum entry
Attachment | Size |
---|---|
orocos-rtt-Portfile.txt | 1.82 KB |
orocos-kdl-Portfile.txt | 2.13 KB |
orocos-bfl-Portfile.txt | 1.36 KB |
orocos-ocl-Portfile.txt | 2.67 KB |
rtt-patch-config-check_depend.cmake_.diff | 607 bytes |
test-macports.xml | 472 bytes |
This page collects all the documentation users collected for building and using RTT on Windows. Note that Native Windows support is available from RTT 1.10.0 on, and that you might no longer need some of the proposed workarounds (such as using mingw or cygwin).
The recommended way of compiling the RTT on Windows is by using the Compiling on Windows with Visual Studio instructions.
This document is slightly outdated.
Using the info here: http://www.mingw.org/old/mingwfaq.shtml#faq-msvcdll
I managed to create DEF files, and use Microsofts LIB tool to turn the library it into something MSVC likes.
I'm no CMake expert, and don't have the time to learn **another** build scripting language, however I created the CMake files in the usual way, built RTT and ensure it compiled cleanly. I hacked the created makefiles by a search of my source tree for "--out-implib" and found that link.txt that lives in build\src\CMakeFiles\orocos-rtt-dynamic_win32.dir had that string in it. So I added the --output-def,..\..\libs\liborocos-rtt-win32.dll.def, to create the def file, and rebuilt RTT, this created the DEF file, I than ran it through the Microsoft LIB tool as described.
I then created a MSVC project, added the library to my linker settings, and made a very simply MSVC console application:
#include "rtt\os\main.h" #include "rtt\rtt-config.h" int ORO_main(int, char**) { return 0; }
I also needed to setup my MSVC preprocessor definitions:
NDEBUG
_CONSOLE
__i386__
__MINGW32__
OROCOS_TARGET=win32
Hopefully I am now at a stage when I can actually start to evaluate RTT :-) If anyone has any ideas on how to properly get the CMakeList.txt to generate the DEF files without nasty post-CMake hacks, then I would love to hear it...
This page summarizes how to compile RTT with Microsoft Visual Studio, using the native win32 api. RTT supports Windows out of the box from RTT 1.10.0 and 2.3.0 on. OCL is supported from 1.12.0 and 2.3.0 on.
This tutorial assumes you extracted the Orocos sources and all its dependencies in c:\orocos
For new users, RTT/OCL v2.3.x or later is recommended, included in the Orocos Toolchain v2.3.x.
We only support Visual Studio 2008 and 2005. Support for 2010 is on its way. You're invited to try VS2010 out and suggest patches to the orocos-dev mailing list.
Orocos does not come with a Visual Studio Solution. You need to generate one using the CMake tool which you can download from http://www.cmake.org. The most important step for CMake is to set the paths to where the dependencies of Orocos are installed. So before you can get to building Orocos, you need to build its dependencies, which don't use CMake, but their own build mechanism.
Only RTT and OCL of the toolchain are supported on Windows. The ruby based 'orogen' and 'typegen' tools, part of the toolchain, are not supported. Also ROS integration is not supported on Windows.
You must have this set as system environment variables:
set ACE_ROOT=c:\orocos\ACE_wrappers set TAO_ROOT=%ACE_ROOT%\tao set PATH=%PATH%;%ACE_ROOT%\bin;%ACE_ROOT%\lib
You can also set these using Configuration -> System -> Advanced -> Environment Variables
We recommend Boost 1.40.0 for Windows. Also, unzip Boost with 7Zip or similar, but not with the default Windows unzip program, which is extremely slow.
Make sure to install these components: program_options, thread, unit_test_framework, filesystem, system.
Also add the lib directory to your PATH system environment variable:
set PATH=%PATH%;c:\orocos\boost_1_40\lib
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "c:/orocos/boost_1_40;c:/orocos/ACE_wrappers;c:/orocos/ACE_wrappers/TAO;c:/orocos/ACE_wrappers/TAO/orbsvcs") set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "c:/orocos/boost_1_40/lib;c:/orocos/ACE_wrappers/lib")
set( OROCOS_TARGET win32 CACHE STRING "The Operating System target. One of [lxrt gnulinux xenomai macosx win32]")
Start the cmake-gui and set your source and build paths ( For example, c:\orocos\orocos-rtt-1.10.0 and c:\orocos\orocos-rtt-1.10.0\build ). Now click 'Configure' at the bottom. Check that there are no errors. If components are missing, you probably need to fix the above PATHs.
You probably need to click Configure again and then click 'Generate', which will generate your Visual Studio solution and project files in the 'build' directory.
Open the generated solution in MSVS and build the 'ALL_BUILD' target, which will build the RTT (and the unit tests if you enabled them).
The unit tests will fail if the required DLLs are not in your path. In your system settings, or on the command prompt of Windows, add c:\orocos\boost_1_40\lib and c:\orocos\ACE_wrappers\lib to your PATH environment (reboot if necessary).
Next, run a 'make install' and add the c:\orocos\bin directory to your PATH (or whatever you used as install path.) In RTT 2.3.0, the default install path is c:\Program Files\orocos (so add c:\Program Files\orocos\bin to PATH). It is recommended to keep this default, since OCL uses that too.
Now you should be able to run the unit tests. The process could be a bit streamlined more and may be improved in later releases.
There is a separate Wiki page for enabling Readline (tab-completion) in the TaskBrowser. See Taskbrowser with readline on Windows.
This page describes all steps you need to take in order to compile the real-time toolkit on a Windows machine. We rely on the Cygwin libraries and tools to accomplish this. Visual Studio or mingw32 are as of this writing not yet supported. Also CORBA is not yet ported.
cd orocos-rtt; patch -p1 < orocos-rtt-cygwin.patchThe patch can be found here: https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=605
cmake .. -DBOOST=/usr/include/boost-1_33_1 makeThis is a slow process. If you have multiple CPU cores, use 'make -j2' or -jN with N cores. In case you want to change more option, type 'ccmake ..' between the cmake and make commands.
export PATH=$PATH:`pwd`/src
|
Date | Time | Topic/Title & Mediator | Description |
---|---|---|---|
Mon 19/7 | 9h-13h | Big Picture Day Arriving at PAL offices |
Peter shows what 2.0 is and where it is heading |
13h-14h | Lunch | ||
14h-19h | Who're you + plans presentation | You made some Impress/Beamer slides and present your work + ideas for future work in < 10 slides. | |
20h | Dinner | Opening dinner sponsored by The SourceWorks | |
Tue 20/7 | 9h-13h | Typekit generation | Orogen + message generation.
YARP transport 2.0 (only ports, no methods, events, etc). Code explosion & extern template solution. |
13h-14h | Lunch | ||
14h - 19h | Component generation | Introduction.
What is its place in RTT? |
|
20h | Dinner | ||
Wed 21/7 | 9h-13h | Building | Fix up RTT/OCL cmake.
Structure of components, repositories and applications (graveyard/attic) |
13h-14h | Lunch | ||
14h-16h | Documentation improvement | Structure. Website
Missing part. Real examples and tutorials Examples. Restructure. Success stories, who uses |
|
16h | Visiting | ||
20h | Dinner | ||
Thu 22/7 | 9h-13h | Logging | Current status.
Fix architecture. RTT::Logger remove/replace |
13h-14h | Lunch | ||
14h-16h | Reporting | ||
16h-19h | Upgrading from v1 to v2 | Describe rtt v2 converter. Caveat document. Try out on user systems. | |
20h | Dinner | Closing dinner sponsored by The SourceWorks | |
Fri 23/7 | 9h-13h | Wrapping-up Day | Finishing loose ends, integration and discussions for future work |
13h-14h | Lunch | ||
14h-17h | Wrapping-up Day | Finishing loose ends, integration and discussions for future work |
If you need or want to provide sponsorship, contact Peter.
Peter started to present the 2.x functionality, state and (from its point of view), shortcomings. The following are the points that have been risen during the discussion.
Properties and attributes
Ports
Methods / Operations / Services
Misc
Plugins
Code size
Events
end
The discussions starts with explaining the improved TypeInfo infrastructure:
ROS messages and orogen
Sylvain explains how orogen works
Sylvain shows how orogen requires the #ifndef __orogen in the headers listed. gccxml is a fix for this too.
Hosting on gitorious is being discussed. It allows us to group code in 'projects' and collaborate better using git.
Autoproj is discussed as a tool to bootstrap the orocos packages. It's an alternative to manually download and build everything. It may work in parallel with rosbuild, in case application software depends on both ros and orocos. This needs to be tested.
The work is divided for the rest of the day:
We decided to rename orogen to typegen
The day concluded with investigating the code size/compile time issue. The culprits are the operations added to the ports in the typekit code. We investigated several solutions to tackle this, especially in the light of code/typekit generation.
The day started with a re-evaluation of the agenda and release timelines. The proposed release date for 2.0 was august 16th.
This list of topics will be covered this week:
This list of issues will be solved before 2.0.0:
These issues will be delayed after 2.0.0:
The rest of the day continued as planned on the agenda. In the morning, a new CMake build system for components, plugins and executables was created to maximize maintainability and ease-of-use of creating new Orocos software. OCL too will switch to this system. The interface (CMake macros) and logic behind it was discussed. This tool will be further developed to be ready before the 2.0 release.
In the afternoon, the documentation and website structure was discussed. We came to the conclusion that no-one only downloads the RTT. For 2.0, they will download, RTT, the infrastructure components (TaskBrowser, Deployment, Reporting, Diagnostics etc) and the tool-chain (typekit generation, component generation etc.). This will require a restructuring of the website and the documentation, to no longer be RTT-centric, but to be 'Orocos ecosystem' centric.
The documentation will contain 3 pillars:
The reference manuals will be cleaned up too, such that they suit better 'for reference' and less serve as 'first read for new users'.
During this day, the code size problem, typegen development and Yarp transport were also further polished.
It ended with a visit to 'Parc Guell' and a walk to the old city centre, where we enjoyed a well deserved tapas meal.
This page describes the steps to take in order to compile the real-time toolkit (RTT) on a Windows machine, under MinGW and pthreads-32.
The following has been tested on Windows XP, running in a virtual machine on Mac OS X Leopard.
Warning: the default GCC 3.4.5 compiler in MinGW outputs a lot of warnings when compiling RTT. Mostly they are "foo might be used uninitialized in this function" in STL code.
See detailed instructions in URL's above and below, but basically (unless otherwise noted, all actions are in MSys Unix shell, and, all unix-built items are installed in /mingw (which is c:\msys\1.0\mingw in DOS prompt) )
cmake-xxx/bootstrap --prefix=/mingw --no-qt-gui make && make installRun pthreads32 installer (just untar's)
- manually copy pre-built/include/* to /c/mingw/include (C:\mingw/include) - manually copy pre-built/lib/*GC2* to /c/mingw/lib (C:\mingw/lib) - to run pthreads tests, need to copy prebuilt .a/.dll into .. dir, and copy queueuserapcex to ../..Boost (as at 2009-Jan, use v1.35 not v1.37 until we fix RTT for v1.37)
*** DOS shell *** cd boost-jam-xxx .\build.bat gcc ** won't build in unix shell with build.sh ** *** unix shell *** cd boost-jam-xxx cp binntx86/bjame.exe /mingw/bin cd ~/software/build/boost_1_35 bjam --toolset=gcc --layout=system --prefix=/mingw --with-date_time --with-graph \ --with-system --with-function_types --with-program_options installCppunit, get tarball from sourceforge
untar and configure with --prefix=/mingw correct line 7528 in libtool, to be c:/MinGW/bin../lib/dllcrt2.o for first item make && make install
cd /path/to/rtt; patch -p0 < patch-rtt-mingw-1.patch
download, follow MinGW build instructions on the website. add "#undef ACE_LACKS_USECONDS_T" to ace/config-win32-mingw.h" before compiling copy ace/libACE.dll to /mingw/lib make TAO ** this fails You can build all we need by manually doing ''make'' in the following directories. Note that the last couple of TAO dir's have problems. ace, ace/protocols, kokyu, tao, tao/TAO_IDL, tao/orbsvcsNB Can parallel build ace but not its tests nor tao.
NB Not all tests pass. At least one of the ACE tests fail.
Stephen gives an overview of the current log4cpp + Orocos architecture and how he accomplished real-time logging. Log4cpp supports
Orocos supports
Decisions for v2.0
v2.2 or later
It's hacking day and implementing/finishing most of what we started this week.
This Chapter collects all information about the migration to RTT 2.0. Nothing here is final, it's a scratch book to get us there. There are talk pages to discuss the contents of these pages.
These are the major work areas:
If you want to contribute, you can post your comments in the following wiki pages. It will be (hopefully) more concise and straightforward compared with the developers Forum.
These items are worked out on separate Wiki pages.
RTT and OCL 2.0 have been merged on the master branches of all official git repositories:
Stable releases are on different branches, for example toolchain-2.0:
The sections below formulate the major goals which RTT 2.0 wishes to attain.
The input/output is offered by means of port based communication between data processing algorithms. An input port receives data, an output port sends data. The algorithms in the component define the transformation from input to output.
Service based communication offers operations such as configuration or task execution. A component always specifies if a service is provided or requested. This allows run-time dependency and system state checking, but also automatic connection/disconnection management which is important in distributed environments.
Components are stateful. They don't just start processing data right away. They can validate their preconditions, be queried for their current state and be started and stopped in a controlled manner. Although there is a standard state machine in each component that regulates these transitions, users can extend these without limitations.
INTRODUCTION
You can edit this page to post your contribution to OrocosRTT 2.0. Please, keep your comment concise and clear: if you want to launch a long debate, you can still use the Developers Forum! Short examples can help other people understanding what you mean.
Because of single thread serialization, something unexpected for the programmer happens.
1) You expect TaskA to be independent from TaskB, but it isn't. If you think it is a problem of resources of the computer, change the activity frequency of 1 of the two tasks.
Suggestion: A) let the programmer choose if single thread serialization is used or not. B) keep 1 thread for 1 activity policy for default. It will help less experienced user to avoid common errors. Experienced user can decide to "unleash" the power of STS if they want to.
2) after the "block" for 0.5 seconds, the "lost cycles" are executed all at once. In other words, updateHook is called 5 times in a row. This may have very umpredictable results. It could be desirable for some applications (filter with data buffer) or catastrophic in other applications (motion control loop).
Suggestion: C) let the user decide if the "lost cycles" or the PeriodicActivity need to be executed later or are defenitively lost.
using namespace std; using namespace RTT; using namespace Orocos; TimeService::ticks _timestamp; double getTime() { return TimeService::Instance()->getSeconds(_timestamp); } class TaskA : public TaskContext { protected: PeriodicActivity act1; public: TaskA(std::string name) : TaskContext(name), act1(1, 0.10, this->engine() ) { //Start the component's activity: this->start(); } void updateHook() { printf("TaskA [%.2f] Loop\n", getTime()); } }; class TaskB : public TaskContext { protected: int num_cycles; PeriodicActivity act2; public: TaskB(std::string name) : TaskContext(name), act2(2, 0.10, this->engine() ) { num_cycles = 0; //Start the component's activity: this->start(); } void updateHook() { num_cycles++; printf("TaskB [%.2f] Loop\n", getTime()); // once every 20 cycles (2 seconds), a long calculation is done if(num_cycles%20 == 0) { printf("TaskB [%.2f] before calling long calculation\n", getTime()); // calculation takes longer than expected (0.5 seconds). // it could be something "unexpected", desired or even a bug... // it would not be relevant for this example. for(int i=0; i<500; i++) usleep(1000); printf("TaskB [%.2f] after calling long calculation\n", getTime()); } } }; int ORO_main(int argc, char** argv) { TaskA tA("TaskA"); TaskB tB("TaskB"); // notice: the task has not been connected. there isn't any relationship between them. // In the mind of the programmer, any of them is independent, because they have their own activity. // if one of the two frequency of the PeriodicActivities is changed, there isn't any problem, since they go on 2 separate threads. getchar(); return 0; }
INTRODUCTION
Please be concise and provide a short example and your motivation to include it in RTT. Ask first yourself:
If you answered "no" to both the questions and you have already debated the new future in the Developers forum, please post here your suggestion.
In order to lower the learning curve, people are requesting often complete application examples which demonstrate well known application architectures such as kinematic robot control, application configuration from a central database or topic based data flow topologies.
1 Central Property Service (ROS like) This tasks sets up components such that they get the system wide configuration from a dedicated property server. The property server loads an XML file with all the values and other components query these values. Advanced components even extend the property server at places. A GUI is not included in this work package.
2 Universal Robot Controller (Using KDL, OCL, standard components) This application has a robot component to represent the robot hardware, a controller for joint space and cartesian space and a path planner. Users can start from this reference application to control their own robotic platform. A GUI is not included in this work package.
3 Topic based data flow (ROS and CORBA EventService like) A deployer can configure components as such that their ports are connected to 'global' topics for sending and receiving. This is similar to what many existing frameworks do today and may demonstrate how compatibility with these frameworks can be accomplished.
4 GUI communication with Orocos How a remote GUI could connect to a running application.
Please add yours
These pages outline the roadmap for RTT-2.0 in 2009. We aim to have a release candidate by december 2009, with the release following in januari 2010.
This work package contains structural clean-ups for the RTT source code, such as CMake build system, portability and making the public interface slimmer and explicit. RTT 2.0 is an ideal mark point for doing such changes. Most of these reorganizations have broad support from the community. This package is put up front because it allows early adopters to switch only at the beginning to the new code structure and that all subsequent packages are executed in the new structure.
Links : (various posts on Orocos mailing lists)
Allocated Work : 15 days
Tasks:
1.1 Partition in name spaces and hide internal classes in subdirectories.
A namespace and directory partitioning will once and for all separate public RTT API from internal headers. This will provide a drastically reduced class count for users, while allowing developers to narrow backwards compatibility to only these classes. This offers also the opportunity to remove classes that are for internal use only but are in fact never used.
Deliverable | Title | Form |
1.1.1 | Internal headers are in subdirectories | Patch set |
1.1.2 | Internal classes are in nested namespaces of the RTT namespace | Patch set |
1.2 Improve CMake build system
Numerous suggestions have been done on the mailing list for improving portability and building Orocos on non standard platforms.
Deliverable | Title | Form |
1.2.1 | Standardized on CMake 2.6 | Patch set |
1.2.2 | Use CMake lists instead of strings | Patch set |
1.2.3 | No more use of Linux specific include paths | Patch set |
1.2.4 | Separate finding from using libraries for all RTT dependencies | Patch set |
1.3 Group user contributed code in rtt/extras.
This directory offers variants of implementations found in the RTT, such as new data type support, specialized activity classes etc. In order not to clutter up the standard RTT API, these contributions are organized in a separate directory. Users are warned that these extras might not be of the same quality as native RTT classes.
Deliverable | Title | Form |
1.3.1 | Orocos rtt-extras directory | Directory in RTT |
1.4 Improve portability
Some GNU/GCC/Linux specific constructs have entered the source code, which makes maintenance on and portability to other platforms a harder task. To structurally support other platforms, the code will be compiled with another compiler (non-gnu) and a build flag ORO_NO_ATOMICS (or similar) is added to exclude all compiler and assembler specific code and replace it with ISO-C/C++ or RTT-FOSI compliant constructs.
Deliverable | Title | Form |
1.4.1 | Code compiles on non-gnu compiler | Patch set |
1.4.2 | Code compiles without assembler constructs | Patch set |
1.5 Default to activity with one thread per component
The idea is to provide each component with a robust default activity object which maps to exactly one thread. This thread can periodically execute or be non periodic. The user can switch between these modes at configuration or run-time.
Deliverable | Title | Form |
1.5.1 | Generic Activity class which is by default present in every component. | Patch set |
1.5.2 | Unit test for this class | Patch set |
1.6 Standardize on Boost Unit Testing Framework
Before the other work packages are started, the RTT must standardize on a unit test framework. Until now, this is the CppUnit framework. The more portable and configurable Boost UTF has been chosen for unit testing of RTT 2.0.
Deliverable | Title | Form |
1.6.1 | CppUnit removed and Boost UTF in place | Patch set |
1.7 Provide CMake macros for applications and components
When users want to build Orocos components or applications, they require flags and settings from the installed RTT and OCL libraries. A CMake macro which gathers these flags for compiling an Orocos component or application is provided. This is inspired on how ROS components are compiled.
Deliverable | Title | Form |
1.7.1 | CMake macro | CMake macro file |
1.7.2 | Unit test that tests this macro | Patch set |
1.8 Allow lock-free policies to be configured
Some RTT classes use hard-coded lock-free algorithms, which may be in the way (due to resource restrictions) for some embedded systems. It should be possible to change the policy to not use a lock-free algorithm in that class (cfr the 'strategy' design pattern'). An example is the use of AtomicQueue in the CommandProcessor.
Deliverable | Title | Form |
1.8.1 | Allow to set/override lock-free algorithm policy | patch |
This page collects all the data and links used to improve the CMake build system, such that you can find quick links inhere instead of scrolling through the forum.
Thread on Orocos-dev : http://www.orocos.org/node/1073 (in case you like to scroll)
CMake manual on how to use and create Findxyz macros : http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries
List of many alternative modules : http://zi.fi/cmake/Modules/
An alternative solution for users of RTT and OCL is installing the Orocos-RTT-target-config.cmake macros, which serve a similar purpose as the pkgconfig .pc files: they accumulate the flags used to build the library. This may be a solution for Windows systems. Also, CMake suggests that .pc files are only 'suggestive' and that still the standard CMake macros must be used to fully capture and store all information of the dependency you're looking at.
The orocos/src directory reflects the /usr/include/rtt directory structure, I'll post it here from the user's point of view, so what she finds in the include dir:
Abbrevs: (N)BC: (No) Backwards Compatibility guaranteed between 2.x.0 and 2.y.0. Backwards compatibility is always guaranteed between 2.x.y and 2.x.z. In case of NBC, a class might disappear or change, as long as it is not a base class of a BC qualified class.
Directory | Namespace | BC/NBC | Comments | Header File list |
---|---|---|---|---|
rtt/*.hpp | RTT | BC | Public API: maintains BC, a limited set of classes and interfaces. This is the most important list to get right. A header not listed in here goes into one of the subdirectories. Please add/complete/remove. | TaskContext.hpp Activity.hpp SequentialActivity.hpp SlaveActivity.hpp DataPort.hpp BufferPort.hpp Method.hpp Command.hpp Event.hpp Property.hpp PropertyBag.hpp Attribute.hpp Time.hpp Timer.hpp Logger.hpp |
rtt/plugin/*.hpp | RTT::plugin | BC | All plugin creation and loading stuff. | Plugin.hpp |
rtt/types/*.hpp | RTT::types | BC | All type system stuff (depends partially on plugin). Everything you (or a tool) need(s) to add your own types to the RTT. | Toolkit.hpp ToolkitPlugin.hpp Types.hpp TypeInfo.hpp TypeInfoName.hpp TypeStream.hpp TypeStream-io.hpp VectorComposition.hpp TemplateTypeInfo.hpp Operators.hpp OperatorTypes.hpp BuildType.hpp |
rtt/interface/*.hpp | RTT::interface | BC | Most interfaces/base classes used by classes in the RTT namespace. | ActionInterface.hpp, ActivityInterface.hpp, OperationInterface.hpp, PortInterface.hpp, RunnableInterface.hpp, BufferInterface.hpp |
rtt/internal/*.hpp | RTT::internal | NBC | Supportive classes that don't fit another category but are definately not for users to use directly. | ExecutionEngine.hpp CommandProcessor.hpp DataSource*.hpp Command*.hpp Buffer*.hpp Function*.hpp *Factory*.hpp Condition*.hpp Local*.hpp EventC.hpp MethodC.hpp CommandC.hpp |
rtt/scripting/*.hpp | RTT::scripting | NBC | Users should not include these directly. | |
rtt/extras/*.hpp | RTT::extras | BC | Alternative implementations of certain interfaces in the RTT namespace. May contain stuff useful for embedded or other specific use cases. | |
rtt/dev/*.hpp | RTT::dev | BC | Minimal Device Interface, As-is in RTT 1.x | AnalogInInterface.hpp AnalogOutInterface.hpp AxisInterface.hpp DeviceInterface.hpp DigitalInput.hpp DigitalOutput.hpp EncoderInterface.hpp PulseTrainGeneratorInterface.hpp AnalogInput.hpp AnalogOutput.hpp CalibrationInterface.hpp DigitalInInterface.hpp DigitalOutInterface.hpp DriveInterface.hpp HomingInterface.hpp SensorInterface.hpp |
rtt/corba/*.hpp | RTT::corba | BC | CORBA transport files. Users include some headers, some not. Should this also have the separation between rtt/corba and rtt/corba/internal ? I would rename the IDL modules to RTT::corbaidl in order to clear out compiler/doxygen confusion. Also note that current 1.x namespace is RTT::Corba. | |
rtt/property/*.hpp | RTT::property | BC | Formerly 'rtt/marsh'. Marshalling and loading classes for properties. | CPFDemarshaller.hpp CPFDTD.hpp CPFMarshaller.hpp |
rtt/dlib/*.hpp | RTT::dlib | BC | As-is static distribution library files. They are actually a form of 'extras'. Maybe they belong in there... | DLibCommand.hpp |
rtt/boost/*.hpp | boost | ? | We'll try to get rid of this in 2.x | |
rtt/os/*.hpp | RTT::OS | BC | As-is. (Rename to RTT::os ?) | Atomic.hpp fosi_internal_interface.hpp MutexLock.hpp rt_list.hpp StartStopManager.hpp threads.hpp CAS.hpp MainThread.hpp oro_allocator.hpp rtconversions.hpp rtstreambufs.hpp Semaphore.hpp Thread.hpp Time.hpp fosi_internal.hpp Mutex.hpp OS.hpp rtctype.hpp rtstreams.hpp ThreadInterface.hpp |
rtt/targets/* | - | BC | We need this for allowing to install multiple -dev versions (-gnulinux+-xenomai for example) in the same directory. | rtt-target.h <target> |
Will go: 'rtt/impl' and 'rtt/boost'.
Open question to be answered: Interfaces like ActivityInterface, PortInterface, RunnableInterface etc. -> Do they go into rtt/, rtt/internal or maybe rtt/interface ?
!!! PLEASE add a LOG MESSAGE when you edit this wiki to motivate your edit !!!
Context: Because the current data flow communication primitives in RTT limit the reusability and potential implementations, Sylvan Joyeux proposed a new, but fairly compatible, design. It is intended that this new implementation can almost transparently replace the current code base. Additionally, this package extends the DataFlow transport to support out-of-band real-time communication using Xenomai IPC primitives.
Link : http://www.orocos.org/wiki/rtt/rtt-2.0/dataflow http://www.orocos.org/wiki/rtt/rtt-2.0/dataflow
Estimated work : 45 days for a demonstrable prototype.
Tasks:
2.1 Review and merge proposed code and improve/fix where necessary
Sylvain's code is clean and of high standards, however, it has not been unit tested yet and needs a second look.
Deliverable | Title | Form |
2.1.1 | Code reviewed and imported in RTT-2.0 branch | Patch set |
2.1.2 | Unit tests for reading, writing, connecting and disconnecting in-process communication | Patch set |
2.2 Port CORBA type transport to new code base
Sylvain's code has initial CORBA support. The plan is to cooperate on the implementation and offer the same or better features as the current CORBA implementation does. Also the DataFlowInterface.idl will be cleaned up to reflect the new semantics.
Deliverable | Title | Form |
2.2.1 | CORBA enabled data flow between proxies and servers which uses the RTT type system merged on RTT-2.0 branch | Patch set |
A disadvantage of the current data port is that ports connected over CORBA may cause stalls when reading or writing them. The Proxy or Server implementation should, if possible, do the communication in the background and not let the other component's task block.
Deliverable | Title | Form |
2.3.1 | Event driven network-thread allocated in Proxy code to receive and send data flow samples | Patch set |
The current lock-free data connections allocate memory for allowing access by 16 threads, even if only two threads connect. One solution is to let the allocated memory grow with the number of connections, such that no more memory is allocated than necessary.
Deliverable | Title | Form |
2.4.1 | Let lock-free data object and buffer memory grow proportional to connected ports | Patch set |
It is often argued that CORBA is excellent for setting up and configuring services, but not for continuous data transmission. There are for example CORBA standards that only mediate setup interfaces but leave the data communication connections up to the implementation. This task looks at how ROS and other frameworks set up out-of band data flow and how such a client-server architecture can be added to RTT/CORBA.
Deliverable | Title | Form |
2.5.1 | Report on out of band implementations and similarities to RTT. | Email on Orocos-dev |
Since the out-of-band communication will require objects to be transformed to a byte stream and back, a marshalling system must be in place. The idea is to let the user specify his data types as IDL structs (or equivalent) and to generate a toolkit from that definition. The toolkit will re-use the generated CORBA marshalling/demarshalling code to provide this service to the out-of-band communication channels.
Deliverable | Title | Form |
2.6.1 | Marshalling/demarshalling in toolkits | Patch set |
2.6.2 | Tool to convert data specification into toolkit | Executable |
The first communication mechanism to support is data flow. This will be demonstrated with a Xenomai RTPIPE implementation (or equivalent) which is setup between a network of components.
Deliverable | Title | Form |
2.7.1 | Real-time inter-process communication of data flow values on Xenomai | Patch set |
2.7.2 | Unit test for setting up, connecting and validating Real-Time properties of data ports in RT IPC setting. | Patch set |
In compliance with modern programming art, the unit tests should always test and pass the implementation. Documentation and Examples are provided for the users and complement the unit tests.
Deliverable | Title | Form |
2.8.1 | Unit tests updated | Patch set |
2.8.2 | rtt-examples, rtt-exercises updated | Patch set |
2.8.3 | orocos-corba manual updated | Patch set |
2.9 Organize and Port OCL deployment, reporting and taskbrowsing
RTT 2.0 data ports will require a coordinated action from all OCL component maintainers to port and test the components to OCL 2.0 in order to use the new data ports. This work package is only concerned with the upgrading of the Deployment, Reporting and TaskBrowser components.
Deliverable | Title | Form |
2.9.1 | Deployment, Reporting and TaskBrowser updated | Patch set |
Context: Commands are too complex for both users and framework/transport implementers. However, current day-to-day use confirms the usability of an asynchronous and thread-safe messaging mechanism. It was proposed to reduce the command API to a message API and unify the synchronous / asynchronous relation between methods and messages with synchronous / asynchronous events. This will lead to simpler implementations, simpler usage scenarios and reduced concepts in the RTT.
The registration and connection API of these primitives also falls under this WP.
Link: http://www.orocos.org/wiki/rtt/rtt-2.0/executionflow
Estimated work : 55 days for a demonstrable prototype.
Tasks:
3.1 Provide a real-time memory allocator for messages
In contrast to commands, each message invocation leads to a new message sent to the receiver. This requires heap management from a real-time memory allocator, such as the highly recommended TLSF (Two-Level Segregate Fit) allocator, which must be integrated in the RTT code base. If the RTOS provides, the native RTOS memory allocator is used, such as in Xenomai.
Deliverable | Title | Form |
3.1.1 | Real-time allocation integrated in RTT-2.0 | Patch set |
3.2 Message implementation
Unit test and implement the new Message API for use in C++ and scripts. This implies a MessageProcessor (replaces CommandProcessor), a 'messages()' interface and using it in scripting.
Deliverable | Title | Form |
3.2.1 | Message implementation for C++ | Patch set |
3.2.2 | Message implementation for Scripting | Patch set |
3.3 Demote the Command implementation
Commands (as they are now) become second rang because they don't appear in the interface anymore, being replaced by messages. Users may still build Command objects at the client side both in C++ as in scripting. The need for and the plausibility of identical functionality with today's Command objects is yet to be investigated.
Deliverable | Title | Form |
3.3.1 | Client side C++ Command construction | Patch set |
3.3.2 | Client side scripting command creation | Patch set |
3.4 Unify the C++ Event API with Method/Message semantics
Events today duplicate much of method/command functionality, because they also allow synchronous / asynchronous communication between components. It is the intention to replace much of the implementation with interfaces to methods and messages and let events cause Methods to be called or Messages to be sent. This change will remove the EventProcessor, which will be replaced by the MessageProcessor. This will greatly simplify the event API and semantics for new users. Another change is that allowing calling Events on the component's interface can only be done by means of registering it as a method or message.
Deliverable | Title | Form |
3.4.1 | Connection of only Method/Message objects to events | Patch set |
3.4.2 | Adding events as methods or messages to the TaskContext interface. | Patch set |
3.5 Allow event delivery policies
Adding a callback to an event puts a burden on the event emitter. The owner of the event must be allowed to impose a policy on the event such that this burden can be bounded. One such policy can be that all callbacks must be executed outside the thread of the owning component. This task is to extend the RTT such that it contains such a policy.
Deliverable | Title | Form |
3.5.1 | Allow to set the event delivery policy for each component | Patch set |
3.6 Allow to specify requires interfaces
Today one can connect data ports automatically because both providing and requiring data is presented in the interface. This is not so for methods, messages or events. This task makes it possible to describe which of these primitives a component requires from a peer such that they can be automatically connected during application deployment. The required primitives are grouped in interfaces, such that they can be connected as a group from provider to requirer.
Deliverable | Title | Form |
3.6.1 | Mechanism to list the requires interface of a component | Patch set |
3.6.2 | Feature to connect interfaces in deployment component. | Patch set |
3.7 Improve and create Method/Message CORBA API
With the experience of the RTT 1.0 IDL API, the existing API is improved to reduce the danger of memory leaks and allow easier access to Orocos components when using only the CORBA IDL. The idea is to remove the Method and Command interfaces and change the create methods in CommandInterface and MethodInterface to execute functions.
Deliverable | Title | Form |
3.7.1 | Simplify CORBA API | Patch set |
3.8 Port new Event mechanism to CORBA
Since the new Event mechanism will seamlessly integrate with the Method/Message API, a CORBA port, which allows remote components to subscribe to component events must be straightforward to make.
Deliverable | Title | Form |
3.8.1 | CORBA idl and implementation for using events. | Patch set |
3.9 Update documentation, unit tests and Examples
In compliance with modern programming art, the unit tests should always test and pass the implementation. Documentation and Examples are provided for the users and complement the unit tests.
Deliverable | Title | Form |
3.9.1 | Unit tests updated | Patch set |
3.9.2 | rtt-examples, rtt-exercises updated | Patch set |
3.9.3 | Orocos component builders manual updated | Patch set |
3.10 Organize and Port OCL deployment, taskbrowsing
The new RTT 2.0 execution API will require a coordinated action from all OCL component maintainers to port and test the components to OCL 2.0 in order to use the new primitives. This work package is only concerned with the upgrading of the Deployment, Reporting and TaskBrowser components.
Deliverable | Title | Form |
3.10.1 | Deployment, Reporting and TaskBrowser updated | Patch set |
In order to lower the learning curve, people are requesting often complete application examples which demonstrate well known application architectures such as kinematic robot control. This work package fleshes out that example.
Links : (various posts on Orocos mailing lists)
Estimated Work : 5 days for the application architecture with documentation
Tasks:
4.1 Universal Robot Controller (Using KDL, OCL, standard components)
This application has a robot component to represent the robot hardware, a controller for joint space and cartesian space and a path planner. Users can start from this reference application to control their own robotic platform. Both axes and end effector can be controlled in position and velocity mode. A state machine switches between these modes. A GUI is not included in this work package.
Deliverable | Title | Form |
4.1.1 | Robot Controller example | tar ball |
There are two major changes required in the CORBA IDL interface.
The first point will be relatively straight forward, as events attach methods and messages, which will be represented in the CORBA interface as well.
The DataFlowInterface will be adapted to reflect the rework on the new Data flow api. Much will depend on the out-of-band or through-CORBA nature of the data flow.
The MethodInterface should no longer work with 'session' objects, and all calls are related to the main interface, such that a method object can be freed after invocation.
The CommandInterface might be removed, in case it can be 'reconstructed' from lower level primitives. A MessageInterface will replace it which allows to send messages, analogous to the exiting MethodInterface.
The 'ControlTask' interface will remain mostly as is, extended with events() and messages().
This page is for helping you understand what's in RTT/OCL 2.0.0-beta1 release and what's not.
For all upgrade-related notes, see Upgrading from RTT 1.x to 2.0
88% tests passed, 3 tests failed out of 25 The following tests FAILED: 6 - mqueue-test (Failed) 19 - types_test (Failed) 22 - function_test (Failed)
For each type to be transported using the MQueue transport, a separate transport typekit must be available (this may change in the final 2.0 release).
Method<bool(int,int)> setreso; setreso = this->getPeer("Camera")->getMethod<bool(int,int)>("setResolution"); if ( setreso.ready() == false ) log(Error) << "Could not find setResolution Method." <<endlog(); else setreso(640,480);
Method<bool(int,int)> setreso("setResolution"); this->requires("Camera")->addMethod(mymethod); // Deployment component will setup setResolution for us... setreso(640,480);
This page is for helping you understand what's in RTT/OCL 2.0.0-beta2 release and what's not.
See the RTT 2.0.0-beta1 page for the notes of the previous beta, these will not be repeated here.
For all upgrade-related notes, see Upgrading from RTT 1.x to 2.0
97% tests passed, 1 tests failed out of 31 The following tests FAILED: 24 - types_test (Failed)
This work package claims all remaining proposed clean-ups for the RTT source code. RTT 2.0 is an ideal mark point for doing such changes. Most of these reorganizations have broad support from the community.
1 Partition in name spaces and hide internal classes in subdirectories. A namespace and directory partitioning will once and for all separate public RTT API from internal headers. This will provide a drastically reduced class count for users, while allowing developers to narrow backwards compatibility to only these classes. This offers also the opportunity to remove classes that are for internal use only but are in fact never used.
2 Improve CMake build system Numerous suggestions have been done on the mailing list for improving portability and building Orocos on non standard platforms.
3 Group user contributed code in rtt-extras and ocl-extras packages. These packages offer variants of implementations found in the RTT and OCL, such as new data type support, specialized activity classes etc. In order not to clutter up the standard RTT and OCL APIs, these contributions are organized in separate packages. Other users are warned that these extras might not be of the same quality as native RTT and OCL classes.
Recent ML posts indicate the desire for a real-time (RT) capable logging framework, to supplement/replace the existing non-RT RTT::Logger. See http://www.orocos.org/forum/rtt/rtt-dev/logging-replacement for details.
NB Work in progress. Feedback welcomed
See https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=708 for progress and patches.
0) Completely disable all logging
1) Able log variable sized string messages
2) Able log from non-realtime and realtime code
3) Minimize (as reasonably practicable) the effect on runtime performance (eg minimize CPU cycles consumed)
4) Support different log levels
5) Support different "storage mediums" (ie able to log messages to file, to socket, to stdout)
Except for 3, and the "realtime" part of 2, the above is the functionality of the existing RTT::Logger
6) Support different log levels within a deployed system (ie able to log debug in one area, and info in another)
7) Support multiple storage mediums simultaneously at runtime
8) Runtime configuration of storage mediums and logging levels
9) Allow the user to extend the possible storage mediums at deployment-time (ie user can provide new storage class)
Optional IMHO
10) Support nested diagnostic contexts [1] [2] (a more advanced version of the Logger::In() that RTT's logger currently supports)
I prefer 3) as it has the basic functionality we need, is license compatible, has a good design, and we've been offered developer access to modify it. I also think modifying a slightly less-well-known framework will be easier than getting some of our mod's in to log4cxx.
NOTE on the ML I was using the logback term logger, but log4cpp calls it a category. I am switching to category from now on!
Add TLSF to RTT (a separate topic).
Fundamentally, replace std::string, wrap one class, and override two functions. :-)
Typedef/template in a real-time string to the logging framework, instead of std::string (also any std::map, etc).
Create an OCL::Category class derived from log4cpp::Category. Add an (optionally null) association to an RTT::BufferDataPort< log4cpp::LoggingEvent > (which uses rt_strings internally). Override the callAppenders() function to push to the port instead of directly calling appenders.
Modify the getCategory() function in the hierarchy maintainer to return our OCL:: Category instead of log4cpp::category. Alternatively, leave it producing log4cpp::category but contain that within the OCL::Category object (has-a instead of is-a relationship, in OO speak). The alternative is less modification to log4cpp, but worse performance and potentially more wrapping code.
I have a working prototype of the OCL deployment for this (without the actual logging though), and it is really ugly. As in Really Ugly! To simplify the format and number of files involved, and reduce duplication, I suggest extending the OCL deployer to better support logging.
Sample system
Component C1 - uses category org.me.myapp Component C2 - uses category org.me.myapp.c2 Appender A - console Appender B - file Appender C - serial Logger org.me.myapp has level=info and appender A Logger org.me.myapp.C2 has level=debug and appenders B, C
Configuration file for log4cpp
log4j.logger.org.me.myapp=info, AppA log4j.logger.org.me.myapp.C2=debug, AppB, AppC log4j.appender.AppA=org.apache.log4j.ConsoleAppender log4j.appender.AppB=org.apache.log4j.FileAppender log4j.appender.AppC=org.apache.log4j.SerialAppender # AppA uses PatternLayout. log4j.appender.AppA.layout=org.apache.log4j.PatternLayout log4j.appender.AppA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n # AppB uses SimpleLayout. log4j.appender.AppB.layout=org.apache.log4j.SimpleLayout # AppC uses PatternLayout with a different pattern from AppA log4j.appender.AppC.layout=org.apache.log4j.PatternLayout log4j.appender.AppC.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
File: AppDeployer.xml
<struct name="ComponentC1" ... /> <struct name="ComponentC2" ... /> <struct name="AppenderA" type="ocl::ConsoleAppender"> <simple name="PropertyFile" ...><value>AppAConfig.cpf</value></simple> <struct name="Peers"> <simple>Logger</simple> </struct> <struct name="AppenderB" type="ocl::FileAppender"> <simple name="PropertyFile" ... /> <struct name="Peers"> <simple>Logger</simple> </struct> <struct name="AppenderC" type="ocl::SerialAppender"> <simple name="PropertyFile" ... /> <struct name="Peers"> <simple>Logger</simple> </struct> <struct name="Logger" type="ocl::Logger"> <simple name="PropertyFile" ...><value>logger.org.me.myapp.cpf</value></simple> </struct>
File: AppAConfig.cpf
<properties> <simple name="LayoutClass" type="string"><value>ocl.PatternLayout</value> <simple name="LayoutConversionPattern" type="string"><value>%-4r [%t] %-5p %c %x - %m%n</value> </properties>
… other appender .cpf files …
File: logger.org.me.myapp.cpf
<properties> <struct name="Categories" type="PropertyBag"> <simple name="org.me.myapp" type="string"><value>info</value></simple> <simple name="org.me.myapp.C2" type="string"><value>debug</value></simple> </struct> <struct name="Appenders" type="PropertyBag"> <simple name="org.me.myapp" type="string"><value>AppenderA</value></simple> <simple name="org.me.myapp.C2" type="string"><value>AppenderB</value></simple> <simple name="org.me.myapp.C2" type="string"><value>AppenderC</value></simple> </struct> </properties>
The logger component is no more than a container for ports. Why special case this? Simply to make life easier for the deployer and to keep the deployer syntax and semantic model similar to what it currently is. A deployer deploys components - the only real special casing here is the connecting of ports (by the logger code) that aren't mentioned in the deployment file. If you use the existing deployment approach, you have to create a component per category, and mention the port in both the appenders and the category. This is what I currently have, and as I said, it is Really Ugly.
Example logger functionality (error checking elided)
Logger::configureHook() // create a port for each category with an appender for each appender in property bag find existing category if category not exist create category create port associate port with category find appender component connect category port with appender port // configure categories for each category in property bag if category not exist create category set category level
There will probably need to be a restriction that to maintain real-time, categories are found prior to a component being started (e.g. in configureHook() or startHook() ).
Note that not all OCL::Category objects contain a port. Only those category objects with associated appenders actually have a port. This is how the hierarchy works. If you have category "org.me.myapp.1.2.3" and it has no appenders but your log level is sufficient, then the logging action gets passed up the hierarchy. Say that category "org.me.myapp" has an appender (and that no logging level stops this logging action in the hierarchy in between), then that appender will actually log this event.
Also should create toolkit and transport plugins to deal with the log4cpp::LoggingEvent struct. This will allow for remote appenders, as well as viewing within the taskbrowser.
Port names would perhaps be something like "org.me.myapp.C1" => log_org_me_myapp_C1".
It's not so much the string that needs to be real-time, but the stringstream, which converts our data (strings, ints,...) into a string buffer. Conveniently, the boost::iostream library allows with two lines of code to create a real-time string stream:
#include <boost/iostreams/device/array.hpp> #include <boost/iostreams/stream.hpp> namespace io = boost::iostreams; int main() { // prepare static sink const int MAX_MSG_LENGTH = 100; char sink[MAX_MSG_LENGTH]; memset( sink, 0, MAX_MSG_LENGTH); // create 'stringstream' io::stream<io::array_sink> out(sink); out << "Hello World! "; // space required to avoid stack smashing abort. // close and flush stringstream out.close(); // re-open from position zero. out.open( sink ); // overwrites old data. out << "Hello World! "; }
Unfortunately, the log4cpp::LoggingEvent is passed through RTT buffers, and this has std::string members. So, we need rt_string also, but rt_stringstream will be very useful also.
Warning For anyone using the boost::iostreams like above, either clear the array to 0's first, or ensure you explicitly write the string termination character ('\0'). The out << "..."; statement does not terminate the string otherwise. Also, I did not need the "space ... to avoid stack smashing abort" bit on Snow Leopard with gcc 4.2.1.
Using boost::iostream repeatedly ... you need to reset the stream between each use
#include <boost/iostreams/device/array.hpp> #include <boost/iostreams/stream.hpp> #include <boost/iostreams/seek.hpp> namespace io = boost::iostreams; ... char str[500]; io::stream<io::array_sink> ss(str); ss << "cartPose_desi " << vehicleCartPosition_desi << '\0'; logger->debug(OCL::String(&str[0])); // reset stream before re-using io::seek(ss, 0, BOOST_IOS::beg); ss << "cartPose_meas " << vehicleCartPosition_meas << '\0'; logger->debug(OCL::String(&str[0]));
If before the Logger is configured (and hence, the buffer ports and appender associations are created), a component logs to a category, the logging event is lost. At that time no appenders exist. It also means that for any component that logs prior to configure time, by default, those logging events are lost. I think that this requires further examination, but would likely involve more change to the OCL deployer.
The logger configure code presumes that all appenders already exist. Is this an issue?
Is the port-category association a shared_ptr<port> style, or does the category simply own the port?
If the logger component has the ports added to it as well as to the category, then you could peruse the ports within the taskbrowser. Is this useful? If this is useful, is it worth making the categories and their levels available somehow for perusal within the taskbrowser?
[1] http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/NDC.html
[2] Patterns for Logging Diagnostic Messages Abstract
[3] log4j and a short introduction to it.
[5] log4cpp
[6] log4cxx
[7] log4cplus
(Copied from http://github.com/doudou/orocos-rtt/commit/dc1947c8c1bdace90cf0a3aa2047ad248619e76b)
Here is the mail that led to this implementation:
connect(source, dest) source.disconnect()
=> A0 A3 [PROCESSING] => A'0 A'3 A0 A1 A2 A3 => [WORK SHARING WORK SHARING] => A'0 A'1 A'2 A'3 => A1 A2 [PROCESSING] => A'1 A'2
What I'm proposing is getting back to a good'ol data flow model, namely:
From RTT 1.8 on, an Orocos component is created with a default 'SequentialActivity', which uses ('piggy-backs on') the calling thread to execute its asynchronous functions. It has been argued that this is not a safe default, because a component with a faulty asynchronous function can terminate the thread of a calling component, in case the 'caller' emits an asynchronous event (this is quite technical, you need to be on orocos-dev for a while to understand this).
Furthermore, in case you do want to assign a thread, you need to select a 'PeriodicActivity' or 'NonPeriodicActivity', which have their quirks as well. For example, PeriodicActivity serialises activities with equal period and periodicity, and NonPeriodicActivity says what it isn't instead of what it is.
The idea is to create a new activity type which allocates one thread, and which can be periodic or non-periodic. The other activity types remain (and/or are renamed) for specialist users that know what they want.
It started with an idea on FOSDEM. It went on as a long mail (click link for full text and discussion) on the Orocos-dev mailing list.
Here's the summary:
The pages below analyse and propose new solutions. The pages are in chronological order, so later pages represent more recent views.
I've seen people using the RTT for inter-thread communication in two major ways: or implement a function as a Method, or as a Command. Where the command was the thread-safe way to change the state of a component. The adventurous used Events as well, but I can't say they're a huge success (we got like only one 'thank you' email in its whole existence...). But anyway, Commands are complex for newbies, Events (syn/asyn) aren't better. So for all these people, here it comes: the RTT::Message object. Remember, Methods allow a peer component to _call_ a function foo(args) of the component interface. Messages will have the meaning of _sending_ another component a message to execute a function foo(args). Contrary to Methods, Messages are 'send and forget', they return void. The only guarantee you got is, that if the receiver was active, it processed it. For now, forget that Commands exist. We have two inter- component messaging primitives now: Messages and Methods. And each component declares: You can call these methods and send these messages. They are the 'Level 0' primitives of the RTT. Any transport should support these. Note that conveniently, the transport layer may implement messages with the same primitive as data ports. But we, users, don't care. We still have Data Ports to 'broadcast' our data streams and now we have Messages as well to send directly to component X.
Think about it. The RTT would be already usable if each component only had data ports and a Message/Method interface. Ask the AUTOSAR people, it's very close to what they have (and can live with).
There's one side effect of the Message: we will need a real-time memory allocator to reserve a piece of memory for each message sent, and free it when the message is processed. Welcome TLSF. In case such a thing is not possible wanted by the user, Messages can fall back to using pre-allocated memory, but at the cost of reduced functionality (similar to what Commands can do today). Also, we'll have a MessageProcessor, which replaces and is a slimmed down version of the CommandProcessor today.
So where does this leave Events? Events are of the last primitives I explain in courses because they are so complex. They don't need to be. Today you need to attach a C/C++ function to an event and optionally specify an EventProcessor. Depending on some this-or-thats the function is executed in this-or-the-other thread. Let's forget about that. In essence, an Event is a local thing that others like to know about: Something happened 'here', who wants to know? Events can be changed such that you can say: If event 'e' happens, then call this Method. And you can say: if event 'e' happens, send me this Message. You can subscribe as many callbacks as you want. Because of the lack of this mechanism, the current Event implementation has a huge foot print. There's a lot to win here.
Do you want to allow others to raise the event ? Easy: add it to the Message or Method interface, saying: send me this Message and I'll raise the event, or call this Method and you'll raise it, respectively. But if someone can raise it, is your component's choice. That's what the event interface should look like. It's a Level 1. A transport should do no more than allowing to connect Methods and Messages (which it already supports, Level 1) to Events. No more. Even our CORBA layer could do that.
The implementation of Event can benefit from a rt_malloc as well. Indirectly. Each raised Event which causes Messages to be sent out will use the Message's rt_malloc to store the event data by just sending the Message. In case you don't have/want an rt_malloc, you fall back to what events can roughly do today. But with lots of less code ( Goodbye RTT::ConnectionC, Goodbye RTT::EventProcessor ).
And now comes the climax: Sir Command. How does he fit in the picture? He'll remain in some form, but mainly as a 'Level 2' citizen. He'll be composed of Methods, Messages and Events and will be dressed out to be no more than a wrapper, keeping related classes together or even not that. Replacing a Command with a Message hardly changes anything in the C++ side. For scripts, Commands were damn useful, but we will come up with something satisfactory. I'm sure.
How does all this interface shuffling allows us to get 'towards a sustainable distributed component model'? That's because we're seriously lowering the requirements on the transport layer:
And we are at the same time lowering the learning curve for new users:
(Please feel free to edit/comment etc. This is a community document, not a personal document)
An alternative naming is possible: the offering of a C/C++ function could be named 'operation' and the collection of a given set of operations in an interface could be called a 'service'. This definition would line up better with service oriented architectures like OSGi.
Users want to control which thread executes which function, and if they want to wait(block) on the result or not. This all in order to meet deadlines in real-time systems. In practice, this boils down to:
Wait? \ Thread? | Caller | Component |
---|---|---|
Yes | (Method) | (?) |
No | X | (Command) |
For reference, the current RTT 1.x primitives are shown. There are two remarkable spots: the X and the (?).
Another thing you should be aware of that in the current implementation, caller and component must agree on how the service is invoked. If the Component defines a Method, the caller must execute it in its own thread and wait for the result. There's no other way for the caller to deviate from this. In practice, this means that the component's interface dictates how the caller can use its services. This is consistent with how UML defines operations, but other frameworks, like ICE, allow any function part of the interface to be called blocking or non-blocking. Clearly, ICE has some kind of thread-pool behind the scenes that does the dispatching and collects the results on behalf of the caller.
A simpler form of Command will be provided that does not contain the completion condition. It is too seldomly used.
It is to the proposals to show how to emulate the old behavior with the new primitives.
Each proposal should try to solve these issues:
The ability to let caller and component choose which execution semantics they want when calling or offering a service (or motivate why a certain choice is limited):
And regarding easy use and backwards compatibility:
And finally:
This is one of the earliest proposals. It proposes to keep Method as-is, remove Command and replace it with a new primitive: RTT::Message. The Message is a stripped Command. It has no completion condition and is send-and-forget. One can not track the status or retrieve arguments. It also uses a memory manager to allow to invoke the same Message object multiple times with different data.
Emulating a completion condition is done by defining the completion condition as a Method in the component interface and requiring that the sender of the Message checks that Method to evaluate progress. In scripting this becomes:
// Old: do comp.command("hello"); // waits (polls) here until complete returns true // New: Makes explicit what above line does: do comp.message("hello"); // proceeds immediately while ( comp.message_complete("hello") == false ) // polling do nothing;
In C++, the equivalent is slightly different:
// Old: if ( command("hello") ) { //... user specific logic that checks command.done() } // New: if ( message("hello") ) { // send and forget, returns immediately // user specifc logic that checks message_complete("hello") }
Users have indicated that they also wanted to be able to specify in C++:
message.wait("hello"); // send and block until executed.
It is not clear yet how the wait case can be implemented efficiently.
The user visible object names are:
This proposal solves:
This proposal omits:
Other notes:
The idea is that components only define services, and assign properties to these services. The main properties to toggle are 'executed in my thread or callers thread, or even another thread'. But other properties could be added too. For example: a 'serialized' property which causes the locking of a (recursive!) mutex during the execution of the service. The user of the service can not and does not need to know how these properties are set. He only sees a list of services in the interface.
It is the caller that chooses how to invoke a given service: waiting for the result ('call') or not ('send'). If he doesn't want to wait, he has the option to collect the results later ('collect'). The default is blocking ('call'). Note that this waiting or not is completely independent of how the service was defined by the component, the framework will choose a different 'execution' implementation depending on the combination of the properties of service and caller.
This means that this proposal allows to have all four quadrants of the table above. This proposal does not detail yet how to implement case (X) though, which requires a 3rd thread to do the actual execution of the service (neither component nor caller wish to do execute the C function).
This would result in the following scripting code on caller side:
//Old: do comp.the_method("hello"); //New: do comp.the_service.call("hello"); // equivalent to the_method. //Old: do comp.the_command("hello"); //New: do comp.the_service.send("hello"); // equivalent to the_command, but without completion condition.
This example shows two use cases for the same 'the_service' functionality. The first case emulates an RTT 1.x method. It is called and the caller waits until the function has been executed. You can not see here which thread effectively executes the call. Maybe it's 'comp's thread, in which case the caller's thread is blocking until it the function is executed. Maybe it's the caller's thread, in which case it is effectively executing the function. The caller doesn't care actually. The only thing that has effect is that it takes a certain amount of time to complete the call, *and* that if the call returns, the function has been effectively executed.
The second case is emulating an RTT 1.x command. The send returns immediately and there is no way in knowing when the function has been executed. The only guarantee you have is that the request arrived at the other side and bar crashes and infinite loops, will complete some time in the future.
A third example is shown below where another service is used with a 'send' which returns a result. The service takes two arguments: a string and a double. The double is the answer of the service, but is not yet available when the send is done. So the second argument is just ignored during the send. A handle 'h' is returned which identifies your send request. You can re-use this handle to collect the results. During collection, the first argument is now ignored, and the second argument is filled in with the result of the service. Collection may be blocking or not.
//New, with collecting results: var double ignored_result, result; set h = comp.other_service.send("hello", ignored_result); // some time later : comp.other_service.collect(h, "ignored", result); // blocking ! // or poll for it: if ( comp.other_service.collect_if_done( h, "ignored", result ) == true ) then { // use result... }
In C++ the above examples are written as:
//New calling: the_service.call("hello", result); // also allowed: the_service("hello", result); //New sending: the_service.send("hello", ignored_result); //New sending with collecting results: h = other_service.send("hello", ignored_result); // some time later: other_service.collect(h, "ignored", result); // blocking ! // or poll for it: if ( other_service.collect_if_done( h, "ignored", result ) == true ) { // use result... }
Completion condition emulation is done like in Proposal 1.
The definition of the service happens at the component's side. The component decides for each service if it is executed in his thread or the callers thread:
// by default creates a service executed by caller, equivalent to defining a RTT 1.x Method RTT::Service the_service("the_service", &foo_service ); // sets the service to be executed by the component's thread, equivalent to Command the_service.setExecutor( this ); //above in one line: RTT::Service the_service("the_service", &foo_service, this );
The user visible object names are:
This proposal solves:
This proposal omits:
Users can express the 'provides' interface of an Orocos Component. However, there is no easy way to express which other components a component requires. The notable exception is data flow ports, which have in-ports (requires) and out-ports (provides). It is however not possible to express this requires interface for the execution flow interface, thus for methods, commands/messages and events. This omission makes the component specification incomplete.
One of the first questions raised is if this must be expressed in C++ or during 'modelling'. That is, UML can express the requires dependency, so why should the C++ code also contain it in the form of code ? It should only contain it if you can't generate code from your UML model. Since this is not yet available for Orocos components, there is no other choice than expressing it in C++.
A requires interface specification should be optional and only be present for:
We apply this in code examples to various proposed primitives in the pages below.
Commands are no longer a part of the TaskContext API. They are helper classes which replicate the old RTT 1.0 behaviour. In order to setup commands more easily, it is allowed to register them as a 'requires()' interface.
This is all very experimental.
/** * Provider of a Message with command-like semantics */ class TaskA : public TaskContext { Message<void(double)> message; Method<bool(double)> message_is_done; Event<void(double)> done_event; void mesg(double arg1) { return; } bool is_done(double arg1) { return true; } public: TaskA(std::string name) : TaskContext(name), message("Message",&TaskA::mesg, this), message_is_done("MessageIsDone",&TaskA::is_done, this), done_event("DoneEvent") { this->provides()->addMessage(&message, "The Message", "arg1", "Argument 1"); this->provides()->addMethod(&method, "Is the Message done?", "arg1", "Argument 1"); this->provides()->addEvent(&done_event, "Emited when the Message is done.", "arg1", "Argument 1"); } }; class TaskB : public TaskContext { // RTT 1.0 style command object Command<bool(double)> command1; Command<bool(double)> command2; public: TaskB(std::string name) : TaskContext(name), command1("command1"), command2("command2") { // the commands are now created client side, you // can not add them to your 'provides' interface command1.useMessage("Message"); command1.useCondition("MessageIsDone"); command2.useMessage("Message"); command2.useEvent("DoneEvent"); // this allows automatic setup of the command. this->requires()->addCommand( &command1 ); this->requires()->addCommand( &command2 ); } bool configureHook() { // setup is done during deployment. return command1.ready() && command2.ready(); } void updateHook() { // calls TaskA: if ( command1.ready() && command2.ready() ) command1( 4.0 ); if ( command1.done() && command2.ready() ) command2( 1.0 ); } }; int ORO_main( int, char** ) { // Create your tasks TaskA ta("Provider"); TaskB tb("Subscriber"); connectPeers(ta, tb); // connects interfaces. connectInterfaces(ta, tb); return 0; }
The idea of the new Event API is that: 1. only the owner of the event can emit the event (unless the event is also added as a Method or Message) 2. Only methods or message objects can subscribe to events.
/** * Provider of Event */ class TaskA : public TaskContext { Event<void(string)> event; public: TaskA(std::string name) : TaskContext(name), event("Event") { this->provides()->addEvent(&event, "The Event", "arg1", "Argument 1"); // OR: this->provides("FooInterface")->addEvent(&event, "The Event", "arg1", "Argument 1"); // If you want the user to let him emit the event: this->provides()->addMethod(&event, "Emit The Event", "arg1", "Argument 1"); } void updateHook() { event("hello world"); } }; /** * Subscribes a local Method and a Message to Event */ class TaskB : public TaskContext { Message<void(string)> message; Method<void(string)> method; // Message callback void mesg(double arg1) { return; } // Method callback int meth(double arg1) { return 0; } public: TaskB(std::string name) : TaskContext(name), message("Message",&TaskB::mesg, this), method("Method",&TaskB::meth, this) { // optional: // this->provides()->addMessage(&message, "The Message", "arg1", "Argument 1"); // this->provides()->addMethod(&method, "The Method", "arg1", "Argument 1"); // subscribe to event: this->requires()->addCallback("Event", &message); this->requires()->addCallback("Event", &method); // OR: // this->provides("FooInterface")->addMessage(&message, "The Message", "arg1", "Argument 1"); // this->provides("FooInterface")->addMethod(&method, "The Method", "arg1", "Argument 1"); // subscribe to event: this->requires("FooInterface")->addCallback("Event", &message); this->requires("FooInterface")->addCallback("Event", &method); } bool configureHook() { // setup is done during deployment. return message.ready() && method.ready(); } void updateHook() { // we only receive } }; int ORO_main( int, char** ) { // Create your tasks TaskA ta("Provider"); TaskB tb("Subscriber"); connectPeers(ta, tb); // connects interfaces. connectInterfaces(ta, tb); return 0; }
This use case shows how one can use messages in the new API. The unchanged method is added for comparison. Note that I have also added the provides() and requires() mechanism such that the RTT 1.0 construction:
method = this->getPeer("PeerX")->getMethod<int(double)>("Method");
is no longer required. The connection is made similar as data flow ports are connected.
/** * Provider */ class TaskA : public TaskContext { Message<void(double)> message; Method<int(double)> method; void mesg(double arg1) { return; } int meth(double arg1) { return 0; } public: TaskA(std::string name) : TaskContext(name), message("Message",&TaskA::mesg, this), method("Method",&TaskA::meth, this) { this->provides()->addMessage(&message, "The Message", "arg1", "Argument 1"); this->provides()->addMethod(&method, "The Method", "arg1", "Argument 1"); // OR: this->provides("FooInterface")->addMessage(&message, "The Message", "arg1", "Argument 1"); this->provides("FooInterface")->addMethod(&method, "The Method", "arg1", "Argument 1"); } }; class TaskB : public TaskContext { Message<void(double)> message; Method<int(double)> method; public: TaskB(std::string name) : TaskContext(name), message("Message"), method("Method") { this->requires()->addMessage( &message ); this->requires()->addMethod( &method ); // OR: this->requires("FooInterface")->addMessage( &message ); this->requires("FooInterface")->addMethod( &method ); } bool configureHook() { // setup is done during deployment. return message.ready() && method.ready(); } void updateHook() { // calls TaskA: method( 4.0 ); // sends two messages: message( 1.0 ); message( 2.0 ); } }; int ORO_main( int, char** ) { // Create your tasks TaskA ta("Provider"); TaskB tb("Subscriber"); connectPeers(ta, tb); // connects interfaces. connectInterfaces(ta, tb); return 0; }
This page shows some use cases on how to use the newly proposed services classes in RTT 2.0.
WARNING: This page assumes the reader has familiarity with the current RTT 1.x API.
First, we introduce the new classes that would be added to the RTT:
#include <rtt/TaskContext.hpp> #include <string> using RTT::TaskContext; using std::string; /************************************** * PART I: New Orocos Classes */ /** * An operation is a function a component offers to do. */ template<class T> class Operation {}; /** * A Service collects a number of operations. */ class ServiceProvider { public: ServiceProvider(string name, TaskContext* owner); }; /** * Is the invocation of an Operation. * Methods can be executed blocking or non blocking, * in the latter case the caller can retrieve the results * later on. */ template<class T> class Method {}; /** * A ServiceRequester collects a number of methods */ class ServiceRequester { public: ServiceRequester(string name, TaskContext* owner); bool ready(); };
What is important to notice here is the symmetry:
(Operation, ServiceProvider) <-> (Method, ServiceRequester).The left hand side is offering services, the right hand side is using the services.
First we define that we provide a service. The user starts from his own C++ class with virtual functions. This class is then implemented in a component. A helper class ties the interface to the RTT framework:
/************************************** * PART II: User code for PROVIDING a service */ /** * Example Service as abstract C++ interface (non-Orocos). */ class MyServiceInterface { public: /** * Description. * @param name Name of thing to do. * @param value Value to use. */ virtual int foo_function(std::string name, double value) = 0; /** * Description. * @param name Name of thing to do. * @param value Value to use. */ virtual int bar_service(std::string name, double value) = 0; }; /** * MyServiceInterface exported as Orocos interface. * This could be auto-generated from reading MyServiceInterface. * */ class MyService { protected: /** * These definitions are not required in case of 'addOperation' below. */ Operation<int(const std::string&,double)> operation1; Operation<int(const std::string&,double)> operation2; /** * Stores the operations we offer. */ ServiceProvider provider; public: MyService(TaskContext* owner, MyServiceInterface* service) : provider("MyService", owner), operation1("foo_function"), operation2("bar_service") { // operation1 ties to foo_function and is executed in caller's thread. operation1.calls(&MyServiceInterface::foo_function, service, Service::CallerThread); operation1.doc("Description", "name", "Name of thing to do.", "value", "Value to use."); provider.addOperation( operation1 ); // OR: (does not need operation1 definition above) // Operation executed by caller's thread: provider.addOperation("foo_function", &MyServiceInterface::foo_function, service, Service::CallerThread) .doc("Description", "name", "Name of thing to do.", "value", "Value to use."); // Operation executed in component's thread: provider.addOperation("bar_service", &MyServiceInterface::bar_service, service, Service::OwnThread) .doc("Description", "name", "Name of thing to do.", "value", "Value to use."); } };
Finally, any component is free to provide the service defined above. Note that it shouldn't be that hard to autogenerate most of the above code.
/** * A component that implements and provides a service. */ class MyComponent : public TaskContext, protected MyServiceInterface { /** * The class defined above. */ MyService serv; public: /** * Just pass on TaskContext and MyServiceInterface pointers: */ MyComponent() : TaskContext("MC"), serv(this,this) { } protected: // Implements MyServiceInterface int foo_function(std::string name, double value) { //... return 0; } // Implements MyServiceInterface int bar_service(std::string name, double value) { //... return 0; } };
The second part is about using this service. It creates a ServiceRequester object that stores all the methods it wants to be able to call.
Note that both ServiceRequester below and ServiceProvider above have the same name "MyService". This is how the deployment can link the interfaces together automatically.
/************************************** * PART II: User code for REQUIRING a service */ /** * We need something like this to define which services * our component requires. * This class is written explicitly, but it can also be done * automatically, as the example below shows. * * If possible, this class should be generated too. */ class MyServiceUser { ServiceRequester rservice; public: Method<int(const string&, double)> foo_function; MyServiceUser( TaskContext* owner ) : rservice("MyService", owner), foo_function("foo_function") { rservice.requires(foo_function); } }; /** * Uses the MyServiceUser helper class. */ class UserComponent2 : public TaskContext { // also possible to (privately) inherit from this class. MyServiceUser mserv; public: UserComponent2() : TaskContext("User2"), mserv(this) { } bool configureHook() { if ( ! mserv->ready() ) { // service not ready return false; } } void updateHook() { // blocking: mserv.foo_function.call("name", 3.14); // etc. see updateHook() below. } };
The helper class can again be omitted, but the Method<> definitions must remain in place (in contrast, the Operation<> definitions for providing a service could be omitted).
The code below also demonstrates the different use cases for the Method object.
/** * A component that uses a service. * This component doesn't need MyServiceUser, it uses * the factory functions instead: */ class UserComponent : public TaskContext { // A definition like this must always be present because // we need it for calling. We also must provide the function signature. Method<int(const string&, double)> foo_function; public: UserComponent() : TaskContext("User"), foo_function("foo_function") { // creates this requirement automatically: this->requires("MyService")->add(&foo_function); } bool configureHook() { if ( !this->requires("MyService")->ready() ) { // service not ready return false; } } /** * Use the service */ void updateHook() { // blocking: foo_function.call("name", 3.14); // short/equivalent to call: foo_function("name", 3.14); // non blocking: foo_function.send("name", 3.14); // blocking collect of return value of foo_function: int ret = foo_function.collect(); // blocking collect of any arguments of foo_function: string ret1; double ret2; int ret = foo_function.collect(ret1, ret2); // non blocking collect: int returnval; if ( foo_function.collectIfDone(ret1,ret2,returnval) ) { // foo_function was done. Any argument that needed updating has // been updated. } } };
Finally, we conclude with an example of requiring the same service multiple times, for example, for controlling two stereo-vision cameras.
/** * Multi-service case: use same service multiple times. * Example: stereo vision with two cameras. */ class UserComponent3 : public TaskContext { // also possible to (privately) inherit from this class. MyVisionUser vision; public: UserComponent3() : TaskContext("User2"), vision(this) { // requires a service exactly two times: this->requires(vision)["2"]; // OR any number of times: // this->requires(vision)["*"]; // OR range: // this->requires(vision)["0..2"]; } bool configureHook() { if ( ! vision->ready() ) { // only true if both are ready. return false; } } void updateHook() { // blocking: vision[0].foo_function.call("name", 3.14); vision[1].foo_function.call("name", 3.14); // or iterate: for(int i=0; i != vision.interfaces(); ++i) vision[i].foo_function.call("name",3.14); // etc. see updateHook() above. /* Scripting equivalent: * for(int i=0; i != vision.interfaces(); ++i) * do vision[i].foo_function.call("name",3.14); */ } };
For upgrading, we have:
More details are split into several child pages.
RTT 2.0 has unified events, commands and methods in the Operation interface.
This is how a function is added to the component interface:
#include <rtt/Operation.hpp>; using namespace RTT; class MyTask : public RTT::TaskContext { public: string getType() const { return "SpecialTypeB" } // ... MyTask(std::string name) : RTT::TaskContext(name), { // Add the a C++ method to the operation interface: addOperation( "getType", &MyTask::getType, this ) .doc("Read out the name of the system."); } // ... }; MyTask mytask("ATask");
The writer of the component has written a function 'getType()' which returns a string that other components may need. In order to add this operation to the Component's interface, you use the TaskContext's addOperation function. This is a short-hand notation for:
// Add the C++ method to the operation interface: provides()->addOperation( "getType", &MyTask::getType, this ) .doc("Read out the name of the system.");
Meaning that we add 'getType()' to the component's main interface (also called 'this' interface). addOperation takes a number of parameters: the first one is always the name, the second one a pointer to the function and the third one is the pointer to the object of that function, in our case, MyTask itself. In case the function is a C function, the third parameter may be omitted.
If you don't want to polute the component's this interface, put the operation in a sub-service:
// Add the C++ method objects to the operation interface: provides("type_interface") ->addOperation( "getType", &MyTask::getType, this ) .doc("Read out the name of the system.");
The code above dynamically created a new service object 'type_interface' to which one operation was added: 'getType()'. This is similar to creating an object oriented interface with one function in it.
Your code needs a few things before it can call a component's operation:
Combining these three givens, we must create an OperationCaller object that will manage our call to 'getType':
#include <rtt/OperationCaller.hpp> //... // In some other component: TaskContext* a_task_ptr = getPeer("ATask"); // create a OperationCaller<Signature> object 'getType': OperationCaller<string(void)> getType = a_task_ptr->getOperation("getType"); // lookup 'string getType(void)' // Call 'getType' of ATask: cout << getType() <<endl;
A lot of work for calling a function no ? The advantages you get are these:
var string result = ""; set result = ATask.getType();
// Add the C++ method to the operation interface: // Execute function in component's thread: provides("type_interface") ->addOperation( "getType", &MyTask::getType, this, OwnThread ) .doc("Read out the name of the system.");
So this causes that when getType() is called, it gets queued for execution in the ATask component, is executed by its ExecutionEngine, and when done, the caller will resume. The caller (ie the OperationCaller object) will not notice this change of execution path. It will wait for the getType function to complete and return the results.
// This first part is equal to the example above: #include <rtt/OperationCaller.hpp> //... // In some other component: TaskContext* a_task_ptr = getPeer("ATask"); // create a OperationCaller<Signature> object 'getType': OperationCaller<string(void)> getType = a_task_ptr->getOperation("getType"); // lookup 'string getType(void)' // Here it is different: // Send 'getType' to ATask: SendHandle<string(void)> sh = getType.send(); // Collect the return value 'some time later': sh.collect(); // blocks until getType() completes cout << sh.retn() <<endl; // prints the return value of getType().
Other variations on the use of SendHandle are possible, for example polling for the result or retrieving more than one result if the arguments are passed by reference. See the Component Builder's Manual for more details.
RTT 2.0 has a more powerful, simple and flexible system to exchange data between components.
Every instance of ReadDataPort and ReadBufferPort must be renamed to 'InputPort' and every instance of WriteDataPort and WriteBufferPort must be renamed to OutputPort. 'DataPort' and 'BufferPort' must be renamed according to their function.
The rtt2-converter tool will do this renaming for you, or at least, make its best guess.
InputPort and OutputPort have a read() and a write() function respectively:
using namespace RTT; double data; InputPort<double> in("name"); FlowStatus fs = in.read( data ); // was: Get( data ) or Pull( data ) in 1.x OutputPort<double> out("name"); out.write( data ); // was: Set( data ) or Push( data ) in 1.x
As you can see, Get() and Pull() are mapped to read(), Set() and Push() to write(). read() returns a FlowStatus object, which can be NoData, OldData, NewData. write() does not return a value (send and forget).
Writing to a not connected port is not an error. Reading from a not connected (or never written to) port returns NoData.
Your component can no longer see if a connection is buffered or not. It doesn't need to know. It can always inspect the return value of read() to see if a new data sample arrived or not. In case multiple data samples are ready to read in a buffer, read() will fetch each sample in order and each time return NewData, until the buffer is empty, in which case it returns the last data sample read with 'OldData'.
If data exchange is buffered or not is now fixed by 'Connection Policies', or 'RTT::ConnPolicy' objects. This allows you to be very flexible on how components are connected, since you only need to specify the policy at deployment time. It is possible to define a default policy for each input port, but it is not recommended to count on a certain default when building serious applications. See the 'RTT::ConnPolicy' API documentation for which policies are available and what the defaults are.
The DeploymentComponent has been extended such that it can create new-style connections. You only need to add sections to your XML files, you don't need to change existing ones. The sections to add have the form:
<!-- You can set per data flow connection policies --> <struct name="SensorValuesConnection" type="ConnPolicy"> <!-- Type is 'shared data' or buffered: DATA: 0 , BUFFER: 1 --> <simple name="type" type="short"><value>1</value></simple> <!-- buffer size is 12 --> <simple name="size" type="short"><value>12</value></simple> </struct> <!-- You can repeat this struct for each connection below ... -->
Where 'SensorValuesConnection' is a connection between data flow ports, like in the traditional 1.x way.
Consult the deployment component manual for all allowed ConnPolicy XML options.
std::vector<double> joints(10, 0.0); OutputPort<std::vector<double> > out("out"); out.setDataSample( joints ); // initialises all current and future connections to hold a vector of size 10. // modify joint values... add connections etc. out.write( joints ); // always hard real-time if joints.size() <= 10
As the example shows, a single call to setDataSample() is enough. This is not the same as write() ! A write() will deliver data to each connected InputPort, a setDataSample() will only initialize the connections, but no actual writing is done. Be warned that setDataSample() may clear all data already in a connection, so it is better to call it before any data is written to the OutputPort.
In case your data type is always hard real-time copyable, there is no need to call setDataSample. For example:
KDL::Frame f = ... ; // KDL::Frame never (de-)allocates memory during copy or construction. OutputPort< KDL::Frame > out("out"); out.write( f ); // always hard real-time
This page lists the renamings/relocations done on the RTT 2.0 branch (available through gitorious on http://www.gitorious.org/orocos-toolchain/rtt/commits/master) and also offers the conversion scripts to do the renaming.
A note about headers/namespaces: If a header is in rtt/extras, the namespace will be RTT::extras and vice versa. A header in rtt/ has namespace RTT. Note: the OS namespace has been renamed to lowercase os. The Corba namespace has been renamed to lowercase corba.
mv to-rtt-2.0.pl.txt to-rtt-2.0.pl chmod a+x to-rtt-2.0.pl ./to-rtt-2.0.pl $(find . -name "*.cpp" -o -name "*.hpp")
Minor manual fixes may be expected after running this script. Be sure to have your sources version controlled, such that you can first test what the script does before permanently changing files.
tar xjf rtt2-converter-1.1.tar.bz2 cd rtt2-converter-1.1 make ./rtt2-converter Component.hpp Component.cpp
The script takes preferably both header and implementation of your component, but will also accept a single file. It needs both class definition and implementation to make its best guesses on how to convert. If all your code is in a .hpp or .cpp file, you only need to specify that file. If nothing is to be done, the file will remain the same, so you may 'accidentally' feed non-Orocos files, or a file twice.
To run this on a large codebase, you can do something similar to:
# Calls : ./rtt2-converter Component.hpp Component.cpp for each file in orocos-app for i in $(find /home/user/src/orocos-app -name "*.cpp"); do ./rtt2-converter $(dirname $i)/$(basename $i cpp)hpp $i; done # Calls : ./rtt2-converter Component.cpp for each .cpp file in orocos-app for i in $(find /home/user/src/orocos-app -name "*.cpp"); do ./rtt2-converter $i; done # Calls : ./rtt2-converter Component.hpp for each .hpp file in orocos-app for i in $(find /home/user/src/orocos-app -name "*.hpp"); do ./rtt2-converter $i; done
RTT 1.0 | RTT 2.0 | Comments |
RTT::PeriodicActivity | RTT::extras::PeriodicActivity | Use of RTT::Activity is prefered |
RTT::Timer | RTT::os::Timer | |
RTT::SlaveActivity, SequentialActivity, SimulationThread, IRQActivity, FileDescriptorActivity, EventDrivenActivity, SimulationActivity, ConfigurationInterface, Configurator, TimerThread | RTT::extras::... | EventDrivenActivity has been removed. |
RTT::OS::SingleThread, RTT::OS::PeriodicThread | RTT::os::Thread | Can do periodic and non-periodic and switch at run-time. |
RTT::TimeService | RTT::os::TimeService | |
RTT::DataPort,BufferPort | RTT::InputPort,RTT::OutputPort | Buffered/unbuffered is decided upon connection time. Only input/output is hardcoded. |
RTT::types() | RTT::types::Types() | The function name collided with the namespace name |
RTT::Toolkit* | RTT::types::Typekit* | More logical name |
RTT::Command | RTT::Operation | Create an 'OwnThread' operation type |
RTT::Method | RTT::Operation | Create an 'ClientThread' operation type |
RTT::Event | RTT::internal::Signal | Events are replaced by OutputPort or Operation, the Signal class is a synchonous-only callback manager. |
commands()->getCommand<T>() | provides()->getOperation() | get a provided operation, no template argument required |
commands()->addCommand() | provides()->addOperation().doc("Description") | add a provided operation, document using .doc("doc").doc("a1","a1 doc")... |
methods()->getMethod<T>() | provides()->getOperation() | get a provided operation, no template argument required |
methods()->addMethod() | provides()->addOperation().doc("Description") | add a provided operation, document using .doc("doc").doc("a1","a1 doc")... |
attributes()->getAttribute<T>() | provides()->getAttribute() | get a provided attribute, no template argument required |
attributes()->addAttribute(&a) | provides()->addAttribute(a) | add a provided attribute, passed by reference, can now also add a normal member variable. |
properties()->getProperty<T>() | provides()->getProperty() | get a provided property, no template argument required |
properties()->addProperty(&p) | provides()->addProperty(p).doc("Description") | add a provided property, passed by reference, can now also add a normal member variable. |
events()->getEvent<T>() | ports()->getPort() OR provides()->getOperation<T>() | Event<T> was replaced by OutputPort<T> or Operation<T> |
ports()->addPort(&port, "Description") | ports()->addPort( port ).doc("Description") | Takes argument by reference and documents using .doc("text"). |
RTT 1.0 | RTT 2.0 | Comments |
scripting() | getProvider<Scripting>("scripting") | Returns a RTT::Scripting object. Also add #include <rtt/scripting/Scripting.hpp> |
RTT 1.0 | RTT 2.0 | Comments |
marshalling() | getProvider<Marshalling>("marshalling") | Returns a RTT::Marshalling object. Also add #include <rtt/marsh/Marshalling.hpp> |
RTT::Marshaller | RTT::marsh::MarshallingInterface | Normally not needed for normal users. |
RTT::Demarshaller | RTT::marsh::DemarshallingInterface | Normally not needed for normal users. |
RTT 1.0 | RTT 2.0 | Comments |
RTT::Corba::* | RTT::corba::C* | Each proxy class or idl interface starts with a 'C' to avoid confusion with the same named RTT C++ classes |
RTT::Corba::ControlTaskServer | RTT::corba::TaskContextServer | renamed for consistency. |
RTT::Corba::ControlTaskProxy | RTT::corba::TaskContextProxy | renamed for consistency. |
RTT::Corba::Method,Command | RTT::corba::COperationRepository,CSendHandle | No need to create these helper objects, call COperationRepository directly |
RTT::Corba::AttributeInterface,Expression,AssignableExpression | RTT::corba::CAttributeRepository | No need to create expression objects, query/use CAttributeRepository directly. |
Attachment | Size |
---|---|
class-dump.txt | 7.89 KB |
headers.txt | 10.17 KB |
to-rtt-2.0.pl.txt | 4.78 KB |
RTT 2.0 has dropped the support for the RTT::Command class. It has been replaced by the more powerful Methods vs Operations construct.
The rtt2-converter tool will automatically convert your Commands to Method/Operation pairs. Here's what happens:
// RTT 1.x code: class ATask: public TaskContext { bool prepareForUse(); bool prepareForUseCompleted() const; public: ATask(): TaskContext("ATask") { this->commands()->addCommand(RTT::command("prepareForUse",&ATask::prepareForUse,&ATask::prepareForUseCompleted,this), "prepares the robot for use"); } };
After:
// After rtt2-converter: RTT 2.x code: class ATask: public TaskContext { bool prepareForUse(); bool prepareForUseCompleted() const; public: ATask(): TaskContext("ATask") { this->addOperation("prepareForUse", &ATask::prepareForUse, this, RTT::OwnThread).doc("prepares the robot for use"); this->addOperation("prepareForUseDone", &ATask::prepareForUseCompleted, this, RTT::ClientThread).doc("Returns true when prepareForUse is done."); } };
What has happened is that the RTT 1.0 Command is split into two RTT 2.0 Operations: "prepareForUse" and "prepareForUseDone". The first will be executed in the component's thread ('OwnThread'), analogous to the RTT::Command semantics. The second function, prepareForUseDone, is executed in the callers thread ('ClientThread'), also analogous to the behaviour of the RTT::Command's completion condition.
The old behavior can be simulated at the callers side by these constructs:
Command<bool(void)> prepare = atask->commands()->getCommand<bool(void)>("prepareForUse"); prepare(); // sends the Command object. while (prepare.done() == false) sleep(1);
In RTT 2.0, the caller's code looks up the prepareForUse Operation and then 'sends' the request to the ATask Component. Optionally, the completion condition is looked up manually and polled for as well:
Method<bool(void)> prepare = atask->getOperation("prepareForUse"); Method<bool(void)> prepareDone = atask->getOperation("prepareForUseDone"); SendHandle h = prepare.send(); while ( !h.collectIfDone() && prepareDone() == false ) sleep(1);
The collectIfDone() and prepareDone() checks are now made explicit, while they were called implicitly in the RTT 1.x's prepare.done() function. Writing your code like this will case the exact same behaviour in RTT 2.0 as in RTT 1.x.
In case you don't care for the 'done' condition, the above code may just be simplified to:
Method<bool(void)> prepare = atask->getOperation("prepareForUse"); prepare.send();
In that case, you may ignore the SendHandle, and the object will cleanup itself at the appropriate time.
Scripting was very convenient for using commands. A typical RTT 1.x script would have looked like:
program foo { do atask.prepareForUse(); // ... rest of the code }
To have the same behaviour in RTT 2.x using Operations, you need to make the 'polling' explicit. Furthermore, you need to 'send' the method to indicate that you do not wish to block:
program foo { var SendHandle h; set h = atask.prepareForUse.send(); while (h.collectIfDone() == false && atask.prepareForUseDone() == false) yield; // ... rest of the code }
function prepare_command() { var SendHandle h; set h = atask.prepareForUse.send(); while (h.collectIfDone() == false && atask.prepareForUseDone() == false) yield; } program foo { call prepare_command(); // note: using 'call' // ... rest of the code }
export function prepare_command() // note: we must export the function { var SendHandle h; set h = atask.prepareForUse.send(); while (h.collectIfDone() == false && atask.prepareForUseDone() == false) yield; } program foo { var SendHandle h; set h = prepare_command(); // note: not using 'call' while (h.collectIfDone() == false) yield; // ... rest of the code }
program foo { prepare_command.call(); // (1) calls and blocks for result. prepare_command.send(); // (2) send() and forget. prepare_command.poll(); // (3) send() and poll with collectIfDone(). }
RTT 2.0 no longer supports the RTT::Event class. This page explains how to adapt your code for this.
Output ports differ from RTT::Event in that they can take only one value as an argument. If your 1.x Event contained multiple arguments, they need to be taken together in a new struct that you create yourself. Both sender and receiver must know and understand this struct.
For the simple case, when your Event only had one argument:
// RTT 1.x class MyTask: public TaskContext { RTT::Event<void(int)> samples_processed; MyTask() : TaskContext("task"), samples_processed("samples_processed") { events()->addEvent( &samples_processed ); } // ... your other code here... };
// RTT 2.x class MyTask: public TaskContext { RTT::OutputPort<int> samples_processed; MyTask() : TaskContext("task"), samples_processed("samples_processed") { ports()->addPort( samples_processed ); // note: RTT 2.x dropped the '&' } // ... your other code here... };
Note: the rtt2-converter tool does not do this replacement, see the Operation section below.
Components wishing to receive the number of samples processed, need to define an InputPort<int> and connect their input port to the output port above.
StateMachine SM { var int total = 0; initial state INIT { entry { } // Reads samples_processed and stores the result in 'total'. // Only if the port return 'NewData', this branch will be evaluated. transition samples_processed( total ) if (total > 0 ) select PROCESSING; } state PROCESSING { entry { /* processing code, use 'total' */ } } final state FINI {}
The transition from state INIT to state PROCESSING will only by taken if samples_processed.read( total ) == NewData and if total > 0. Note: When your TaskContext is periodically executing, the read( total ) statement will be re-tried and overwritten in case of OldData and NewData. Only if the connection of samples_processed is completely empty (never written to or reset), total will not be overwritten.
Operations are can take the same signature as RTT::Event. The difference is that only the component itself can attach callbacks to an Operation, by means of the signals() function.
For example:
// RTT 1.x class MyTask: public TaskContext { RTT::Event<void(int, double)> samples_processed; MyTask() : TaskContext("task"), samples_processed("samples_processed") { events()->addEvent( &samples_processed ); } // ... your other code here... };
// RTT 2.x class MyTask: public TaskContext { RTT::Operation<void(int,double)> samples_processed; MyTask() : TaskContext("task"), samples_processed("samples_processed") { provides()->addOperation( samples_processed ); // note: RTT 2.x dropped the '&' // Attaching a callback handler to the operation object: Handle h = samples_processed.signals( &MyTask::react_foo, this ); } // ... your other code here... void react_foo(int i, double d) { cout << i <<", " << d <<endl; } };
Note: the rtt2-converter tool only does this replacement automatically. Ie. it assumes all your Event objects were only used in the local component. See the RTT 2.0 Renaming table for this tool.
Since an Operation object is always local to the component, no other components can attach callbacks. If your Operation would return a value, the callback functions needs to return it too, but it will be ignored and not received by the caller.
The callback will be executed in the same thread as the operation's function (ie OwnThread vs ClientThread).
StateMachine SM { var int total = 0; initial state INIT { entry { } // Reacts to the samples_processed operation to be invoked // and stores the argument in total. If the Operations takes multiple // arguments, also here multiple arguments must be given. transition samples_processed( total ) if (total > 0 ) select PROCESSING; } state PROCESSING { entry { /* processing code, use 'total' */ } } final state FINI {}
The transition from state INIT to state PROCESSING will only by taken if samples_processed( total ) was called by another component (using a Method object, see Methods vs Operations and if the argument in that call > 0. Note: when samples_processed would return a value, your script can not influence that return value since the return value is determined by the function tied to the Operation, not by signal handlers.
NOTE: RTT 2.0.0-beta1 does not yet support the script syntax.
.. work in progress ..
This page describes how you can configure Eclipse in order to write Orocos applications.
Don't continue if you have an Eclipse version older than Helios (3.6).
Eclipse is a great tool, but some Linux systems are not well prepared to use it. Follow these instructions carefully to get the most out of it.
java -version java version "1.6.0_10" Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)
java -version java version "1.6.0_0" OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu3) OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
Note that you should not see any text saying 'gij' or 'kaffe',... Ubuntu/Debian users can install Sun java by doing:
sudo aptitude install sun-java6-jre sudo update-alternatives --config java ... select '/usr/lib/jvm/java-6-sun/jre/bin/java'
In case of instability, or misbehaving windows/buttons. Try to use the Sun (= Oracle now) version. But also google for the export GDK_NATIVE_WINDOWS=1 solution in case you use Eclipse before Helios and a 2009 or newer Linux distro.
If you're changing Orocos code, also download and enable the Eclipse indentation file attached to this post and Import it in the 'Coding Style' tab of your project Preferences.
http://download.eclipse.org/egit/updatesto your update sites of Eclipse (Help -> Software updates...)
If you have an existing clone (checked out with plain old git), you can 'import' it by first importing the git repository directory as a project and then right click the project -> Team -> Share Project Follow the dialogs. There's some confusion with what to type in the location box. In older versions, you'd need to type
file:///path/to/repositoryNote the three ///
http://subclipse.tigris.org/update_1.4.xto your updates sites of Eclipse (Help -> Software updates...)
If you have an existing checkout, you can 'import' it by first importing the checkout directory as a project and then right click the project -> Team -> Share Project
Attachment | Size |
---|---|
orocos-coding-style.xml | 15.51 KB |
There are also build instructions for building some of these packages manually here: How to build Debian packages
The rest of this page mixes installing Java and building Orocos toolchain sources. In case you used the Debian/Ubuntu packages above, only do the Java setup.
Do the following in Synaptic at the same time:
* sun-java6-bin * sun-java6-jre * sun-java6-plugin * sun-java6-source
Install the following:
Using Synaptic get all the omniOrb packages that are not marked as transitional or dbg and have the same version number. (Hint: do a search of omniorb then sort by version) Include the lib* packages too.
I do not like the bootstrap/autoproj procedure of building Orocos. I prefer using the the standard build instructions found in the RTT Installation Guide
Errata in RTT Installation Guide:
Make sure to enable CORBA by using this cmake command:
cmake .. -DOROCOS_TARGET=gnulinux -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB
OCL
Install:
cd log4cpp;mkdir build;../configure;make;make install
Now: cd ocl;mkdir build;cmake ..;make;make install
JDK BUG for JDK 6.0_18 and above FIX on 64bit systems
Put this in your eclipse.ini file under -vmargs: -XX:-UseCompressedOops
Get Eclipse IDE for C/C++ Developers,. Unzip it somewhere and then do:
cd eclipse ./eclipse
You can use Orocos packages in Eclipse easily. The easiest way is when you're using the ROS build system, since that allows you to generate an Eclipse project, with all the correct settings. If you don't use ROS, you can import it too, but you'll have to add the paths to headers etc manually.
cd ~/ros rosrun ocl orocreate-pkg orocosworld cd orocosworld make eclipse-project
Then go to Eclipse -> File -> Import -> Existing Project into Workspace and then follow the wizard.
When the project is loaded, give it some time to index all header files. All include paths and build settings in Eclipse will be set up for you.
You must have sourced env.sh !
cd ~/src orocreate-pkg orocosworld cd orocosworld make
Then go to Eclipse -> File > New > Makefile Project with Existing Code and complete the wizard page.
The next step you need to do is to add the include paths to RTT and/or OCL and any other dependency in the C++ configuration options of your project preferences.
It's a 10 minutes read which really pays off.
You can use Eclipse Using Eclipse And Orocos or plain git (on Linux) or TortoiseGit (on Windows).
SVN users can use this reference for learning the first commands: http://git.or.cz/course/svn.htm... Click below to read the rest of this post.===Getting started with git=== For a very good git introduction, see Using git without feeling stupid part 1 and part 2 !
It's a 10 minutes read which really pays off.
You can use Eclipse Using Eclipse And Orocos or plain git (on Linux) or TortoiseGit (on Windows).
SVN users can use this reference for learning the first commands: http://git.or.cz/course/svn.html
The git repositories of the Orocos Toolchain (v2.x only) are located at http://github.com/orocos-toolchain .
Check out the rtt or ocl repositories and submit patches by using
git clone git://github.com/orocos-toolchain/rtt.git cd orocos-rtt...hack hack hack on master branch...
git add <changed files> git commit... repeat ...
Finally:
git format-patch origin/masterAnd send out the resulting patch(es).
If origin/master moved forward, then do
git fetch origin/master git rebase origin/masterFetch copies the remote changes to your local repository, but doesn't update your current branch. rebase first removes your patches, the applies the fetched patches and then re-applies your personal patches on the fetched changes. In case of conflicts, see the tutorial on top of this page or man git-rebase