320 likes | 456 Views
Robotic software development and interoperability using the OpenRDK framework. Daniele Calisi , Andrea Censi. Software frameworks for robotics. Software frameworks are useful Promote standard design techniques Aim at code reusability (components) Provide ready-to-use design choices
E N D
Robotic software development and interoperability using the OpenRDK framework Daniele Calisi, Andrea Censi
Software frameworks for robotics • Software frameworks are useful • Promote standard design techniques • Aim at code reusability (components) • Provide ready-to-use design choices • Software frameworks for robotics • OROCOS (EURON project) • CLARAty (NASA) • OpenRTM-aist • Orca, Player/Stage, MARIE, MOAST, ROS, etc. Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Goals Ease of development fast prototyping concurrent engineering Ease of debugging (graphical) inspection tools common module structure Lightweightness and efficiency Modularity code reuse loosely coupling Configurability component and system configurability Interoperability conveniently exchange information with other systems/software OpenRDK summary • General information • Written in C++, supports C++ modules • Works on Linux, MacOsX, Windows (Cygwin) • It is Open Source ( http://openrdk.sf.net ) Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
OpenRDK main features and concepts RAgent (Process) Module (Thread) Module (Thread) Module (Thread) Module (Thread) Repository (Blackboard) Properties: rdk://agent2/localizer/odometry (pose) rdk://agent2/localizer/laserScan (scan) rdk://agent2/localizer/estimatedPose (pose) rdk://agent2/navigator/maxSpeed (double) rdk://agent2/mapper/map (map) rdk://agent2/navigator/userInfo (string) … Repository (Blackboard) Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
URL are globally unique Published property roles Input/Output Parameters Debug information, etc. Types Integers, strings, floating-point numbers, etc. Images, maps User defined types Implicit and explicit concurrent memory access Repository, properties and URLs No distinction! rdk://agent1/hwInterface/speed rdk://agent1/hwInterface/odometryPose rdk://agent1/hwInterface/robotSerialPort rdk://agent1/hwInterface/currentSpeed … rdk://agent2/localizer/laserScan rdk://agent2/localizer/estimatedPose rdk://agent2/mapper/map rdk://agent2/navigator/maxSpeed rdk://agent2/navigator/speed … Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
An example agent2 agent1 hwInterface localizer mapper navigator laserScan odometry robotPose map targetPose speed robotPose laserScan laserScan odometry estimatedPose map speed repository repository Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Property links rdk://agent1/hwInterface/laserScan rdk://agent1/hwInterface/odometry • Connect modules • Suggested policy • A module creates its own properties during the initialization • A module reads from and writes to its own properties • Property links • Connect inputs and outputs of different modules • Similar to UNIX symbolic links • Can refer to remote repositories rdk://agent2/localizer/odometry rdk://agent2/localizer/laserScan rdk://agent2/localizer/estimatedPose rdk://agent2/mapper/robotPose rdk://agent2/mapper/laserScan rdk://agent2/mapper/map rdk://agent2/navigator/map rdk://agent2/navigator/robotPose rdk://agent2/navigator/targetPose rdk://agent2/navigator/speed Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Property sharing rdk://agent1/hwInterface/laserScan rdk://agent1/hwInterface/odometry • A module, through links, can access remote properties • Repository actions: • Requests properties • Publishes them locally • Options: • When to send updates • Network protocol • Data reconstruction layer • E.g. maps, images, etc. Property sharing ON_CHANGE/PERIODIC TCP/UDP … Property sharing rdk://agent1/hwInterface/laserScan rdk://agent1/hwInterface/odometry rdk://agent2/localizer/odometry rdk://agent2/localizer/laserScan rdk://agent2/localizer/estimatedPose Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
The example revised agent2 agent1 hwInterface localizer mapper navigator laserScan odometry robotPose map targetPose speed robotPose laserScan laserScan odometry estimatedPose map speed repository repository Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
The example revised agent2 agent1 targetPose navigator speed hwInterface robotPose map odometry estimatedPose robotPose localizer mapper laserScan Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Configurability: configuration files and object persistence • Specify the initial configuration of each agent: the configuration file • Contains the list of modules to be instantiated • Contains property (initial) values (parameters, initial state) • Contains connections among modules • Can be used to • Load initial module parameters • Save and load module states • Load static inputs (e.g., pre-built maps) hwInterface (hwi.so) ip=192.168.0.1 laser= odometry=2.3 4.5 90° mapper (mymapper.so) robotPose= param1=32.4 param2=43.1 map=<map> laser= Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Tools: RConsole • RConsole implementation • Is itself an RAgent • Uses property sharing • Can be used for • Remote inspection • Debugging • Parameter tuning • Preliminary GUI building for specific applications Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Case study: concurrent engineering • Example: developing the localizer, mapper and navigator modules • Three students are assigned one module each • Hardware and simulator interface modules are already available • First step: interface design (inputs/outputs) hwInterface/speed (in) hwInterface/laserScan (out, queue) hwInterface/odometry (out, queue) localizer/odometry (in, queue) localizer/laserScan (in, queue) localizer/estimatedPose (out, queue) mapper/robotPose (in, queue) mapper/laserScan (in, queue) mapper/map (out) navigator/robotPose (in) navigator/targetPose (in) navigator/map (in) navigator/speed (out) Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Case study: the localizer module • Using logging/replaying during development • Save a log of a single run and then replay it • Use well-known logs databases (e.g., RAWSEEDS) hwInterface/speed (in) hwInterface/laserScan (out, queue) hwInterface/odometry (out, queue) logReader/fileName (param) logReader/odometry (out, queue) logReader/laserScan (out, queue) LOG localizer/odometry (in, queue) localizer/laserScan (in, queue) localizer/estimatedPose (out, queue) RESULT LOG logWriter/odometry (in, queue) logWriter/laserScan (in, queue) logWriter/fileName (param) Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Case study: the mapper module • Using odometry instead of estimated pose • Using simulator (e.g., Stage, USARSim, etc.) usarsimClient/speed (in) usarsimClient/laserScan (out, queue) usarsimClient/odometry (out, queue) hwInterface/speed (in) hwInterface/laserScan (out, queue) hwInterface/odometry (out, queue) localizer/odometry (in, queue) localizer/laserScan (in, queue) localizer/estimatedPose (out, queue) mapper/robotPose (in, queue) mapper/laserScan (in, queue) mapper/map (out) Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Case study: the navigator module • As before • Use odometry, simulator clients • Pre-built map from configuration file • RConsole for target poses input hwInterface/speed (in) hwInterface/laserScan (out, queue) hwInterface/odometry (out, queue) usarsimClient/speed (in) usarsimClient/laserScan (out, queue) usarsimClient/odometry (out, queue) localizer/odometry (in, queue) localizer/laserScan (in, queue) localizer/estimatedPose (out, queue) mapper/robotPose (in, queue) mapper/laserScan (in, queue) mapper/map (out) navigator/robotPose (in) navigator/targetPose (in) navigator/map (in) navigator/speed (out) MAP (configuration file) Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Interoperability: libraries and drivers • OpenRDK provides conversion utilities for using third-party libraries • OpenCV, OpenGL, GMapping, Jabon (SOAP utility), etc. • Well-known sensor/actuator classes, simulators and universal drivers are supported with interface modules • Robot bases, Laser Scanners, Pan-Tilt units, IMUs, Cameras, etc. • Player/Stage/Gazebo, USARSim, Webots, NaoQi GMapping Jabon Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Interoperability: exposing the whole repository • There is no current standard for interconnection (communications and/or middleware) • OpenRDK information sharing model • All relevant information resides in the repository • A module can expose the whole repository using (almost) any data-oriented protocol/specification/standard (e.g., DDS) • Extend the property link mechanism (different protocols, e.g.: “rdk://”, “file://”, “http://”, “dds://”, etc.): transparent for the modules • Interface to future standard data-oriented middleware can be implemented straightforwardly (without changes to the core) • Using OpenRDK we can delay the final choice Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Opening to the world: the easy way Module1 Module2 ? HTTP/1.1 Server 8080 80 Repository 80 Web server (e.g. Apache) • Build a GUI using HTML, AJAX, etc. • Connect to your robot at home • Connect to a robotized camera • Connect to a museum robotic guide • etc. Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Property sharing through a DDS (work in progress) • OMG Specification (Real-time Data Distribution System), some implementations available • Data-oriented middleware • Complex QoS control Other system Module1 Module2 Module1 Module2 Repository Repository Other system Other system DDS Bridge DDS Bridge Data Distribution System Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
OpenRDK current applications • Rescue wheeled robots (real robots, USARSim) • RoboCare project (assistive robots for the elders) • Quadrotor, tarantula (real robots, USARSim) • RoboCup Standard Platform League (“Nao league”) • Used by two research groups • “Sapienza” University of Rome • Universidad Politécnica de Madrid • First OpenRDK workshop Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Summary • OpenRDK features • Modularity and concurrent engineering • Code reuse, configurability • Full multi-thread support • Blackboard-style communication enforces interoperability • Tools (Logging/replaying, RConsole, etc.) • Open source (GPL license) On-going and future work • On-line fault detection system • Configuration file editing and analysis tools • Graphical on-line (modules as plugins) configuration editor • Detect possible deadlocks • Verify constraints on schedule • More connectivity with the rest of the world • Scripting (Ruby, Python) support • Design a better logo! Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
http://openrdk.sourceforge.net References: D. Calisi, A. Censi, L. Iocchi, D. Nardi. OpenRDK: a modular framework for robotic software development. In Proc. of of Int. Conf. on Intelligent Robots and Systems (IROS). Nice, France. September, 2008. pp. 1872-1877. D. Calisi, A. Censi, L. Iocchi, D. Nardi. OpenRDK: a framework for rapid and concurrent software prototyping. In Proc. of Int. Workshop on System and Concurrent Engineering for Space Applications (SECESA). November, 2008. D. Calisi, A. Censi, L. Iocchi, D. Nardi. Modular and flexible robotic software development using the OpenRDK framework. Under review. Credits: Prof. Daniele Nardi Developers: Daniele Calisi, Andrea Censi - Early contributors: A. Farinelli, G. Grisetti, L. Iocchi Current contributors: F. Giannone, L. Iocchi, M. Leonetti, L. Marchetti, D. Nardi, P. de la Puente, G. Randelli, M. Sbarigia, A. Valero, R. Vicario Thanks for your attention Any questions or comments? Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Module code class TemplateModule { public: TemplateModule(); virtual ~TemplateModule(); bool initConfigurationProperties(); // bool initInterfaceProperties(); bool init(); void exec(); // void exitRequested(); // void cleanup(); // void asyncAgentCmd(cstr cmd); }; Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
initConfigurationProperties() #define PROPERTY_ALPHA “in/alpha” #define PROPERTY_BETA “in/beta” #define PROPERTY_RESULT “out/result” #define PROPERTY_MY_MAP “out/myMap” bool MyModule::initConfigurationProperties() { SESSION_TRY_START(session) // ... session->createDouble(PROPERTY_ALPHA, "Alpha", RDouble::SEC, 10.); session->createDouble(PROPERTY_BETA, "Beta", RDouble::RAD, deg2rad(20.)); session->createDouble(PROPERTY_RESULT, “Result", RDouble::M, 100.); session->createMap(PROPERTY_MY_MAP, “The map", 1., 2., 0., 10., 20, 20); SESSION_END(session) returntrue; SESSION_CATCH_TERMINATE(session) returnfalse; } Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
init() bool MyModule::init() { SESSION_TRY_START(session) // open sockets... // connect to hardware... session->listenToTimer(500.); SESSION_END(session) returntrue; SESSION_CATCH_TERMINATE(session) returnfalse; } Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS • Can listen to: • timers • property changes • nothing (non-OpenRDK entities: sockets, drivers, ...)
exec() void MyModule::exec() { while (session->wait(), !exiting) { SESSION_TRY_START(session) double alpha = session->getDouble(PROPERTY_ALPHA); double beta = session->getDouble(PROPERTY_BETA); double gamma = alpha * beta; session->setDouble(PROPERTY_RESULT, gamma); session->lock(PROPERTY_MY_MAP, HERE); RMapImage* m = session->getObjectAsL<RMapImage>(PROPERTY_MY_MAP); m->setPixelB(0, 0, RImage::C8Red); session->unlock(PROPERTY_MY_MAP); SESSION_END_CATCH_TERMINATE(session) } } Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Queues as object dispatchers • Producer/consumer problem; FIFO • Addressed like other properties (URL) • Features • multiple consumers (concurrently) • no object duplication • automatic garbage collection • filters • passive • Can be used for • localization (e.g., laser) • logging Module Queue Queue Queue Module Module Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Concurrent memory access: the session object RAgent Module Module Module Module session session session session Repository Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
Concurrent access management: locks lock() get value unlock() return value double a = session->getDouble(…) session->lock(A) myObject = session->getObject(A) myObject.function1(); myObject.function2(); session->unlock(A) Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS OpenRDK provides implicit locks/unlocks… …and explicit locks/unlocks (e.g., large objects)
Connection to RT systems RT-Process Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS
The session object • Similar to DBMS sessions • Recover locked properties • Repository and ModuleManager communication • e.g. session->wait() • URL context (e.g., “/robot/”) • Caching of property names • Starting and ending a session collect statistics (e.g., iteration duration, time between two start, etc.) • Sessions and threads • Mutex (lock/unlock) clean management • One session for each thread (you can create other sessions for your own threads) Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS