210 likes | 407 Views
Applying MDE for AIBO. AIBO. Robot made by Sony. AIBO motors. AIBO Motors. AIBO sensors. Thanks to its motors AIBO can move Walk, lay down, .. But AIBO can also see listen touch It is a reactive system that reacts to its environment !. URBI : playing with AIBO.
E N D
AIBO Robot made by Sony
AIBO sensors • Thanks to its motors AIBO can move • Walk, lay down, .. • But AIBO can also • see • listen • touch • It is a reactive system that reacts to its environment !
URBI : playing with AIBO • URBI is a language for programming robots. • Interaction with AIBO • one can ask to AIBO to do something • robot.walk() • robot.lay() • one can ask the value of its sensors • camera.val • URBI defines control commands (for, if, …)
Demo robot.initial(); robot.stand(); robot.sit(); robot.initial();
AIBO in UML A UML model of AIBO
The AiboMove Class Head motors Legs motors URBI functions, provided by URBI developers
AIBO Behavior = State Machine • A state machine can be associated with a class to define the behavior of all objects instances of the class. • As AIBO is modeled with a class, state machines seem to be a natural choice Moreover, with AIBO • States are quite easy to identify (walking, …) • Assign a « doActivity » with a state • Transitions correspond to events sent by the environment
Code Generation Complete generation of URBI code
Process 2) The user elaborates its own state machine. 1) The class is provided by the development environment 3) The code is completely generated.
Generation rules • For each state, define a new function • The function will be called when the event corresponding to the target transition of the state will occur • The function realizes the doActivity of the state • For each transition define an event • The event will be caught and then the function corresponding to the target state will be called
at (t3 && currentState==etape2) { prefix : etape3() ; } def fonction etape3 { currentState = etape3 ; robot.walk() ; } Generation Rules
Next step • The elaboration of a state machine is still a difficult task. • A lot of works have been done to generate state machines from scenarios • The user will then define AIBO behavior thanks to a set of scenarios. A state machine will be generated from those scenarios. And the code will be generated from the state machine. • All transformations will be model transformations.
MDE Environment Customized Tools
RSA • RSA (Rational Software Architect) provides a UML editor but also mechanisms to enhance it. • This editor manipulates UML models thanks to a Java API • The UML2.0 Java API of RSA is an open source API (http://www.eclipse.org/uml2) • We make use of this API to build our generator.
Generator for state public void generateTransition(Transition tr) { if (tr.getSource() instanceof Pseudostate) { Pseudostate ps = (Pseudostate) tr.getSource(); if (ps.getKind().getValue() == PseudostateKind.INITIAL) { generateStartTransition(tr); } } else if (tr.getTarget() instanceof Pseudostate) return; else { if (tr.getTriggers().size() == 0) generateTransitionWithourTrigger(tr);//NOT STANDARD else { Trigger trig = (Trigger) tr.getTriggers().get(0); if (trig instanceof TimeTrigger) generateAfterTransition(tr); else if (trig instanceof ChangeTrigger) generateChangeTransition(tr); } } }
Synthesis • The AIBO code generation shows that MDE is fully operational • UML can be used to specify all the behavior of AIBO • it seems that URBI functions could be also modeled completely with UML • Tools, such as RSA, do support MDE and offer powerful mechanisms