robotic software development and interoperability using the openrdk framework daniele calisi, andrea...
TRANSCRIPT
Robotic software development Robotic software development and interoperability using the and interoperability using the
OpenRDK frameworkOpenRDK framework
Daniele Calisi, Andrea Censi
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 2
Software frameworks for roboticsSoftware 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 3
OpenRDK summaryOpenRDK summary 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
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 4
OpenRDK main features and conceptsOpenRDK 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 5
Repository, properties and URLsRepository, properties and URLs 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
rdk://agent1/hwInterface/speedrdk://agent1/hwInterface/odometryPoserdk://agent1/hwInterface/robotSerialPortrdk://agent1/hwInterface/currentSpeed…
rdk://agent2/localizer/laserScanrdk://agent2/localizer/estimatedPoserdk://agent2/mapper/maprdk://agent2/navigator/maxSpeedrdk://agent2/navigator/speed…
No distinction!
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 6
An exampleAn example
hwInterface
agent1
localizer
agent2
mapper navigator
repositoryrepository
speed
laserScanodometry
laserScanodometry
estimatedPose
robotPoselaserScan
map
robotPosemap
targetPose
speed
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 7
Property linksProperty links 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/laserScanrdk://agent2/localizer/estimatedPose
rdk://agent2/mapper/robotPoserdk://agent2/mapper/laserScanrdk://agent2/mapper/map
rdk://agent2/navigator/maprdk://agent2/navigator/robotPoserdk://agent2/navigator/targetPoserdk://agent2/navigator/speed
rdk://agent1/hwInterface/laserScanrdk://agent1/hwInterface/odometry
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 8
Property sharingProperty sharing
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.
rdk://agent1/hwInterface/laserScanrdk://agent1/hwInterface/odometry
rdk://agent2/localizer/odometry rdk://agent2/localizer/laserScanrdk://agent2/localizer/estimatedPose
rdk://agent1/hwInterface/laserScanrdk://agent1/hwInterface/odometry
Property sharing
Property sharing
ON_CHANGE/PERIODICTCP/UDP
…
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 9
The example revisedThe example revised
hwInterface
agent1
localizer
agent2
mapper navigator
repositoryrepository
speed laserScanodometry
robotPoselaserScan
robotPosemap
targetPoselaserScanodometry
estimatedPose map speed
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 10
The example revisedThe example revised
hwInterface
agent1
localizer
agent2
mapper
navigator
robotPose
targetPose
estimatedPose
map
robotPoseodometry
laserScan
speed
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 11
Configurability: Configurability: configuration files and object persistenceconfiguration 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 12
Tools: RConsoleTools: 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 13
Case study: concurrent engineeringCase 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 14
Case study: the localizer moduleCase 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)
localizer/odometry (in, queue)localizer/laserScan (in, queue)localizer/estimatedPose (out, queue)
hwInterface/speed (in)hwInterface/laserScan (out, queue)hwInterface/odometry (out, queue)
logWriter/odometry (in, queue)logWriter/laserScan (in, queue)logWriter/fileName (param)
logReader/fileName (param)logReader/odometry (out, queue)logReader/laserScan (out, queue)
LOG
RESULTLOG
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 15
usarsimClient/speed (in)usarsimClient/laserScan (out, queue)usarsimClient/odometry (out, queue)
Case study: the mapper moduleCase study: the mapper module
Using odometry instead of estimated pose Using simulator (e.g., Stage, USARSim, etc.)
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 16
Case study: the navigator moduleCase 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)
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)
usarsimClient/speed (in)usarsimClient/laserScan (out, queue)usarsimClient/odometry (out, queue)
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 17
Interoperability: libraries and driversInteroperability: 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
GMappingJabon
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 18
Interoperability: exposing the whole repositoryInteroperability: 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 20
Opening to the world: the easy wayOpening to the world: the easy way
Module1HTTP/1.1
ServerModule2
Repository
Web server(e.g. Apache)
?80
80
8080
•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 21
Property sharing through a DDS (work in progress)Property sharing through a DDS (work in progress)
OMG Specification (Real-time Data Distribution System), some implementations available
Data-oriented middleware Complex QoS control
Module1 Module2
Repository
DDS Bridge
Data Distribution System
Other
system
Other
system
Other
system
Module1 Module2
Repository
DDS Bridge
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 22
OpenRDK current applicationsOpenRDK 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 23
SummarySummary 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-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!
On-going and future workOn-going and future work
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 24
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 NardiDevelopers: Daniele Calisi, Andrea Censi - Early contributors: A. Farinelli, G. Grisetti,
L. IocchiCurrent 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 attentionAny questions or comments?
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 25
Module codeModule 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 26
#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) return true; SESSION_CATCH_TERMINATE(session) return false;}
initConfigurationProperties()initConfigurationProperties()
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 27
bool MyModule::init(){ SESSION_TRY_START(session) // open sockets... // connect to hardware... session->listenToTimer(500.); SESSION_END(session) return true; SESSION_CATCH_TERMINATE(session) return false;}
Can listen to: timers property changes nothing (non-OpenRDK entities: sockets, drivers, ...)
init()init()
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 28
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) }}
exec()exec()
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 29
Queues as object dispatchersQueues 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
ModuleModule
QueueQueue
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 30
Concurrent memory access: the session objectConcurrent memory access: the session object
RAgent
Module ModuleModule Module
Repository
session session session session
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 31
OpenRDK provides implicit locks/unlocks…
…and explicit locks/unlocks (e.g., large objects)
Concurrent access management: locksConcurrent access management: locks
double a = session->getDouble(…)
lock()get valueunlock()return value
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 32
Connection to RT systemsConnection to RT systems
RT-Process
Robotic software development and interoperability using the OpenRDK framework - ICAR2009 WS 33
The The sessionsession object 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)