SlideShare a Scribd company logo
1 of 59
Using Smalltalk for
controlling robotics
     systems
 Serge.Stinckwich@doesNotUnderstand.org
   ESUG (European Smalltalk User Group)
Introduction to
Smalltalk&Embedded
       System
Development on
 Embedded Systems
• Pourcentage of micro-processors used for
  embedded systems are increasing,
• Time development of embedded systems is
  very-time consuming,
• Lack of support of incremental
  development, dynamic updates of deployed
  systems.
Embedded Smalltalk -
   a long story ...
•   1989 - Canadian NAVY CANEWS-2 ESM System (Passive
    Radar Receiver) - 130K code (90% Smalltalk) - Multi-
    processor Smalltalk

•   Process control: Allen Bradley Network Manager - Network
    configuration (Smalltalk+C)

•   1992 - Integrated Manufacturing: TI Works - Integrated Wafer
    Fabrication Facility

•   1998 - Automotive: IBM Network Vehicle (Smalltalk) -
    Control bus device interfacing + wireless communication

•   Now - AMD production chain
Tektronix Smalltalk
•   Tektronix TDS 500 Series
    Oscilloscopes (1987)

•   Multiprocessor
    MC68020&DSP

•   Smalltalk + C (legacy)
    +Assembler (DSP)

•   Approx. 250 classes (all in
    ROM, use less than 64K
    DRAM).
Resilient Smalltalk
• Resilient Smalltalk Embedded Platform
   (OOVM) (2004)
• Used in Bang&Olufsen (B&O) digital
   speakers prototypes
GPIO = Object ( | io |
)
initialize = ( io := Memory at: 16r90040000 size: 16r20.
)
setOutput: pins = ( io longAt: 16r08 put: pins.
)
clearOutput: pins = ( io longAt: 16r0C put: pins.
)
Why Smalltalk for
     robotics ?
• Simple Syntax: easy to generate code from
  Smalltalk + DSL for robotics&WSN
• Portable & small VM (Squeak+Pharo VM)
• Uniformity: Everything is written in
  Smalltalk
• Highly dynamic language
Simple syntax
• Uniform: only message sending,
• Only 6 keywords: nil, true, false, self, super,
  thisContext
• Simple AST: 11 different nodes
• Accessible by a non-specialist
• Very simple to define embedded Domain-
  Specific Languages (DSL)
sujet verbe complément.
album joue.
album joue.

album jouePiste: 3.
album joue.

   album jouePiste: 3.

album répèteLesPistesDe:2
       àLaPiste:5.
album play.

   album playTrack: 3.

album repeatTracksFrom:2
          to:5.
exampleWithNumber: x
"Ceci est une méthode qui illustre chacun des aspects de
 la syntaxe de Smalltalk."
|y|
true & false not & (nil isNil) ifFalse: [self halt].
y := self size + super size.
#($a #a 'a' 1 1.0)
      do: [:each | Transcript
      show: (each class name);
      show: (each printString);
      show: ' '].
^x<y
Turtles all the way
              down

•   All systems objects are
    accessible

    •   Fix it yourself !

    •   Learn how things work

    •   See how the master code
Integer>>factorial

 "Answer the factorial of the receiver."


 self = 0 ifTrue: [^ 1].

 self > 0 ifTrue: [^ self * (self - 1) factorial].

 self error: 'Not valid for negative integers'



 6 factorial.
ifTrue:ifFalse:




True>>ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock


   "Answer with the value of trueAlternativeBlock. Execution does not

   actually reach here because the expression is compiled in-line."


   ^trueAlternativeBlock value
<primitive: x>

SmallInteger>>+ aNumber

 "Primitive. Add the receiver to the argument and
answer with the result

 if it is a SmallInteger. Fail if the argument or the
result is not a

 SmallInteger Essential No Lookup. See Object
documentation whatIsAPrimitive."


   <primitive: 1>

   ^ super + aNumber
Portable Smalltalk
         VM
• Original embedded Smalltalk VM assumed
  less than 12 basic platform functions
  (clock, memory, interrupts)
• Most function supplied by dynamically
  installable modules (don’t assume you can
  reboot !)
• You only need to port the VM
VM
• Pharo written in Slang (a subset of Smalltalk),
  then translated in C to be executed at full
  speed
• VM can be simulate in the Smalltalk
  environment !
• FFI
• Plugins are coded in Slang (mp3, ogg, serial
  port, ...)
Smalltalk an ubiquitous
application developement
   environment (years
      before Java) !
1


    WifiBotST:
controling WifiBot
  from Smalltalk
WifiBot
myMission := WifiBotMission new.
arena := ArenaForMorphicWifiBot new.
arena mission: myMission.
arena width: 1000.
arena height: 600.
arena openInWorld.
obstacle := RectangleMorph new.
obstacle width: 100.
obstacle height: 50.
obstacle color: Color black.
arena addMorph: obstacle.
obstacle position: 400@300.
bot1 := ObstacleAvoiderWifiBot morphic.
bot1 body openIn: arena.
bot1 body positionInArena: 400@200.
bot1 forwardSpeed: 40.
bot1 rotationSpeed: 20.

bot2 := ObstacleAvoiderWifiBot morphic.
bot2 body openIn: arena.
bot2 body positionInArena: 400@500.
bot2 forwardSpeed: 30.

myMission start.
Main abstract classes


• WifiBot (body)
 • #body, #body:, #step
• WifiBotBody (bot)
SimpleReactiveWifiBot
step


   self body updateSensorValues.

   self computeActuatorValues.

   self body commitActuatorValues

computeActuatorValues


   "Subclasses may redefine this method"

   self body forwardSpeed: self
         forwardSpeed rotationSpeed: self rotationSpeed
ObstacleAvoiderWifiBot

computeActuatorValues

"Move forward or turn to avoid obstacles"
self body distanceToRightObstacles < 50
 ifTrue: [^ self body forwardSpeed: 0 rotationSpeed: -30].
self body distanceToLeftObstacles < 50
 ifTrue: [^ self body forwardSpeed: 0 rotationSpeed: 30].
super computeActuatorValues.
Graphical vs Physical
        bodies


• Graphical body: MorphicWifiBotBody
• Physical body: RealWifiBotBody
• Same API
Demo WifibotST
WifiBotST

• Control&Simulation of WifiBot in Smalltalk
• http://vst.ensm-douai.fr/WifiBotST
• http://www.squeaksource.com/WifiBotST
• MIT licence
• Autonomous version (WifiBot embedded
  VM)
2

   libUrbi.st:
 urbiscript code
generation from
   Smalltalk
urbiscript

• Prototype-based event-based object-
  oriented script language,
• Support for several robots platforms &
  simulation engines (Webots, AIBO, NAO,
  Bioloid, Mindstorms NXT, Spykee)
libUrbi.st

• Write&debug a Smalltalk program,
• Generate urbiscript code to deploy the
  program on the robot,
• Generation done with the help of
  Refactoring Browser (RB) AST & Visitor
  Pattern.
11 main RB AST
        nodes
• RBMethodNode, RBPragmaNode,
  RBReturnNode, RBArrayNode,
  RBAssignementNode, RBBlockNode,
  RBCascadeNode, RBLiteralArrayNode,
  RBLiteralValueNode, RBMessageNode,
  RBVariableNode
• All subclasses of RBProgramNode
• Implement all the method acceptVisitor:
Visitor Pattern
Represent an operation to be
performed on the elements of an
object structure in a class
separate from the elements
themselves.
Visitors lets you define a new
operation without changing the
classes of the elements on which
it operates.
The Design Patterns
Smalltalk Companion
Conversion examples
UrbiScriptConverterTest>>testEcho

 | tree result |

 tree := RBParser parseExpression: '1 echo'.

 result := UrbiScriptConverter new
                 visitNode: tree.

 self assert: result contents = 'echo(1)'.

  tree := RBParser
     parseExpression: '1 to:10 do:[:i| i echo]'.

 result := UrbiScriptConverter new
                 visitNode: tree.

 self assert: result
    contents = 'for(var i=1;i<=10;i+=1){echo(i)}'
One acceptXXXNode:
  for each RB AST node

UrbiScriptConverter>>acceptRetu
rnNode: aReturnNode


 stream nextPutAll: 'return '.
    self visitNode: aReturnNode
                value
libUrbi.st demo
libUrbi.st

• urbiscript code generation from a subset of
  Smalltalk
• http://www.squeaksource.com/libUrbi
• MIT licence
3


     PlayerST:
 client for Player/
Stage robotic device
       server
Player/Stage
•   Player provide an interface to a
    variety of robot and sensor
    hardware (lasers, sonars, IR sensors,
    camera). Player’s client/server
    architecture allows to robot control
    programs to be written in any
    programming language.

•   Stage simulates a population of
    mobile robots and sensing a two-
    dimensional bitmapped environment.
PlayerST Demo
PlayerST

• http://www1.ifi.auf.org/mediawiki/
  index.php/Smalltalk_Player_Client
• http://www.squeaksource.com/
  PlayerST.html
• MIT Licence
4

    SqueakBot:
pedagogical robotics
    with Etoys
SqueakBot

• Educational platform developed in Squeak
  Smalltalk,
• Allow childrens to visually script and
  simulate various kinds of robots,
• In partnership with Planète Sciences.
Exploration robot
Robotic Caterpillar
Walking Robot
Demo Etoys
SqueakBot


• Linux+ paper (September 2007)
• http://wiki.laptop.org/go/Projects/
  SqueakBot
• Licence MIT
Other personal
      projects
• ROAR: RObotics AlgoRithms (exploration
  strategy, occupancy grids),
• Calder: Multi-robots visualization engine
  with domain-specific scripting language
  based on Mondrian.
Conclusion

• Simple Syntax: easy to generate code from
  Smalltalk + DSL for robotics&WSN
• Portable & small VM (Pharo VM)
• Uniformity: Everything is written in
  Smalltalk
• Highly dynamic language
http://www.esug.org/

More Related Content

What's hot

Xebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Xebia Knowledge Exchange (feb 2011) - Large Scale Web DevelopmentXebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Xebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Michaël Figuière
 
Dds presentation omg
Dds presentation omgDds presentation omg
Dds presentation omg
milsoftSDC
 
Nvidia cuda tutorial_no_nda_apr08
Nvidia cuda tutorial_no_nda_apr08Nvidia cuda tutorial_no_nda_apr08
Nvidia cuda tutorial_no_nda_apr08
Angela Mendoza M.
 

What's hot (20)

Quantum Folsom Summit Developer Overview
Quantum Folsom Summit Developer OverviewQuantum Folsom Summit Developer Overview
Quantum Folsom Summit Developer Overview
 
GPU Virtualization on VMware's Hosted I/O Architecture
GPU Virtualization on VMware's Hosted I/O ArchitectureGPU Virtualization on VMware's Hosted I/O Architecture
GPU Virtualization on VMware's Hosted I/O Architecture
 
Dino2 - the Amazing Evolution of the VA Smalltalk Virtual Machine
Dino2 - the Amazing Evolution of the VA Smalltalk Virtual MachineDino2 - the Amazing Evolution of the VA Smalltalk Virtual Machine
Dino2 - the Amazing Evolution of the VA Smalltalk Virtual Machine
 
Instrumenting the real-time web: Node.js in production
Instrumenting the real-time web: Node.js in productionInstrumenting the real-time web: Node.js in production
Instrumenting the real-time web: Node.js in production
 
Apache CloudStack AlpesJUG
Apache CloudStack AlpesJUGApache CloudStack AlpesJUG
Apache CloudStack AlpesJUG
 
Understanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual MachineUnderstanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual Machine
 
NVidia CUDA Tutorial - June 15, 2009
NVidia CUDA Tutorial - June 15, 2009NVidia CUDA Tutorial - June 15, 2009
NVidia CUDA Tutorial - June 15, 2009
 
What's New in the JVM in Java 8?
What's New in the JVM in Java 8?What's New in the JVM in Java 8?
What's New in the JVM in Java 8?
 
Dvm
DvmDvm
Dvm
 
Quantum for Cloud Operators - Folsom Conference
Quantum for Cloud Operators  - Folsom Conference Quantum for Cloud Operators  - Folsom Conference
Quantum for Cloud Operators - Folsom Conference
 
CloudStack for Java User Group
CloudStack for Java User GroupCloudStack for Java User Group
CloudStack for Java User Group
 
Defeating Data Execution Prevention and ASLR in Windows
Defeating Data Execution Prevention and ASLR in WindowsDefeating Data Execution Prevention and ASLR in Windows
Defeating Data Execution Prevention and ASLR in Windows
 
Xebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Xebia Knowledge Exchange (feb 2011) - Large Scale Web DevelopmentXebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Xebia Knowledge Exchange (feb 2011) - Large Scale Web Development
 
Java on the GPU: Where are we now?
Java on the GPU: Where are we now?Java on the GPU: Where are we now?
Java on the GPU: Where are we now?
 
Dds presentation omg
Dds presentation omgDds presentation omg
Dds presentation omg
 
Docker San Diego 2015-03-25
Docker San Diego 2015-03-25Docker San Diego 2015-03-25
Docker San Diego 2015-03-25
 
Scalable networking in Apache CloudStack
Scalable networking in Apache CloudStackScalable networking in Apache CloudStack
Scalable networking in Apache CloudStack
 
Windows Azure Interoperability
Windows Azure InteroperabilityWindows Azure Interoperability
Windows Azure Interoperability
 
AI Hardware Landscape 2021
AI Hardware Landscape 2021AI Hardware Landscape 2021
AI Hardware Landscape 2021
 
Nvidia cuda tutorial_no_nda_apr08
Nvidia cuda tutorial_no_nda_apr08Nvidia cuda tutorial_no_nda_apr08
Nvidia cuda tutorial_no_nda_apr08
 

Similar to Using Smalltalk for controlling robotics systems

E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractions
Akshar Desai
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Kyle Drake
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
Praveen Gollakota
 

Similar to Using Smalltalk for controlling robotics systems (20)

JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
 
XRobots
XRobotsXRobots
XRobots
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
The State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila SzegediThe State of Managed Runtimes 2013, by Attila Szegedi
The State of Managed Runtimes 2013, by Attila Szegedi
 
Node azure
Node azureNode azure
Node azure
 
Loom promises: be there!
Loom promises: be there!Loom promises: be there!
Loom promises: be there!
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractions
 
JavaFX - Next Generation Java UI
JavaFX - Next Generation Java UIJavaFX - Next Generation Java UI
JavaFX - Next Generation Java UI
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVM
 
Experiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyExperiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRuby
 
WTF is Twisted?
WTF is Twisted?WTF is Twisted?
WTF is Twisted?
 
ZeroMQ
ZeroMQZeroMQ
ZeroMQ
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
 
Reactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDaysReactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDays
 
Java1 in mumbai
Java1 in mumbaiJava1 in mumbai
Java1 in mumbai
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
 
Original slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talkOriginal slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talk
 
Anton Moldovan "Building an efficient replication system for thousands of ter...
Anton Moldovan "Building an efficient replication system for thousands of ter...Anton Moldovan "Building an efficient replication system for thousands of ter...
Anton Moldovan "Building an efficient replication system for thousands of ter...
 

More from Serge Stinckwich

More from Serge Stinckwich (11)

Pure Coordination Using the Coordinator-Configurator Pattern
Pure Coordination Using the Coordinator-Configurator PatternPure Coordination Using the Coordinator-Configurator Pattern
Pure Coordination Using the Coordinator-Configurator Pattern
 
A Graphical Language for Real-Time Critical Robot Commands
A Graphical Language for Real-Time Critical Robot CommandsA Graphical Language for Real-Time Critical Robot Commands
A Graphical Language for Real-Time Critical Robot Commands
 
Dealing with Run-Time Variability in Service Robotics: Towards a DSL for Non-...
Dealing with Run-Time Variability in Service Robotics: Towards a DSL for Non-...Dealing with Run-Time Variability in Service Robotics: Towards a DSL for Non-...
Dealing with Run-Time Variability in Service Robotics: Towards a DSL for Non-...
 
Introduction to DYROS'10 Workshop
Introduction to DYROS'10 WorkshopIntroduction to DYROS'10 Workshop
Introduction to DYROS'10 Workshop
 
A DSL for the visualization of Multi-Robot Systems
A DSL for the visualization of Multi-Robot SystemsA DSL for the visualization of Multi-Robot Systems
A DSL for the visualization of Multi-Robot Systems
 
Visit to Vung Vieng Village - OLPC Vietnam
Visit to Vung Vieng Village - OLPC VietnamVisit to Vung Vieng Village - OLPC Vietnam
Visit to Vung Vieng Village - OLPC Vietnam
 
Pharo, an innovative and open-source Smalltalk
Pharo, an innovative and open-source SmalltalkPharo, an innovative and open-source Smalltalk
Pharo, an innovative and open-source Smalltalk
 
Smalltalk合同勉強会@名古屋 talk: Pharo introduction
Smalltalk合同勉強会@名古屋 talk: Pharo introductionSmalltalk合同勉強会@名古屋 talk: Pharo introduction
Smalltalk合同勉強会@名古屋 talk: Pharo introduction
 
Smalltalk合同勉強会@名古屋 talk : ESUG Introduction
Smalltalk合同勉強会@名古屋 talk : ESUG IntroductionSmalltalk合同勉強会@名古屋 talk : ESUG Introduction
Smalltalk合同勉強会@名古屋 talk : ESUG Introduction
 
An instrument whose music is ideas
An instrument whose music is ideasAn instrument whose music is ideas
An instrument whose music is ideas
 
Smalltalk Bar Camp Hanoi 2009
Smalltalk  Bar Camp Hanoi 2009Smalltalk  Bar Camp Hanoi 2009
Smalltalk Bar Camp Hanoi 2009
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Using Smalltalk for controlling robotics systems

  • 1. Using Smalltalk for controlling robotics systems Serge.Stinckwich@doesNotUnderstand.org ESUG (European Smalltalk User Group)
  • 3. Development on Embedded Systems • Pourcentage of micro-processors used for embedded systems are increasing, • Time development of embedded systems is very-time consuming, • Lack of support of incremental development, dynamic updates of deployed systems.
  • 4. Embedded Smalltalk - a long story ... • 1989 - Canadian NAVY CANEWS-2 ESM System (Passive Radar Receiver) - 130K code (90% Smalltalk) - Multi- processor Smalltalk • Process control: Allen Bradley Network Manager - Network configuration (Smalltalk+C) • 1992 - Integrated Manufacturing: TI Works - Integrated Wafer Fabrication Facility • 1998 - Automotive: IBM Network Vehicle (Smalltalk) - Control bus device interfacing + wireless communication • Now - AMD production chain
  • 5. Tektronix Smalltalk • Tektronix TDS 500 Series Oscilloscopes (1987) • Multiprocessor MC68020&DSP • Smalltalk + C (legacy) +Assembler (DSP) • Approx. 250 classes (all in ROM, use less than 64K DRAM).
  • 6. Resilient Smalltalk • Resilient Smalltalk Embedded Platform (OOVM) (2004) • Used in Bang&Olufsen (B&O) digital speakers prototypes GPIO = Object ( | io | ) initialize = ( io := Memory at: 16r90040000 size: 16r20. ) setOutput: pins = ( io longAt: 16r08 put: pins. ) clearOutput: pins = ( io longAt: 16r0C put: pins. )
  • 7. Why Smalltalk for robotics ? • Simple Syntax: easy to generate code from Smalltalk + DSL for robotics&WSN • Portable & small VM (Squeak+Pharo VM) • Uniformity: Everything is written in Smalltalk • Highly dynamic language
  • 8. Simple syntax • Uniform: only message sending, • Only 6 keywords: nil, true, false, self, super, thisContext • Simple AST: 11 different nodes • Accessible by a non-specialist • Very simple to define embedded Domain- Specific Languages (DSL)
  • 12. album joue. album jouePiste: 3. album répèteLesPistesDe:2 àLaPiste:5.
  • 13. album play. album playTrack: 3. album repeatTracksFrom:2 to:5.
  • 14. exampleWithNumber: x "Ceci est une méthode qui illustre chacun des aspects de la syntaxe de Smalltalk." |y| true & false not & (nil isNil) ifFalse: [self halt]. y := self size + super size. #($a #a 'a' 1 1.0) do: [:each | Transcript show: (each class name); show: (each printString); show: ' ']. ^x<y
  • 15. Turtles all the way down • All systems objects are accessible • Fix it yourself ! • Learn how things work • See how the master code
  • 16. Integer>>factorial "Answer the factorial of the receiver." self = 0 ifTrue: [^ 1]. self > 0 ifTrue: [^ self * (self - 1) factorial]. self error: 'Not valid for negative integers' 6 factorial.
  • 17. ifTrue:ifFalse: True>>ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock "Answer with the value of trueAlternativeBlock. Execution does not actually reach here because the expression is compiled in-line." ^trueAlternativeBlock value
  • 18. <primitive: x> SmallInteger>>+ aNumber "Primitive. Add the receiver to the argument and answer with the result if it is a SmallInteger. Fail if the argument or the result is not a SmallInteger Essential No Lookup. See Object documentation whatIsAPrimitive." <primitive: 1> ^ super + aNumber
  • 19. Portable Smalltalk VM • Original embedded Smalltalk VM assumed less than 12 basic platform functions (clock, memory, interrupts) • Most function supplied by dynamically installable modules (don’t assume you can reboot !) • You only need to port the VM
  • 20. VM • Pharo written in Slang (a subset of Smalltalk), then translated in C to be executed at full speed • VM can be simulate in the Smalltalk environment ! • FFI • Plugins are coded in Slang (mp3, ogg, serial port, ...)
  • 21. Smalltalk an ubiquitous application developement environment (years before Java) !
  • 22. 1 WifiBotST: controling WifiBot from Smalltalk
  • 24. myMission := WifiBotMission new. arena := ArenaForMorphicWifiBot new. arena mission: myMission. arena width: 1000. arena height: 600. arena openInWorld. obstacle := RectangleMorph new. obstacle width: 100. obstacle height: 50. obstacle color: Color black. arena addMorph: obstacle. obstacle position: 400@300.
  • 25. bot1 := ObstacleAvoiderWifiBot morphic. bot1 body openIn: arena. bot1 body positionInArena: 400@200. bot1 forwardSpeed: 40. bot1 rotationSpeed: 20. bot2 := ObstacleAvoiderWifiBot morphic. bot2 body openIn: arena. bot2 body positionInArena: 400@500. bot2 forwardSpeed: 30. myMission start.
  • 26. Main abstract classes • WifiBot (body) • #body, #body:, #step • WifiBotBody (bot)
  • 27. SimpleReactiveWifiBot step self body updateSensorValues. self computeActuatorValues. self body commitActuatorValues computeActuatorValues "Subclasses may redefine this method" self body forwardSpeed: self forwardSpeed rotationSpeed: self rotationSpeed
  • 28. ObstacleAvoiderWifiBot computeActuatorValues "Move forward or turn to avoid obstacles" self body distanceToRightObstacles < 50 ifTrue: [^ self body forwardSpeed: 0 rotationSpeed: -30]. self body distanceToLeftObstacles < 50 ifTrue: [^ self body forwardSpeed: 0 rotationSpeed: 30]. super computeActuatorValues.
  • 29. Graphical vs Physical bodies • Graphical body: MorphicWifiBotBody • Physical body: RealWifiBotBody • Same API
  • 31. WifiBotST • Control&Simulation of WifiBot in Smalltalk • http://vst.ensm-douai.fr/WifiBotST • http://www.squeaksource.com/WifiBotST • MIT licence • Autonomous version (WifiBot embedded VM)
  • 32. 2 libUrbi.st: urbiscript code generation from Smalltalk
  • 33. urbiscript • Prototype-based event-based object- oriented script language, • Support for several robots platforms & simulation engines (Webots, AIBO, NAO, Bioloid, Mindstorms NXT, Spykee)
  • 34. libUrbi.st • Write&debug a Smalltalk program, • Generate urbiscript code to deploy the program on the robot, • Generation done with the help of Refactoring Browser (RB) AST & Visitor Pattern.
  • 35. 11 main RB AST nodes • RBMethodNode, RBPragmaNode, RBReturnNode, RBArrayNode, RBAssignementNode, RBBlockNode, RBCascadeNode, RBLiteralArrayNode, RBLiteralValueNode, RBMessageNode, RBVariableNode • All subclasses of RBProgramNode • Implement all the method acceptVisitor:
  • 36. Visitor Pattern Represent an operation to be performed on the elements of an object structure in a class separate from the elements themselves. Visitors lets you define a new operation without changing the classes of the elements on which it operates.
  • 38. Conversion examples UrbiScriptConverterTest>>testEcho | tree result | tree := RBParser parseExpression: '1 echo'. result := UrbiScriptConverter new visitNode: tree. self assert: result contents = 'echo(1)'. tree := RBParser parseExpression: '1 to:10 do:[:i| i echo]'. result := UrbiScriptConverter new visitNode: tree. self assert: result contents = 'for(var i=1;i<=10;i+=1){echo(i)}'
  • 39. One acceptXXXNode: for each RB AST node UrbiScriptConverter>>acceptRetu rnNode: aReturnNode stream nextPutAll: 'return '. self visitNode: aReturnNode value
  • 41. libUrbi.st • urbiscript code generation from a subset of Smalltalk • http://www.squeaksource.com/libUrbi • MIT licence
  • 42. 3 PlayerST: client for Player/ Stage robotic device server
  • 43. Player/Stage • Player provide an interface to a variety of robot and sensor hardware (lasers, sonars, IR sensors, camera). Player’s client/server architecture allows to robot control programs to be written in any programming language. • Stage simulates a population of mobile robots and sensing a two- dimensional bitmapped environment.
  • 45.
  • 46. PlayerST • http://www1.ifi.auf.org/mediawiki/ index.php/Smalltalk_Player_Client • http://www.squeaksource.com/ PlayerST.html • MIT Licence
  • 47. 4 SqueakBot: pedagogical robotics with Etoys
  • 48. SqueakBot • Educational platform developed in Squeak Smalltalk, • Allow childrens to visually script and simulate various kinds of robots, • In partnership with Planète Sciences.
  • 49.
  • 53.
  • 54.
  • 56. SqueakBot • Linux+ paper (September 2007) • http://wiki.laptop.org/go/Projects/ SqueakBot • Licence MIT
  • 57. Other personal projects • ROAR: RObotics AlgoRithms (exploration strategy, occupancy grids), • Calder: Multi-robots visualization engine with domain-specific scripting language based on Mondrian.
  • 58. Conclusion • Simple Syntax: easy to generate code from Smalltalk + DSL for robotics&WSN • Portable & small VM (Pharo VM) • Uniformity: Everything is written in Smalltalk • Highly dynamic language

Editor's Notes

  1. Arduino
  2. Les structures conditionnelles n&amp;#x2019;existent pas en Smalltalk, ce sont &amp;#xE9;galement des envois de messages !
  3. step est une m&amp;#xE9;thode abstraite &amp;#xE0; red&amp;#xE9;finir dans les sous-classes
  4. Sous-classe de SimpleReactiveWifiBot