470 likes | 606 Views
Context-based Robotic Systems. Dipartimento di Informatica e Sistemistica Sistemi Intelligenti per l’Emergenza e la Difesa Civile sied.dis.uniroma1.it. Daniele Nardi, Carlo Matteo Scalzo. Meanings of context. Cognitive science :
E N D
Context-based Robotic Systems Dipartimento di Informatica e Sistemistica Sistemi Intelligenti per l’Emergenza e la Difesa Civile sied.dis.uniroma1.it Daniele Nardi, Carlo Matteo Scalzo
Meanings of context Cognitive science: Human uses of contextual information (Context-07 Conference in Roskilde) Artificial Intelligence: View of a given representation (Mc Carthy) Hypothetical Reasoning Robotics: Turner 1998 … OpenRDK Workshop, Rome, March 2009
Context “A context is any identifiable configuration of environmental, mission-related and agent-related features that has predictive power for behaviour” [Turner 1998] Used for behaviour selection OpenRDK Workshop, Rome, March 2009
Motivation/related work How can the knowledge that robot is in a specific rescue scenario be used to improve performance? • Terrain classification for specialized behaviours [Dornege and Kleiner 2008] • Tuning localization and mapping based on environmental knowledge [Several authors] • Multi-Objective exploration [Calisi et. al 2007] • Driving object/people perception tracking [Several authors] OpenRDK Workshop, Rome, March 2009
Architecture (multi hyper graph) OpenRDK Workshop, Rome, March 2009
Contextual representation Behaviour Percept SLAM Nav+ Expl Blackboard (Repository) Practical (RDK) Architecture Context building Contextual reasoning OpenRDK Workshop, Rome, March 2009
Architecture in detail OpenRDK Workshop, Rome, March 2009
Current implementation in OpenRDK* • 100 variables • Input data • Input parameters • Knowledge based system to • Build single context (using all possible sources) • Reason about context to determine suitable values for module parameters implemented in PROLOG • IF THEN parameter = value A modular framework for Robotic Software Development http://openrdk.sf.net OpenRDK Workshop, Rome, March 2009
Experimental validation • Against whom ? Our rescue system with/without context • Which testbed ? USARSim Real Robots • Which tasks ? Localization and Mapping Mapping and Navigation Exploration and victim detection • Which performance metric? OpenRDK Workshop, Rome, March 2009
Our experimental system:SPQR-rescue Experiments with and without context OpenRDK Workshop, Rome, March 2009
Qualitative example: Navigation and Mapping OpenRDK Workshop, Rome, March 2009
Navigation and mapping (cnt’d) OpenRDK Workshop, Rome, March 2009
Localization and Mapping with RFIDs OpenRDK Workshop, Rome, March 2009
Mapping, Navigation and Exploration OpenRDK Workshop, Rome, March 2009
Context setting OpenRDK Workshop, Rome, March 2009
Experiment results OpenRDK Workshop, Rome, March 2009
Victim search and exploration in USARSim • S&R mission • Measures of performance: • amount of environment explored • number victims • Modules (with parameters): • navigation (planner, speed, jog) • mapping (on, scanmatch, elevation) • exploration (on, mobility, victims, distance, frontier) • victim perception (multi, snapshot, snap_distance) • Mission knowledge always available (with and without context) OpenRDK Workshop, Rome, March 2009
Experimental Setting: USARSIM Environment Indoor map used at German Open 2008 • Rescue robot • Pioneer 2AT • SICK LRF • HOKUYO (inclined) • Victim sensor OpenRDK Workshop, Rome, March 2009
Contextual rules OpenRDK Workshop, Rome, March 2009
Experimental evaluation: qualitative Repeated several times: • reduced stalls • larger explored area • more victims found • better reports generated Examples OpenRDK Workshop, Rome, March 2009
Results of the exploration and victim detection OpenRDK Workshop, Rome, March 2009
Conclusion Contextualization as a design pattern can be very effective in improving the performance of robots Single representation of context: • improved acquisition of contextual information • reasoning about context for • tuning performance • fault diagnosis and recovery Contextual knowledge is a requirement for rescue systems OpenRDK Workshop, Rome, March 2009
Future Work • Context acquisition • Push modularization • Mixed initiative high level control • Contextual exploration with multiple robots OpenRDK Workshop, Rome, March 2009
Implementation: OpenRDK Behaviour Nav + Expl Context-based controller Percept SLAM Blackboard (Repository) OpenRDK Workshop, Rome, March 2009
Behaviour Nav + Expl Context-based controller Percept SLAM Blackboard (Repository) Implementation: OpenRDK OpenRDK Workshop, Rome, March 2009
Programming languages C++ / Prolog interface Prolog Prolog / C++ interface OpenRDK Workshop, Rome, March 2009
Context-based controller • The context-based controller is a single (standard) OpenRDK module • A Prolog engine is embedded (as a C++ library) in the context-based controller • ECLiPSe Prolog was chosen as the Prolog engine because it can be easily embedded in a C++ system OpenRDK Workshop, Rome, March 2009
Context-based controller Context-based controller SLAM Percept ... ECLiPSe Prolog Blackboard (Repository) OpenRDK Workshop, Rome, March 2009
Control loop [1/2] Context-based controller ... Percept SLAM ECLiPSe Prolog Blackboard (Repository) OpenRDK Workshop, Rome, March 2009
Control loop [2/2] Context-based controller ... Percept SLAM ECLiPSe Prolog Blackboard (Repository) OpenRDK Workshop, Rome, March 2009
Context-based controller in OpenRDK : init() • The Prolog engine must be initialized in the init() function of the module • ec-init() starts the ECLiPSe Prolog engine • The knowledge base (one or more Prolog source files) must be compiled after the initialization of the Prolog engine • posting the goal compile(prologSource) compiles the kb OpenRDK Workshop, Rome, March 2009
init() [1/2] bool ContextPrologModule::init() { SESSION_TRY_START(session) // Start Eclipse Prolog engine char* eclipsedir = const_cast< char* > ((session->getString(PROPERTY_ECLIPSE_DIR)).c_str()); string prologsource = session->getString(PROPERTY_PROLOG_SOURCE); ec_set_option_ptr(EC_OPTION_ECLIPSEDIR, eclipsedir); if(ec_init() < 0) { RDK_ERROR_PRINTF("%s: could not initialize ECLiPSe\n",getModuleName().c_str()) ; return false ; } OpenRDK Workshop, Rome, March 2009
init() [2/2] // Compile Prolog source file string cmd = "compile('" + prologsource + "')"; char* compile = const_cast< char* > (cmd.c_str()); post_goal(compile); if(EC_resume() < 0) RDK_ERROR_PRINTF("%s: could not load Prolog source\n",getModuleName().c_str()); session->listenToTimer(500.); SESSION_END(session) return true; SESSION_CATCH_TERMINATE(session) return false; } OpenRDK Workshop, Rome, March 2009
A real example of control loop • Controller inputs: • 2D map (received from the SLAM module) • 2.5D map (received from the height-map module) • Controller outputs: • max speed value (sent to the motion planning module) • motion planner to use (sent to the motion planning module) OpenRDK Workshop, Rome, March 2009
A real example of control loop • Step 1: extracting contextual knowledge from controller’s inputs If clutterness-measure(2D-Map) > 0.5 Thenclutterness = high Elseclutterness = low If roughness-measure(2.5D-Map) > 0.5 Thenroughness = high Elseroughness = low C++ / Prolog interface OpenRDK Workshop, Rome, March 2009
C++ / Prolog interface • ECLiPSe Prolog terms can be created from C++ Strings using the EC_atom class String clutterness; if (clutternessMeasure(2dmap) > 0.5) then clutterness = “high”; else clutterness = “low”; EC_atom prologClutterness(const_cast< char* > (clutterness.c_str())); OpenRDK Workshop, Rome, March 2009
A real example of control loop • Step 2: reasoning IF (clutterness = high OR roughness = high) THEN max-speed = low ELSE max-speed = high IF (clutterness = high) THEN motion-planner = rkt ELSE motion-planner = dwa OpenRDK Workshop, Rome, March 2009
Reasoning in Prolog • The knowledge base contains all the rules used by the reasoning process % maxSpeedRule( Clutterness , Roughness , MaxSpeed ) maxSpeedRule( high , _ , low ) :- !. maxSpeedRule( _ , high , low) :- !. maxSpeedRule( _ , _ , high ):- !. OpenRDK Workshop, Rome, March 2009
A real example of control loop • Step 3: translating contextual knowledge in parameters for other modules If (maxSpeed = high) Then maxSpeedValue = 1 m / s If (maxSpeed = low) Then maxSpeedValue = 0.2 m / s If (motionPlanner = rkt) Then motionPlanningMode = 0 If (motionPlanner = dwa) Then motionPlanningMode = 1 Prolog / C++ interface OpenRDK Workshop, Rome, March 2009
Prolog / C++ interface % maxSpeedValue ( maxSpeed , maxSpeedValue ) maxSpeedValue ( high , 1 ) :- !. maxSpeedValue ( low , 0.2) :- !. • ECLiPSe Prolog terms can be translated into C++ doubles using the is_double() function • double maxSpeedValue; • ((EC_word) maxSpeed).is_double(&maxSpeedValue); OpenRDK Workshop, Rome, March 2009
Performance issues • The ECLiPSe Prolog engine is a C++ library: calling a predicate is almost as fast as calling a C++ function • The reasoning process is implemented as a Prolog program with no backtracking and no dynamic clause database management (i.e., no assert / retract) • The context-based controller OpenRDK module do not slow down the entire system OpenRDK Workshop, Rome, March 2009
Declarative Programming and Fast Prototyping • Why should we use Prolog to implement reasoning ? • Couldn’t we use C++ ? OpenRDK Workshop, Rome, March 2009
Reasoning: C++ implementation • Reasoning rules hardwired in the code (rules are specified using C++ if-then-else) • Pros: • No configuration is needed (OpenRDK is implemented in C++) • Cons: • To change the rules (or parts thereof) one has to modify the source code of the module • Writing complex rules using if-then-else constructs makes the code hard to read and mantain OpenRDK Workshop, Rome, March 2009
Reasoning: Prolog implementation • Reasoning rules are specified in a knowledge base (one or more Prolog source files), which is compiled when the module is initialized • Pros: • Rapid Prototyping: reasoning rules can be modified in the Prolog source file, no change to the source code of the module is needed • Complex rules can be easily expressed and managed • More advanced features: negation as failure, constraint programming • Cons: • To embed ECLiPSe Prolog in C++, a configuration phase is needed OpenRDK Workshop, Rome, March 2009
How to create an OpenRDK module embedding a Prolog engine • Configuration of the Prolog engine (i.e., linking it as a C++ library) • The module is a standard OpenRDK module: it reads its inputs from the blackboard and writes its outputs to the blackboard • The module is initialized by starting the Prolog engine and compiling the Prolog source files • Internally, C++ data can be easily translated into Prolog terms (and vice-versa) using specific C++ functions • The Prolog engine can be queried using specific C++ functions, thus obtaining the results of the reasoning phase OpenRDK Workshop, Rome, March 2009
Any Questions ? OpenRDK Workshop, Rome, March 2009
Contactsnardi@dis.uniroma1.itcmscalzo@gmail.com OpenRDK Workshop, Rome, March 2009