a systems re engineering case study
play

A systems re-engineering case study Programming robots with occam - PowerPoint PPT Presentation

A systems re-engineering case study Programming robots with occam and Handel-C Dan Slipper Supervisors: Alistair A. McEwan Wilson Ifill AWE 1 The Problem 2 Re-engineering Platform Independent Model Legacy System Replacement Component


  1. A systems re-engineering case study Programming robots with occam and Handel-C Dan Slipper Supervisors: Alistair A. McEwan Wilson Ifill AWE 1

  2. The Problem 2

  3. Re-engineering Platform Independent Model Legacy System Replacement Component Component Behaviour Architecture 3

  4. Re-engineering LEGO Mindstorms NXT  32-bit ARM7 microprocessor  4 input ports LEGO  3 output ports MINDSTORMS  100x64 pixel LCD NXT  Bluetooth  Power, 6 AA Batteries 4

  5. Case Study CSP Program Structure LEGO Replacement MINDSTORMS Hardware NXT System 5 5

  6. Case Study CSP Program Structure occam Handel-C NXT FPGA 6 6

  7. Overview • Problem space • Project aims and background • NXT/Transterpreter implementation • FPGA implementation • Case study • Conclusions and future work 7

  8. Aims • Investigate the impact of modelling at a platform independent level • Introduce two platforms using a common model of concurrency – Running a simple common task • Demonstrate behavioural differences and integration issues between implementations 8

  9. FPGAs and Handel-C • FPGAs are “reconfigurable hardware” • Can be reprogrammed any number of times unlike ASIC • Handel-C is a HDL making FPGA hardware programming look like software • C like language augmented with a CSP model of concurrency 9

  10. Handel-C Example static macro proc C(chanB, chanA) static macro proc P(); static macro proc P(chanA, chanB) static macro proc C(); unsigned int 1 value; void main (void) chanA value = 1; { P C unsigned int 1 value; chan int 1 chanA; value= 0; chanB while(true){ chan int 1 chanB; par{ chanA ? value; while(true){ chanB ! value; P(chanA, chanB); chanA ! value; } C(chanB, chanA); chanB ? value; } } } 10

  11. occam and the Transterpreter • The Transterpreter is a modern virtual machine for a variety of commodity platforms • Interprets bytecode as on the Transputer • Written as a C library 11

  12. occam Example PROC main () PROC P(CHAN INT chanA, chanB) PROC C(CHAN INT chanB, chanA) INT value: INT value: CHAN INT chanA, chanB: chanA SEQ SEQ P C PAR value := 1 value := 0 P(CHAN INT chanA, chanB) WHILE TRUE WHILE TRUE chanB C(CHAN INT chanB, chanA) SEQ SEQ chanA ! value chanA ? value : chanB ? value chanB ! value : : 12

  13. Case Study CSP Program Structure occam Handel-C Transterpreter FPGA NXT Legacy System Replacement Component Component 13 13 13

  14. NXOS + Transterpreter • Built on top of existing OS – NXOS – set of C drivers and boot code occam Drivers Transterpreter NXOS NXT 14

  15. NXT Architecture Ultrasonic Sensor Light Sensor Touch Sensor Motors (with tachometer) Sound Sensor 15

  16. Peripheral Support in occam • Standard peripherals have support – Analogue sensors – Motors – Ultrasonic sensor – Speaker – LCD – Bluetooth • NXT 2.0 – Colour sensor currently unsupported – 3 rd party sensors partially supported – Using I 2 C 16

  17. FPGA Architecture Ultrasound Sensor Light Sensor Touch Sensor Motors (with tachometer) Sound Sensor 17

  18. FPGA features • Light/Sound/Touch – Implemented through ADC • Motors – PWM – Tachometer – H-Bridge driver board 18

  19. Case study • Use implementations on FPGA and NXT • Common program architecture • Utilising a number of peripherals • Simple case study – Follow a set path around the desk, changing direction with different speeds, (therefore angles) – Recognise the edge of the desk 19

  20. Path to follow • The path the robots should follow... 20

  21. Design of Experiment 21

  22. Robot Structure 22

  23. Process / Communication Structure Light MotorA Sensor reqMotorA Control Code MotorATach MotorBTach MotorB 23

  24. Main Implementation • occam • Handel-C PROC main () void main (void) CHAN INT motorASpeed,fromLight, { reqLight, fromTachA, reqTachA, chan int 32 toMotorA; reqTachB: chan int 32 motorATach; ... chan int 1 reqTachA; PAR par{ LightSensor(fromLight, reqLight) ADC_Read(); Motor1(motorASpeed) LightSensor(fromLight, reqLight); Motor1Tach(fromTachA, reqTachA) Motor1(toMotorA); ControlCode(motorASpeed, Motor1Tach(motorATach, reqTachA); fromLight, reqLight, fromTachA, ControlCode(fromLight, toMotorA, reqTachA) reqLight, reqTachA, motorATach); : } } 24

  25. Control Implementation occam Handel-C par{ PAR toMotorA ! 70; motorASpeed ! 70 toMotorB ! 70; motorBSpeed ! 70 } reqLight ! 0 reqLight ! 0; fromLight ? light fromLight ? light; WHILE light > 800 while(light == 0) SEQ { reqLight ! 0 reqLight ! 0; fromLight ? light; fromLight ? light } PAR par{ motorASpeed ! 0 toMotorA ! 0; motorBSpeed ! 0 toMotorB ! 0; 25 }

  26. Test Results • Path from occam implementation was a reference • Handel-C path was wrong – Turning angles were different – Tachometer readings were therefore different – Overall system behaviour was incorrect 26

  27. Further Tests • Pulses after travelling 1000 • Speed 100% Robot Run 1 Run 2 Run 3 Run 4 Run 5 Mean Range Standard Deviation Handel-C 1247 1240 1239 1233 1232 1238 15 6.058052 occam 1773 1783 1793 1814 1787 1790 41 15.26434 • Speed 80% Robot Run 1 Run 2 Run 3 Run 4 Run 5 Mean Range Standard Deviation Handel-C 1213 1208 1209 1203 1206 1208 10 3.701351 • Speed 80% 1397 1417 1431 1415 1413 1415 34 12.1161 occam 27

  28. Further Tests (2) • Distance travelled (cm) – Speed 100% Robot Run 1 Run 2 Run 3 Run 4 Run 5 Mean Range Standard Deviation Handel-C 73.8 71.3 68.6 69.6 68.6 70.38 5.2 2.207261 70.4 70.4 71.0 70.6 71.2 70.72 0.80 0.363318 occam • Distances average the same over a vast range • Investigation is required into circuit and differences in hardware 28

  29. Further Tests (3) Average motor Voltage against Time when turning 1000 degrees 9 8 7 6 5 Voltage (V) 4 NXT Voltage 3 FPGA 2 Voltage 1 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 -1 Time (Seconds) 29

  30. Results • Voltage difference between hardware implementations – Larger H-Bridge circuit • Braking only tested with ‘float’method – void nx_motors_stop(U8 motor, bool brake) CSP Program Structure Drivers occam Handel-C Transterpreter NXOS FPGA NXT 30 30

  31. Conclusions and Future Work Conclusions • Experiments demonstrate that programming same high-level missions leads to different behaviours. • Therefore just modelling the high level behaviours is not reliable enough for a systems re-engineering project • Modelling and verification methods are required for the whole system Future Work • CSP model of system behaviour – Translation to both implementation languages • Improve motor drivers to braking methods • More complex case study 31

Recommend


More recommend