MATLAB and Simulink for Embedded Systems and Robotics Sean de Wolski Application Engineer 2014 The MathWorks, Inc. 1
Agenda for today MATLAB & SIMULINK Theory to Practice Trying out concepts from Controls, Signal Processing, Communications, Mapping, etc. Testing on low-cost hardware 2
Demo: Exploring Rover 3
Why an Embedded System? 4
MathWorks products MATLAB + Toolboxes Data Analysis and Visualization Statistical analysis Mathematical Modeling Signal Processing Etc. Simulink + Blocksets System modeling, simulation, testing and implementation Communication system design Physical system design hydraulic, mechanical, electrical, etc. Controller designing, tuning and implementation Etc. 5
MATLAB for Data Analysis and Visualization Access Files Explore & Discover Data Analysis & Modeling Share Reporting and Documentation Software Algorithm Development Outputs for Design Code & Applications Hardware Application Development Deployment Automate 6
Simulink The leading environment for modeling, simulating, and implementing dynamic and embedded systems Block-diagram environment Model, simulate and analyze multi-domain systems Accurately design, implement, and test: Control systems Signal processing systems Communications systems And other dynamic systems Platform for Model-Based Design 7
MATLAB & Simulink in industry Eurocopter: Helicopters Eaton: Hybrid Delivery Truck Caterpillar: Construction Machine IAV: CNG/LPG EMS GM: HVAC Delphi: Common Rail Diesel Dongfeng: BMS Honeywell: Flight Controls GM: Hybrid Powertrain Daimler: Vehicle Controller Lear: BCM Vodafone: Telematics 8 8
Targeting Hardware ANSI-C Code generation for embedded microprocessors MATLAB Coder Simulink Coder Embedded Coder HDL Code Generation for FPGAs and ASICs HDL Coder HDL Verifier PLC Code Generation Simulink PLC Coder 9
Simulink Hardware Support for Project- Based Learning Run Simulink models on low-cost target hardware With just a click, your model moves from Simulink onto hardware Supported target hardware Arduino Uno ($30), Mega 2560 ($65) LEGO MINDSTORMS NXT ($280) Raspberry Pi Model B ($35) BeagleBoard-xM ($150) PandaBoard ($180) Gumstix Overo hardware ($180) Available in Student Version 10
Demo: MATLAB Rover 11
We will discuss: Part 1: Simulink for Embedded Logic Design, Test and Implementation Part 2: Stateflow for designing Event-driven systems, asynchronous sequencing logic Part 3: MATLAB, Simulink and Stateflow working together Part 4: MATLAB for Data Analysis and Visualization Plotting data on maps 12
LEGO MINDSTORMS NXT Technology NXT Intelligent Brick 3 Actuator Ports 1 USB Port 4 Sensor Ports 13
Part 1: Embedded Logic Design, Test and Implementation Design complex dynamic behavior and program robot Task for robot: Maintain: Speed Obst. Dist. Stop if: Obst. Dist. < 20 cm Approach Model intelligent behavior in Simulink Program the robot using Hardware Support Package 14
Part 2: State Machine Design with Stateflow Designing event-driven systems and sequencing logic Task for robot: Exist in IDLE or MOVING States Change States based on obstruction distance Approach Design state machine using Stateflow Program robot 15
Part 3: Interfacing with MATLAB Interface MATLAB and Simulink Task: Control block parameters using MATLAB commands Log sensor data and save to MATLAB workspace Approach Use SET_PARAM command Use SINK blocks with model in EXTERNAL MODE 16
Part 4: Post-process data in MATLAB MATLAB for Data Analysis and Visualization Task: Display collected data on maps Approach Use tools in Mapping Toolbox 17
Demo: MATLAB Rover MATLAB GUI Simulink & Stateflow Change Model Parameters Tune Parameters View Logged Data Log Sensor Data Hardware Support Package for LEGO MINDSTORMS NXT USB & Bluetooth Analyze and Visualize Logged Data 18
Video Demo: Arduino Bumper Bot 19
Video Demo: Raspberry Pi Object Detection 20
Key takeaways MATLAB commands to remember >> targetinstaller >> simulink >> doc To learn more MATLAB and Simulink based Interactive Tutorials http://www.mathworks.com/academia/student_center/tutorials/ Supported hardware for project based learning: http://www.mathworks.com/academia/hardware-resources/ 21
2014 The MathWorks, Inc. 22