-
Notifications
You must be signed in to change notification settings - Fork 0
CPS_continuous_plant
In this example a unicycle type mobile robot is simulated using the hybrid system toolbox. It is assumed that the forward velocity can be either 1 or 0, and the control command is
The files for this example are found in the package hybrid.examples.mobile_robot :
- initialize.m
- mobile_robot.slx
- postprocess.m
The contents of this package are located in Examples\+hybrid\+examples\mobile_robot (clicking this link changes your working directory).
A unicycle mobile robot is a continuous-time nonlinear system. Let
where the forward velocity
The following diagram shows the Simulink model for this example. The mobile robot is represented by the Continuous-time Plant block.
A Continuous-time Plant block contains user-defined a
flow map
The flow map and flow set functions in this example are included below.
flow map f block
function xdot = f(x, u) % Flow map for plant. xdot = [sin(x(3)); cos(x(3)); u]; end
flow set C block
function inC = C(x, u, parameters) % Flow set indicator function for plant. x1 = x(1); x2 = x(2); minU = parameters.minU; maxU = parameters.maxU; maxX = parameters.maxX; if u >= minU && u <= maxU && x1^2+x2^2 <= maxX^2 inC = 1; % report flow else inC = 0; % do not report flow end end
The jump set C block is given as a constant block with value zero and the jump map D block is unused.
The following plot shows a solution to the closed-loop system. The robot starts at the origin and then drives until it eventually hits the target set, which is a circle with radius 5 centered at the origin.
- Creating and Simulating Hybrid Systems
- Plotting Hybrid Arcs
- Creating and Simulating Composite Hybrid Subsystems
- Updating Code Designed for HyEQ Toolbox v2.04 to Use v3.0 Features.
- Example: Composite Hybrid System with Zero-order Hold Subsystem.
- Example: Composite Hybrid System with Switched Subsystem.