$ cd ~/orocos $ orocreate-pkg myrobot component Using templates at /home/kaltan/src/git/orocos-toolchain/ocl/scripts/pkg/templates... Package myrobot created in directory /home/kaltan/src/git/orocos-toolchain/myproject/myrobot $ cd myrobot $ ls CMakeLists.txt Makefile manifest.xml src # Standard build (installs in the same directory as Orocos Toolchain): $ mkdir build ; cd build $ cmake .. -DCMAKE_INSTALL_PREFIX=orocos $ make install # OR: ROS build: $ make
You can modify the .cpp/.hpp files and the CMakeLists.txt file to adapt them to your needs. See orocreate-pkg --help for other options which allow you to generate other files.
All files that are generated may be modified by you, except for all files in the typekit directory. That directory is generated during a build and under the control of the Orocos typegen tool, from the orogen package.
After the 'make install' step, make sure that your RTT_COMPONENT_PATH includes the installation directory (or that you used -DCMAKE_INSTALL_PREFIX=orocos) and then start the deployer for your platform:
$ deployer-gnulinux Switched to : Deployer This console reader allows you to browse and manipulate TaskContexts. You can type in an operation, expression, create or change variables. (type 'help' for instructions and 'ls' for context info) TAB completion and HISTORY is available ('bash' like) Deployer [S]> import("myrobot") = true Deployer [S]> displayComponentTypes I can create the following component types: Myrobot OCL::ConsoleReporting OCL::FileReporting OCL::HMIConsoleOutput OCL::HelloWorld OCL::TcpReporting OCL::TimerComponent = (void) Deployer [S]> loadComponent("TheRobot","Myrobot") Myrobot constructed ! = true Deployer [S]> cd TheRobot Switched to : TheRobot TheRobot [S]> ls Listing TaskContext TheRobot[S] : Configuration Properties: (none) Provided Interface: Attributes : (none) Operations : activate cleanup configure error getPeriod inFatalError inRunTimeError isActive isConfigured isRunning setPeriod start stop trigger update Data Flow Ports: (none) Services: (none) Requires Operations : (none) Requests Services : (none) Peers : (none)
You now need to consult the Component Builder's Manual for instructions on how to use and extend your Orocos component. All relevant documentation is available on the Toolchain Reference Manuals page.
The generated package contains a manifest.xml file and the CMakeLists.txt file will call ros_buildinit() if ROS_ROOT has been set and also sets the LIBRARY_OUTPUT_PATH to packagename/lib/orocos such that the ROS tools can find the libraries and the package itself. The ROS integration is mediated in the UseOrocos-RTT.cmake file, which gets included on top of the generated CMakeLists.txt file and is installed as part of the RTT. The Makefile file is rosmake compatible.
The OCL deployer knows about ROS packages and can import Orocos components (and their dependencies) from them once your ROS_PACKAGE_PATH has been correctly set.