ASEBA Open-Source Low-Level Robot Programming ephane Magnenat 1 St - - PowerPoint PPT Presentation

aseba
SMART_READER_LITE
LIVE PREVIEW

ASEBA Open-Source Low-Level Robot Programming ephane Magnenat 1 St - - PowerPoint PPT Presentation

ASEBA Open-Source Low-Level Robot Programming ephane Magnenat 1 St stephane at magnenat.net etornaz 2 Philippe R 1 Autonomous Systems Lab ETH Z urich 2 Mobots group - Laboratory of robotics Systems EPFL February 5, 2012 1 / 46


slide-1
SLIDE 1

ASEBA

Open-Source Low-Level Robot Programming St´ ephane Magnenat 1

stephane at magnenat.net

Philippe R´ etornaz 2

1Autonomous Systems Lab

ETH Z¨ urich

2Mobots group - Laboratory of robotics Systems

EPFL

February 5, 2012

1 / 46

slide-2
SLIDE 2

Outline

Motivation Current Use Technical Description Performances Wrap-up

2 / 46

slide-3
SLIDE 3

Outline

Motivation Current Use Technical Description Performances Wrap-up

3 / 46

slide-4
SLIDE 4

Motivation: Multi-Microcontrollers Robots

17cm

Modern integrated mobile robots have

◮ lots of degrees of freedom ◮ many and various sensors

Their computing infrastructure consists of

◮ a main processor running Linux

(ex. Gumstix)

◮ multiple microcontrollers ◮ a common communication bus

(ex. I2C or CAN)

4 / 46

slide-5
SLIDE 5

Motivation: Usual Approach is Centralized Polling...

microcontroller 1 microcontroller 2 microcontroller 3 processor main

1 cycle cycle 1 activity bus

main processor

continuously

◮ read sensors ◮ process data ◮ set actuators

microcontrollers

◮ interface to

physical devices

bus

◮ I2C

5 / 46

slide-6
SLIDE 6

Motivation: ...but Distributed Events are Better!

microcontroller 1 microcontroller 2 microcontroller 3 processor main

2 3 activity bus

main processor

◮ react to events ◮ send events

microcontrollers

◮ interface to

physical devices

◮ preprocess data ◮ send events ◮ react to events

bus

◮ CAN

6 / 46

slide-7
SLIDE 7

Motivation: An Example of Distributed Events

left motor right motor proximity sensors time

7 / 46

slide-8
SLIDE 8

Motivation: An Example of Distributed Events

no obstacle left motor right motor proximity sensors time

8 / 46

slide-9
SLIDE 9

Motivation: An Example of Distributed Events

no obstacle left motor right motor proximity sensors time

  • bstacle detected

9 / 46

slide-10
SLIDE 10

Motivation: An Example of Distributed Events

no obstacle left motor right motor proximity sensors time

  • bstacle detected

no obstacle

10 / 46

slide-11
SLIDE 11

Motivation: How to Implement Distributed Events?

◮ Contrary to centralized polling, with events the emission

policy must be distributed as well.

◮ Microcontrollers must take decisions about what event to

send when, and how to link incoming events to actuators.

◮ Therefore they must be programmable, but flashing is slow. ◮ A virtual machine is the solution... ◮ And so Aseba was born!

11 / 46

slide-12
SLIDE 12

Motivation: How to Implement Distributed Events?

◮ Contrary to centralized polling, with events the emission

policy must be distributed as well.

◮ Microcontrollers must take decisions about what event to

send when, and how to link incoming events to actuators.

◮ Therefore they must be programmable, but flashing is slow. ◮ A virtual machine is the solution... ◮ And so Aseba was born! ◮ Aseba stands for Actuator and Sensor Event-Based

Architecture.

◮ Aseba puts virtual machines inside microcontrollers; enabling

their programming through a user-friendly language and IDE.

12 / 46

slide-13
SLIDE 13

Outline

Motivation Current Use Technical Description Performances Wrap-up

13 / 46

slide-14
SLIDE 14

Swarm Robotics: hand-bot

6 Aseba VM, real-time unwind control, grasping, and state machines implemented in Aseba

14 / 46

slide-15
SLIDE 15

Swarm Robotics: hand-bot

hand-bot video at http://www.youtube.com/watch?v=92bLgE6DO2g In this video, the hand-bot climbs a shelf and retrieves a book solely using Aseba.

15 / 46

slide-16
SLIDE 16

Autonomous Construction: Lonelybuilder

5 Aseba VM, state machines coded in Aseba localisation, mapping, planning running on Linux ARM

16 / 46

slide-17
SLIDE 17

Autonomous Construction: Lonelybuilder

Lonelybuilder video at http://www.youtube.com/watch?v=h865RHbT9Ms In this video, Lonelybuilder constructs a tower by manipulating

  • cubes. The manipulation state machines are implemented with

Aseba.

17 / 46

slide-18
SLIDE 18

Brick for Building Robot: Smartrob

◮ 2 motor and 8 servo drivers ◮ 8 infrared-sensor drivers ◮ additional I/O and A/D ◮ CAN bus, stackable ◮ single 3 to 25 V input ◮ shipped with Aseba ◮ ROS and D-Bus integration ◮ soon available for buying

18 / 46

slide-19
SLIDE 19

Educational Robotics: Thymio II

Full-featured open-hardware programmable mobile robot for 100 CHF (≈ 80 ➾), see http://aseba.wikidot.com/en:thymio

19 / 46

slide-20
SLIDE 20

Educational Robotics: Thymio II

20 / 46

slide-21
SLIDE 21

Educational Robotics: Thymio II

1 1 2 2 3 3 4 4 D D C C B B A A 2

Laboratoire de Systèmes Robootiques

Michael Bonani STI-IMT-LSRO1 EPFL CH-1015 LAUSANNE 9 A 16.06.2011 13:33:03 microcontroleur.SchDoc Date: Revision: Page de

Thymio2

Project

File :

thymio2-main.PrjPCB

Part PCB principal VCC C36 100nF VCC GND C37 100nF VCC GND C38 100nF VCC GND R101 10K VCC C35 100nF VCC GND 1 2 3 4 5 6 X1 Con1x6 GND PGD PGC PGD PGC X5R C34 10uF X5R C39 100nF VCC GND VCC GND VCC GND ACC_INT ACC_SCK ACC_SDA 1 2 3 4 5 6 X2 Con1x6 GND Buton1 Buton2 Buton3 Buton4 Buton5 IR-sens-front2 IR-sens-front3 IR-sens-front4 IR-sens-front5 IR-sens-front1 IR-sens-groundR IR-sens-groundL IR-pulse-front IR-pulse-groundL IR-pulse-groundR IR-pulse-back IR-sens-backL IR-sens-backR MOTOR1-PWMH1 MOTOR1-PWMH2 MOTOR1-PWML1 MOTOR1-PWML2 MOTOR2-PWMH1 MOTOR2-PWMH2 MOTOR2-PWML1 MOTOR2-PWML2 MOTOR1-SENS MOTOR2-SENS D- D+ USB-500 VAenable R103 4.7K R104 4.7K VCC LED_CLK LED_CS LED_SDI 1 2 Y1 815-ABLS-8-B2 C41 18pF C42 18pF GND GND USB-Charge OUT 1 VSS 3 GND 2 36 kHz U20 IRM-3636T R105

100 AGND

36 kHz IR receiver

IR_Receiver VA IR_Receiver Micro C33 100nF SOUND_OUT SDcard-CS SDcard-DI SDcard-CK SDcard-DO C43 4.7uF USB-Present R102 10K C62 100nF t° RT1 NCP15XH103F03RC GND INNTC2 INNTC2

  • Therm. NTC Sensor

R137 180 GND S S2 SW-PB GND PMD5/CN63/RE5 1 PMD6/SCL3/CN64/RE6 2 PMD7/SDA3/CN65/RE7 3 PMA5/RP21/C1IND/CN8/RG6 4 RP26/PMA4/C1INC/CN9/RG7 5 PMA3/RP19/C2IND/CN10/RG8 6 MCLR 7 RP27/PMA2/C2INC/CN11/RG9 8 VSS 9 VDD 10 PGEC3/RP18/VBUSON/C1INA/AN5/CN7/RB5 11 PGED3/RP28/USBOEN/C1INB/AN4/CN6/RB4 12 VPIO/C2INA/AN3/CN5/RB3 13 VMIO/RP13/C2INB/AN2/CN4/RB2 14 PGEC1/RP1/VREF-/AN1/CN3/RB1 15 PGED1/RP0/PMA6/VREF+/AN0/CN2/RB0 16 PGEC2/AN6/RP6/CN24/RB6 17 PGED2/RCV/RP7/AN7/CN25/RB7 18 AVDD 19 AVSS 20 RP8/AN8/CN26/RB8 21 PMA7/RP9/AN9/CN27/RB9 22 TMS/PMA13/AN10/CVREF/CN28/RB10 23 TDO/AN11/PMA12/CN29/RB11 24 VSS 25 VDD 26 TCK/PMA11/AN12/CTED2/CN30/RB12 27 TDI/PMA10/AN13/CTED1/CN31/RB13 28 CTPLS/RP14/PMA1/AN14/CN32/RB14 29 RP29/PMA0/AN15/REFO/CN12/RB15 30 PMA9/RP10/SDA2/CN17/RF4 31 PMA8/RP17/SCL2/CN18/RF5 32 RP16/USBID/CN71/RF3 33 VBUS 34 VUSB 35 D-/RG3 36 D+/RG2 37 VDD 38 OSCI/CLKI/CN23/RC12 39 OSCO/CLKO/CN22/RC15 40 VSS 41 RP2/DMLN/RTCC/CN53/RD8 42 RP4/DPLN/SDA1/CN54/RD9 43 RP3/SCL1/PMCS2/CN55/RD10 44 RP12/PMCS1/CN56/RD11 45 RP11/DMH/CN49/INT0/RD0 46 SOSCI/C3IND/CN1/RC13 47 RPI37/SOSCO/C3INC/TICK/CN0/RC14 48 RP24/VCPCON/CN50/RD1 49 DPH/RP23/CN51/RD2 50 RP22/PMBE/CN52/RD3 51 PMWR/RP25/CN13/RD4 52 PMRD/RP20/CN14/RD5 53 C3INB/CN15/RD6 54 C3INA/CN16/RD7 55 VCAP/VDDCORE 56 ENVREG 57 VBUSST/VCMPST1/CN68/RF0 58 VCMPST2/CN69/RF1 59 PMD0/CN58/RE0 60 PMD1/CN59/RE1 61 PMD2/CN60/RE2 62 PMD3/CN61/RE3 63 PMD4/CN62/RE4 64 U19 PIC24FJ128GB106-I/PT R143 100K

PIC3301 PIC3302

COC33

PIC3401 PIC3402

COC34

PIC3501 PIC3502

COC35

PIC3601 PIC3602

COC36

PIC3701 PIC3702

COC37

PIC3801 PIC3802

COC38

PIC3901 PIC3902

COC39

PIC4101 PIC4102

COC41

PIC4201 PIC4202

COC42

PIC4301 PIC4302

COC43

PIC6201 PIC6202

COC62

PIR10101 PIR10102

COR101

PIR10201 PIR10202

COR102

PIR10301 PIR10302

COR103

PIR10401 PIR10402

COR104

PIR10501 PIR10502

COR105

PIR13701 PIR13702

COR137

PIR14301 PIR14302

COR143 PIRT101 PIRT102 CORT1 PIS201 PIS202 PIS20S COS2 PIU1901 PIU1902 PIU1903 PIU1904 PIU1905 PIU1906 PIU1907 PIU1908 PIU1909 PIU19010 PIU19011 PIU19012 PIU19013 PIU19014 PIU19015 PIU19016 PIU19017 PIU19018 PIU19019 PIU19020 PIU19021 PIU19022 PIU19023 PIU19024 PIU19025 PIU19026 PIU19027 PIU19028 PIU19029 PIU19030 PIU19031 PIU19032 PIU19033 PIU19034 PIU19035 PIU19036 PIU19037 PIU19038 PIU19039 PIU19040 PIU19041 PIU19042 PIU19043 PIU19044 PIU19045 PIU19046 PIU19047 PIU19048 PIU19049 PIU19050 PIU19051 PIU19052 PIU19053 PIU19054 PIU19055 PIU19056 PIU19057 PIU19058 PIU19059 PIU19060 PIU19061 PIU19062 PIU19063 PIU19064 COU19 PIU2001 PIU2002 PIU2003 COU20 PIX101 PIX102

PIX103 PIX104 PIX105 PIX106

COX1 PIX201 PIX202 PIX203 PIX204

PIX205 PIX206

COX2 PIY101 PIY102 COY1

POACC0INT POACC0SCK POACC0SDA POD0

POIR0PULSE0BACK POIR0PULSE0FRONT POIR0PULSE0GROUNDL POIR0PULSE0GROUNDR POIR0SENS0BACKL POIR0SENS0BACKR POIR0SENS0FRONT1 POIR0SENS0FRONT2 POIR0SENS0FRONT3 POIR0SENS0FRONT4 POIR0SENS0FRONT5 POIR0SENS0GROUNDL POIR0SENS0GROUNDR

POLED0CLK POLED0CS POLED0SDI POMICRO POMOTOR10PWMH1 POMOTOR10PWMH2 POMOTOR10PWML1 POMOTOR10PWML2 POMOTOR10SENS POMOTOR20PWMH1 POMOTOR20PWMH2 POMOTOR20PWML1 POMOTOR20PWML2

POMOTOR20SENS POSDCARD0CK POSDCARD0CS POSDCARD0DI POSDCARD0DO POSOUND0OUT

POUSB0500 POUSB0CHARGE

POUSB0PRESENT POVAENABLE

21 / 46

slide-22
SLIDE 22

Educational Robotics: Thymio II

Li-Po battery level speaker microphone infrared remote control receiver 3 axis accelerometer 5 proximity sensors (obstacle detection) ’ 2 ground sensors (line following) 39 LED to visualize sensors and interaction reset button 5 capacitive touch buttons with activity display , and ON-OFF function pencil support USB connection (programming and recharging) memory card slot hook for trailer 2 proximity sensors mechanic fixation 2 wheels with speed control temperature sensor

22 / 46

slide-23
SLIDE 23

Educational Robotics: Thymio II

Enables children to discover programming with a mobile robot.

23 / 46

slide-24
SLIDE 24

Simulated Robotics: Challenge

beamer arena computer child computer development env. + local arena child computer development env. + local arena child computer development env. + local arena child computer development env. + local arena

24 / 46

slide-25
SLIDE 25

Outline

Motivation Current Use Technical Description Performances Wrap-up

25 / 46

slide-26
SLIDE 26

Technical Overview

Aseba:

◮ allows fast prototyping of the behaviour of microcontrollers

connected through a network,

◮ provides an IDE for edition, debugging and inspection of the

values of variables (including sensor and actuators),

◮ compiles scripts into bytecode, ◮ executes bytecode on microcontrollers in a virtual machine, ◮ safe execution, ◮ dynamic enumeration of microcontrollers’ variables, native

functions and events,

◮ dynamic reprogramming of the microcontrollers, ◮ asynchronous code execution upon events, ◮ open source, LGPL.

26 / 46

slide-27
SLIDE 27

Software Architecture

microcontroller microcontroller microcontroller central embedded computer running Linux desktop computer high-level control programs software switch IDE

  • ptional
  • ptional

CAN

TCP

ROS or D-Bus or TCP

  • • •

robot

27 / 46

slide-28
SLIDE 28

Microcontrollers

program specific application microcontroller communication virtual machine shared communication bus actuators sensors low-level control native functions

28 / 46

slide-29
SLIDE 29

Virtual Machine

◮ targets 16-bit microcontrollers and better, ◮ stack based, 16-bit integers, ◮ executes bytecode

(4-bit opcode, 12-bit payload + optional trailing 16-bit words)

◮ ≈ 1000 lines of C, including debugging logic, ◮ RAM: 22 bytes + user defined amount of bytecode, variable,

stack, and breakpoints.

◮ flash: 7.5 kB flash (dsPIC30, e-puck), ◮ no external library requirement, excepted the implementation

  • f bus communication.

29 / 46

slide-30
SLIDE 30

Language

Simple imperative scripting language, octave-like syntax.

◮ blocks of code executed upon events, ◮ 16-bit integer variables and arrays, ◮ common mathematical expressions and arrays access, ◮ if and when conditionals, ◮ while and for loops, ◮ native functions for complex processing, ◮ subroutines.

30 / 46

slide-31
SLIDE 31

Studio (IDE)

Live Demonstration using Thymio II

31 / 46

slide-32
SLIDE 32

Outline

Motivation Current Use Technical Description Performances Wrap-up

32 / 46

slide-33
SLIDE 33

Evaluation Platform

Evaluation conducted using the marXbot base.

33 / 46

slide-34
SLIDE 34

Aseba vs Polling: Bus Bandwidth

empty boxes walls

empty boxes walls 10 Hz 25 Hz 67 Hz data transmitted for 1 minute 100 B 1 kB 10 kB 100 kB 1 MB event−based polling

34 / 46

slide-35
SLIDE 35

Aseba vs Polling: Bandwidth Use w.r.t. Location

35 / 46

slide-36
SLIDE 36

Aseba vs Polling: Latency

150 mm/s 250 mm

initially

d

  • nce stopped

polling 10 Hz

distance [mm] Frequency 5 10 20 30 10 20 30

polling 25 Hz

distance [mm] Frequency 5 10 20 30 10 20 30

polling 67 Hz

distance [mm] Frequency 5 10 20 30 10 20 30

event−based

distance [mm] Frequency 5 10 20 30 10 20 30

36 / 46

slide-37
SLIDE 37

Aseba vs Native

On a 40 MHz dsPIC:

◮ Ratio of about 70 dsPIC instructions for 1 Aseba instruction ◮ Rate of 600’000 instructions per second ◮ Event round trip lasts 25 µs on idle VM ◮ Native functions in DSP assembly ◮ Native functions use dsPIC’s DSP, event round trip for mean

  • f 100 values is 60 µs, faster than bare C code

37 / 46

slide-38
SLIDE 38

Lessons Learnt on Performance

◮ Events save bandwidth compared to polling. ◮ Events allow for lower latencies than polling. ◮ Virtual machines are suitable for embedded, provided the

critical path is optimised.

38 / 46

slide-39
SLIDE 39

Outline

Motivation Current Use Technical Description Performances Wrap-up

39 / 46

slide-40
SLIDE 40

Future Directions

Improve IDE

◮ store program as abstract

syntax tree, textual surface form for editor

◮ contextualised help/errors ◮ intelligent completion ◮ statistics and machine

learning for common mistakes, automatic tutoring

Lower entry curve

◮ improve tutorial ◮ robotics course ◮ more translations

More platform support

◮ new firmware for Thymio II ◮ affordable service robot

based on Smartrob

◮ add your favourite platform!

On the long run

◮ no more arithmetic/logic

  • peration in the VM, use
  • nly native functions

◮ complete type system ◮ more proving in the compiler ◮ JIT on some platforms ◮ use standard language?

40 / 46

slide-41
SLIDE 41

Take-Home Message

The combination of VM and custom-tailored IDE enables efficient embedded development, in particular for robotic applications. Aseba is a mature and robust implementation of this idea. Yet there is much room for improvement and innovative ideas. You are welcome to join us in this endeavour!

41 / 46

slide-42
SLIDE 42

Thank you

Thank you for your attention, your questions are welcome. The Aseba community awaits you: http://aseba.wikidot.com

Thanks to: Michael Bonani, Florian Vaussard, Fanny Riedo, Valentin Longchamp, Basilio Noris, Sandra Moser and Francesco Mondada

42 / 46

slide-43
SLIDE 43

Program Memory Layout

addresses (in 16-bit words) content bytecodeSize −1 unused bytecode . . . . . . bytecode for last managed event evLastAddr . . . . . . bytecode for first managed event ev0Addr evVectSize −1 evLastAddr evVectSize −2 evLastId . . . . . . 0x0002 ev0Addr 0x0001 ev0Id 0x0000 evVectSize

43 / 46

slide-44
SLIDE 44

Data Memory Layout

addresses (in 16-bit words) content variablesSize −1 temporary variables to pass . . . constants to native calls . . . unused variables . . . user-defined variables exportedVarsLength . . . exported variables 0x0000

44 / 46

slide-45
SLIDE 45

Types of Bytecodes - 1/2

name w.c. function stop 1 stop execution small immediate 1 push a constant onto the stack large immediate 2 push a constant onto the stack load 1 push data from memory onto the stack store 1 pop data from the stack into the mem-

  • ry

load indirect 2 push data from memory onto the stack using an offset from the stack store indirect 2 pop data from the stack into the mem-

  • ry using an offset from the stack

unary arithmetic 1 unary arithmetic operation on the stack binary arithmetic 1 binary arithmetic operation on the stack

45 / 46

slide-46
SLIDE 46

Types of Bytecodes - 2/2

name w.c. function jump 1 jump to another execution address conditional branch 2 check a condition on the stack and jump depending on the result emit 3 send an event native call 1 call a native function sub call 1 jump into a subroutine, store return address on the stack sub ret 1 return from a subroutine, using return address from the stack

46 / 46