Date post: | 27-Mar-2015 |
Category: |
Documents |
Upload: | leslie-gonzales |
View: | 214 times |
Download: | 0 times |
Daniele Nardi, Carlo Matteo Scalzo
Context-based Robotic Systems
Dipartimento di Informatica e SistemisticaSistemi Intelligenti per l’Emergenza e la Difesa Civilesied.dis.uniroma1.it
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 2
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 …
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 3
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 4
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]
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 5
Architecture (multi hyper graph)
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 6
Percept SLAM Nav+
ExplBehaviour
Blackboard (Repository)
Contextual
representation
Practical (RDK) Architecture
Contextual reasoning
Context building
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 7
Architecture in detail
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 8
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 A modular framework for Robotic Software DevelopmentRobotic Software Developmenthttp://openrdk.sf.net
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 9
Experimental validation
• Against whom ? Our rescue system with/without context• Which testbed ?USARSimReal Robots • Which tasks ?Localization and MappingMapping and NavigationExploration and victim detection• Which performance metric?
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 10
Our experimental system:SPQR-rescue
Experiments with and without context
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 11
Qualitative example: Navigation and Mapping
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 12
Navigation and mapping (cnt’d)
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 13
Localization and Mapping with RFIDs
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 14
Mapping, Navigation and Exploration
QuickTime™ e undecompressore
sono necessari per visualizzare quest'immagine.
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 15
Context setting
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 16
Experiment results
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 17
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)
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 18
Experimental Setting: USARSIM
EnvironmentIndoor map used at German Open 2008
Rescue robotPioneer 2AT•SICK LRF•HOKUYO (inclined)•Victim sensor
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 19
Contextual rules
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 20
Experimental evaluation: qualitative
Repeated several times:- reduced stalls- larger explored area- more victims found- better reports generated
Examples
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 21
Results of the exploration and victim detection
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 22
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 23
Future Work
• Context acquisition• Push modularization• Mixed initiative high level control• Contextual exploration with multiple robots
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 24
Implementation: OpenRDK
Percept SLAMNav
+
Expl
Behaviour
Blackboard (Repository)
Context-based
controller
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 25
Percept
SLAMNav
+
ExplBehaviou
r
Blackboard (Repository)
Context-based
controller
Implementation: OpenRDK
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 26
Programming languages
C++ / Prolog interface
Prolog / C++ interface
Prolog
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 27
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 28
Context-based controller
Context-based controller
ECLiPSe Prolog
Blackboard (Repository)
SLAM ... Percept
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 29
Control loop [1/2]
Context-based controller
ECLiPSe Prolog
Blackboard (Repository)
SLAM...
Percept
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 30
Control loop [2/2]
Context-based controller
ECLiPSe Prolog
Blackboard (Repository)
SLAM...
Percept
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 31
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 32
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 ;
}
init() [1/2]
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 33
// 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;
}
init() [2/2]
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 34
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)
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 35
A real example of control loop
• Step 1: extracting contextual knowledge from controller’s inputs
If clutterness-measure(2D-Map) > 0.5Then clutterness = highElse clutterness = low
If roughness-measure(2.5D-Map) > 0.5Then roughness = highElse roughness = low
C++ / Prolog interface
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 36
C++ / Prolog interface
String clutterness;
if (clutternessMeasure(2dmap) > 0.5)
then
clutterness = “high”;
else
clutterness = “low”;
EC_atom prologClutterness(const_cast< char* > (clutterness.c_str()));
• ECLiPSe Prolog terms can be created from C++ Strings using the EC_atom class
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 37
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 38
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 ):- !.
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 39
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 40
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);
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 41
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 42
Declarative Programming and Fast Prototyping
• Why should we use Prolog to implement reasoning ?
• Couldn’t we use C++ ?
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 43
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 44
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 45
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
18-03-2009OpenRDK Workshop, Rome, March 2009 Pagina 46
Any Questions ?