robotics development workflow with matlab and simulink€¦ · robotics development workflow with...

36
1 © 2015 The MathWorks, Inc. Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

Upload: others

Post on 15-Jul-2020

21 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

1© 2015 The MathWorks, Inc.

Robotics Development Workflow

with MATLAB and Simulink

Carlos Santacruz-Rosero, Ph.D

Sr Application Engineer - Robotics

Page 2: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

2

Agenda

• Introduction

• Advanced Robotics Systems

• Robotics Development Workflow with MATLAB and Simulink

• Takeaways

Page 3: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

3

Car as an Advanced Robotics System

LIDAR RADAR GPS/IMUCamera

Steering Actuator

Actuator ECUs

GAS/Brake Actuator

Motion Controllers

Planning

Localization Obstacle

avoidance

Global Map

Motion control

SENSE

CONTROL

PERCEIVE PLAN

Page 4: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

4

Collaborative Robot as an Advanced Robotics System

Torque TemperatureCamera RGB-D

Impedance Control

Actuator Control

Safety Guards

Motion Controllers

Motion Planning

Obstacle Avoidance Object Detection

World

Optimization

SENSE

CONTROL

PERCEIVE PLAN

Page 5: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

5

Architecture - Advanced Robotics System

Motion Planning

Obstacle Avoidance Object Detection

World

Optimization

Impedance Control

Actuator Control

Safety Guards

Motion Controllers

Middleware

Data synchronization

CPU/GPU Cluster, Server, Cloud

Real-time requirements

Microcontroller, FPGA, Real-time PC

Page 6: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

6

Technology Solutions for Autonomous SystemsP

ER

CE

IVE

SE

NS

EC

ON

NE

CT

PL

AN

CO

NT

RO

L

Computer Vision Phased Array Statistics & Machine Learning

Control System Tbx

StateflowRobotics System Tbx

Data Acquisition TbxHW Support Packages

Simscape Toolboxes

Communications Tbx WLAN System Toolbox

Simulink Real-Time

Robotics System Tbx

Page 7: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

7

Success Stories

Page 8: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

8

Technology Solutions for Autonomous SystemsP

ER

CE

IVE

SE

NS

EC

ON

NE

CT

PL

AN

CO

NT

RO

L

Computer Vision Phased Array Statistics & Machine Learning

Control System Tbx

StateflowRobotics System Tbx

Data Acquisition TbxHW Support Packages

Simscape Toolboxes

Communications Tbx WLAN System Toolbox

Simulink Real-Time

Robotics System Tbx

Page 9: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

9

Robotics System Toolbox

Environment for prototyping, simulating, and deploying robotics applications

Interface and

Deployment to

ROS

Algorithms for

Manipulators and

Humanoids

Algorithms for

Mobile

Robotics

Page 10: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

10

Robotics Applications with Robotics System Toolbox

Page 11: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

11

Workflow Convergence is Needed

Implementation

- Trace to requirements

- Design/debug algorithm

- System integration

- Testing on physical system

- Manual Coding

- Verification and Validation

System

Requirements

Idea

Page 12: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

12

Robotics Development Workflow with MATLAB and Simulink

Implementation

System

Requirements

Idea

Design and

Simulation

- Built-in algorithms and apps

- System-Level Simulation MBD

- Co-simulation

- C/C++ automatic code generation

- Processor-in-the-loop (PIL)

- Debug C/C++ with MATLAB Engine

Prototype

RAPID ITERATIVE PROCESS

Design independent of

hardware

implementation!

Page 13: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

13

Let’s solve a real problem: Sign Detection System

Clearpath Husky Robot

- ROS Enabled

- Kinect (RGB and Point cloud)

- Hokuyo 2D Lidar

Track and Park

Reduce Speed

Collision Avoidance

Simulation model in Gazebo

Page 14: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

14

System Level Design ROS as CommunicationFramework

Object ClassifierObstacle Avoidance

State Machine

Page 15: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

15

Sign Recognition with Collision Avoidance

Page 16: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

16

Robotics Development Workflow with MATLAB and ROS

- Import logged data

- Train a classifier

- Test component

Implementation

Product

Requirements

Idea

Design and

Simulation

Prototype

RAPID ITERATIVE PROCESS

Page 17: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

17

Importing Simulation and Experimental Data

Robotics System Toolbox™

Import ROS Data

Filter your logged field

data by topic or time

intervalExperimental data or

simulation Data

Data ready to

design algorithms

Page 18: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

18

Visualize, Analyze, and Process Data: Classifier

OutputInput

stop

membrane

speedlimit

neg

Training data Preprocessing Feature Extraction Training

Classifier

% Detect red regions

BW = createMask(videoFrame);

% Fill image regions

BW = imfill(BW,'holes');

% Get bounding boxes

stats = regionprops('table',BW,'BoundingBox','Area');

% Filter based on area size

targetIndex = stats.Area > 500;

% Get bounding boxes from detected regions

testFeatures(k,:) = extractHOGFeatures(Icr);

Page 19: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

19

Visualize, Analyze, and Process Data: Classifier

Statistics and Machine Learning Toolbox™Computer Vision System Toolbox™

OutputInput

stop

membrane

speedlimit

neg

Training data Preprocessing Feature Extraction Training

ClassifierClassifier

Preprocessing Feature Extraction

Page 20: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

20

Design and Test Algorithm

Page 21: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

21

Design and Test Algorithm

Page 22: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

22

Robotics Development Workflow with MATLAB and ROS

- Test algorithm with an external simulator

- Tune your algorithm

- Integrate with other components

Implementation

Product

Requirements

Idea

Design and

Simulation

Prototype

RAPID ITERATIVE PROCESS

Page 23: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

23

MATLAB and Simulink connect to the ROS network

- Multiple master support

- ROS publishers/subscribers

- ROS services

- ROS TF tree

- ROS Parameter server

?

Vehicle

Page 24: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

24

Co-simulation with ROS

Page 25: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

25

Co-simulation with ROS

Page 26: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

26

Robotics Development Workflow with MATLAB and ROS

System level design to target a different middleware or framework

Implementation

Product

Requirements

Idea

Design and

Simulation

Prototype

RAPID ITERATIVE PROCESS

Page 27: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

27

Deployment

Generate ROS

Node with

Simulink and

Embedded

Coder™

Create a

Stand Alone

Executable

with MATLAB

Compiler™

Generate a

shared library

with MATLAB

Coder™

Determine deployment methods based on application

Page 28: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

28

Implementation

Page 29: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

29

Part1: Object Detection and Position Estimation

Object Detection and

3D Object position

estimation

Page 30: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

30

Part2: Trajectory Planning

Optimization-based

Trajectory Planning

Page 31: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

31

Part3: System Integration

System Integration and Control

Logic Design

Page 32: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

32

Advanced Robotics Application Requires Multiple Technologies

Trajectory Planning

System Integration

Detect and Estimate Position

of ObjectsComputer Vision

Machine Learning

Control Logic

Co-simulation

Code generation

Robotics

Optimization

MATLAB and Simulink: very powerful tools to design advanced robotics applications

Page 33: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

33

Trajectory Planning with RGB-D Sensor

Page 34: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

34

System Level Design

Page 35: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

35

Robotics Development Workflow with MATLAB and Simulink

Visualize

Experiment

Prototype

Simulate

Deploy

Middleware

Page 36: Robotics Development Workflow with MATLAB and Simulink€¦ · Robotics Development Workflow with MATLAB and Simulink Carlos Santacruz-Rosero, Ph.D Sr Application Engineer - Robotics

36

Questions

% Thank you