slackening real-time constraints in robot control: design and ...simon/fs_robots.pdfsched_ctrl mux...

24
Control and scheduling Feedback scheduling Implementation Summary Slackening real-time constraints in robot control: design and implementation Daniel Simon DEMAR team INRIA Sophia Antipolis - Méditerranée LIRMM, CNRS UMR 5506, Montpellier http://www.lirmm.fr/demar Journée Architectures Logicielles pour la Robotique Autonome, les Systèmes Cyber-Physiques et les Systèmes Auto-Adaptables Dec. 1, 2014 1 / 12

Upload: others

Post on 18-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Slackening real-time constraints in robotcontrol: design and implementation

Daniel Simon

DEMAR teamINRIA Sophia Antipolis - MéditerranéeLIRMM, CNRS UMR 5506, Montpellierhttp://www.lirmm.fr/demar

Journée Architectures Logicielles pour la Robotique Autonome, les SystèmesCyber-Physiques et les Systèmes Auto-Adaptables

Dec. 1, 2014 1 / 12

Page 2: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Control and scheduling

+−

e(k)ZOH

h h

U(k)

NetworkObserver

CONTROLLER

Xd(k)

X(k)

Y(k)U(k) = K(e(k)) SAMP

PROCESS

Continuous timeDiscrete time

Goal : reaching a specified closed-loop performance underconstraint of limited computing architecture

the loop must be ¨fast enough¨ compared with the processdynamics

fast sampling and low latency

Traditional solution :Control design in continuous or discrete timesingle fixed rate, null or known and fixed delay;preemptive and fixed priority RTOSknown WCET, off line schedulability analysis

neither optimal nor flexible w.r.t. the control objectiveco-design approach

Dec. 1, 2014 2 / 12

Page 3: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Control and scheduling

+−

e(k)ZOH

h h

U(k)

NetworkObserver

CONTROLLER

Xd(k)

X(k)

Y(k)U(k) = K(e(k)) SAMP

PROCESS

Continuous timeDiscrete time

Traditional solution :Control design in continuous or discrete timesingle fixed rate, null or known and fixed delay;preemptive and fixed priority RTOSknown WCET, off line schedulability analysis

neither optimal nor flexible w.r.t. the control objectiveco-design approach

Dec. 1, 2014 2 / 12

Page 4: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Control and scheduling

+−

e(k)ZOH

h h

U(k)

NetworkObserver

CONTROLLER

Xd(k)

X(k)

Y(k)U(k) = K(e(k)) SAMP

PROCESS

Continuous timeDiscrete time

Traditional solution :Control design in continuous or discrete timesingle fixed rate, null or known and fixed delay;preemptive and fixed priority RTOSknown WCET, off line schedulability analysis

neither optimal nor flexible w.r.t. the control objectiveco-design approach

Dec. 1, 2014 2 / 12

Page 5: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Feedback

General benefits of closing the loop :robustness w.r.t. process modeling uncertaintiesrejection of noise and disturbancestolerance w.r.t. timing uncertainties

Control tools in the scheduler implementation :on-line adaption to the real timing parametersrobustness improvement due to feedback action

Trade off between control and computingQoS formulationrelations between control performance and timingparameters?

Dec. 1, 2014 3 / 12

Page 6: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Feedback

General benefits of closing the loop :robustness w.r.t. process modeling uncertaintiesrejection of noise and disturbancestolerance w.r.t. timing uncertainties

Control tools in the scheduler implementation :on-line adaption to the real timing parametersrobustness improvement due to feedback action

Trade off between control and computingQoS formulationrelations between control performance and timingparameters?

Dec. 1, 2014 3 / 12

Page 7: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Feedback

General benefits of closing the loop :robustness w.r.t. process modeling uncertaintiesrejection of noise and disturbancestolerance w.r.t. timing uncertainties

Control tools in the scheduler implementation :on-line adaption to the real timing parametersrobustness improvement due to feedback action

Trade off between control and computingQoS formulationrelations between control performance and timingparameters?

Dec. 1, 2014 3 / 12

Page 8: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Feedback scheduling

Hierarchical control structure :

Uk+

+−

Controller

Scheduling

SchedulingParameters

Process state estimates

CPU/network state load/latency estimates

Y

supervision

exceptions handling

RTOS

Scheduler

(QoC)Process objectives

Global objective

QoS

SAMP

Controller

ProcessProcessZOH

Inner loops : process controllersindependent control laws objectivesrobustness w.r.t. timing uncertaintiesadaptive w.r.t. scheduling parameters

Dec. 1, 2014 4 / 12

Page 9: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Feedback scheduling

Hierarchical control structure :

Uk+

+−

Controller

Scheduling

SchedulingParameters

Process state estimates

CPU/network state load/latency estimates

Y

supervision

exceptions handling

RTOS

Scheduler

(QoC)Process objectives

Global objective

QoS

SAMP

Controller

ProcessProcessZOH

Outer loop : scheduling controllerglobal objective : trade off between control and schedulingmanaging concurrency between controllersCPU load regulation, robustness, QoS optimization, . . .

Dec. 1, 2014 4 / 12

Page 10: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Dynamic model for tasks

Ur

+

+

Uothers

+Plant

control tasksfiScheduling

controller

Dynamical system between tasks frequencies and CPUusageDynamics = integrators (queues) and filtersOther tasks act as external disturbancesActuators = scheduling parametersSensors = probes for computing activity

actuators and sensors are made of (almost free) software

Dec. 1, 2014 5 / 12

Page 11: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Dynamic model for tasks

Ur

+

+

Uothers

+Plant

control tasksfiScheduling

controller

Dynamical system between tasks frequencies and CPUusageDynamics = integrators (queues) and filtersOther tasks act as external disturbancesActuators = scheduling parametersSensors = probes for computing activity

actuators and sensors are made of (almost free) software

Dec. 1, 2014 5 / 12

Page 12: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Actuators

U = cihi

= ci ∗ fi =⇒ periods are effective commandsCPU load = control variable, constraint, parameter...

Out of Control

Sampling Rate fastslow

Acceptable performance

Unacceptable

Performance

Per

form

an

ce ControlNetworked

DigitalControl

Continuous Control

continuous sampling variationsevent based control(m,k)-firm selective dropping

control law variants with different execution costsPID vs. computed torque?anytime predictive controllers (iterative refinements)

CPU frequency scalingpriority :

no effect on the loadbased on relative urgency criteria

Dec. 1, 2014 6 / 12

Page 13: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Actuators

U = cihi

= ci ∗ fi =⇒ periods are effective commands

CPU load = control variable, constraint, parameter...continuous sampling variationsevent based control(m,k)-firm selective dropping

control law variants with different execution costsPID vs. computed torque?anytime predictive controllers (iterative refinements)

CPU frequency scalingpriority :

no effect on the loadbased on relative urgency criteria

Dec. 1, 2014 6 / 12

Page 14: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Actuators

U = cihi

= ci ∗ fi =⇒ periods are effective commands

CPU load = control variable, constraint, parameter...continuous sampling variationsevent based control(m,k)-firm selective dropping

control law variants with different execution costsPID vs. computed torque?anytime predictive controllers (iterative refinements)

CPU frequency scalingpriority :

no effect on the loadbased on relative urgency criteria

Dec. 1, 2014 6 / 12

Page 15: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Actuators

U = cihi

= ci ∗ fi =⇒ periods are effective commands

CPU load = control variable, constraint, parameter...continuous sampling variationsevent based control(m,k)-firm selective dropping

control law variants with different execution costsPID vs. computed torque?anytime predictive controllers (iterative refinements)

CPU frequency scaling

priority :no effect on the loadbased on relative urgency criteria

Dec. 1, 2014 6 / 12

Page 16: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Actuators

U = cihi

= ci ∗ fi =⇒ periods are effective commands

CPU load = control variable, constraint, parameter...continuous sampling variationsevent based control(m,k)-firm selective dropping

control law variants with different execution costsPID vs. computed torque?anytime predictive controllers (iterative refinements)

CPU frequency scalingpriority :

no effect on the loadbased on relative urgency criteria

Dec. 1, 2014 6 / 12

Page 17: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Sensors

Estimation of the CPU load

Discrete filtering of the mean task load during one periodof the feedback scheduler

Ukhs = λ U(k−1)hs + (1− λ)ckhs

h(k−1)hs

Estimation of execution time in practicedirect measure of c : not always available (e.g. OK withXenomai, not with Linux)using the time of response : over-estimates the load (butPosix compliant)deadlines miss, laxity. . . (but coming too late)

Dec. 1, 2014 7 / 12

Page 18: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Control scheme for CPU resources

K(z)

1c2

Task2−

+ Task1

H(z)Uothers

Ur

++

+

f1

f2

1c1

Design of K using control methodology (e.g. H∞, LQG, . . . )On line adaptation to execution time variationsTask frequency saturations

Dec. 1, 2014 8 / 12

Page 19: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Robot arm control

Feedback scheduling a robot controller

q

G

PA10

Gc

Gi

Gg

Gt

End

Sing

q

qd

j Mission

SequencingSupervisionExceptions

manager

Linux/Xenomai

Sched_Ctrl

Mux

Torque

GeneTrajGravite

Inertie

Coriolis

Dec. 1, 2014 9 / 12

Page 20: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Robot arm control

Feedback scheduling a robot controller (Contd)Dynamic CPU power assignment:

UG = αGU, UI = (1− αG)U, UC = 0.25 U

αG = αmin + (αMax − αmin)×qd − qend

qini − qend

0 0.5 1 1.5 2 2.50

0.002

0.004

0.006

0.008

0.01

0.012

0.014

0.016

0.018

0.02

Time [s]

Per

iods

[s]

Task periods

InertiaGravityCoriolis

0 0.5 1 1.5 2 2.50

0.1

0.2

0.3

0.4

0.5

Time [s]

Load

Task loads

InertiaGravityCoriolis

0 0.5 1 1.5 2 2.50

0.2

0.4

0.6

0.8

1

Time [s]

Load

Processor Load

RegulatedReferenceIntegratorGrand total

0 0.5 1 1.5 2 2.5−250

−200

−150

−100

−50

0

50

100

150

Time [s]

Join

t tor

ques

[mN

]

Commands

1234567

Intervals CPU load Torques

Cost of the FS < 1%

Dec. 1, 2014 10 / 12

Page 21: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Drone control

Discrete sampling control

f 1f 4

f 3 f 2

yn

zn

xb

ybzb

xn

Q1Q 4

Q3Q 2

xi+1 = Φ(hn)xi + Γ(hn)ui

yi = Cd (hn)xi + Dd (hn)ui

ui = [τΦτΘτΨ]T = [LΦLΘLΨ]xTi

(m,k)-firm: m mandatory executions every k samples

hn = ti+1 − ti = n.h

ui = Lnxi , Ln = [ln,1, ln,2]

Discrete-Time Switched System and Common Quadratic Lyapunov Function:

ln,1 =−4l1,1

b0n2h2l1,1 + 2b0nhl1,2 − b0nh2l1,1 − 4− 2b0hl1,2

ln,2 =−2(nhl1,1 + 2l1,2 − hl1,1)

b0n2h2l1,1 + 2b0nhl1,2 − b0nh2l1,1 − 4− 2b0hl1,2

skipped execution =⇒ do not release the clock

q3q2q1q0

(m,k)-pattern

mΦ = mΘ = mΨ = 5 mΦ = mΘ = 1,mΨ = 5(m,k)-pattern

q1q0

q2q3

Dec. 1, 2014 11 / 12

Page 22: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Drone control

Discrete sampling control

f 1f 4

f 3 f 2

yn

zn

xb

ybzb

xn

Q1Q 4

Q3Q 2

xi+1 = Φ(hn)xi + Γ(hn)ui

yi = Cd (hn)xi + Dd (hn)ui

ui = [τΦτΘτΨ]T = [LΦLΘLΨ]xTi

skipped execution =⇒ do not release the clock

q3q2q1q0

(m,k)-pattern

mΦ = mΘ = mΨ = 5 mΦ = mΘ = 1,mΨ = 5(m,k)-pattern

q1q0

q2q3

Dec. 1, 2014 11 / 12

Page 23: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Summary

Computing/communication resources can be controlledFeedback control loops are firm real-timeNo further need for WCET evaluation

=⇒ sizing w.r.t. average valuesRobust w.r.t. timing disturbances

=⇒ no need for perfect determinismEasily feasible, with off-the-shelf hard/soft

BE FREE !

Dec. 1, 2014 12 / 12

Page 24: Slackening real-time constraints in robot control: design and ...simon/FS_robots.pdfSched_Ctrl Mux Torque Gravite GeneTraj Inertie Coriolis Dec. 1, 2014 9 / 12 Control and schedulingFeedback

Control and scheduling Feedback scheduling Implementation Summary

Summary

Computing/communication resources can be controlledFeedback control loops are firm real-timeNo further need for WCET evaluation

=⇒ sizing w.r.t. average valuesRobust w.r.t. timing disturbances

=⇒ no need for perfect determinismEasily feasible, with off-the-shelf hard/soft

BE FREE !

Dec. 1, 2014 12 / 12