Doubt In Simulink Commands
2 views (last 30 days)
Show older comments
Hello.
I'm building a model in Simulink for having a vehicle going around a certain trajectory, described below:
- 20m straight line;
- Left-hand turn of 9.125m radius (2 laps);
- Right-hand turn of 9.125m radius (2 laps);
- 20m straight line.
If you picture the path correctly, it should look line an 8 with a straight like in between. This is the trajectory that I want to make the car execute, but the trick is, I can't build it as a time function, but as a function of the travelled distance. I already know the equations that must be implemented in order for the car to execute it, but the way I'm trying to implement them in Simulink is what is giving me headache. Let me try to explain.
Inside a subsystem, I had built the logic for the parametric equations that describe this trajectory. These equations are accounting for a certain angle of the vehicle, the yaw angle, or attitude angle. In other words, the angle that the longitudinal direction of the vehicle assumes with respect to the line of the track. Analyzing the path it takes, this angle should start from zero, then increase linearly until 720°, then decrease linearly until zero again, until the end of the simulation. But, as it starts to decrease from 720° (it actually overshoots a little), it reaches again the value of 720°, and reclicking the Switch blocks. This makes the vehicle reimpose the steering wheel angle at the left-hand turn value, which tries again to decrease to the right-hand turn one, causing the same thing over and over again, until the simulation ends. So, the trajectory becomes a 20m straight line, a 9.125m left turn, and a tiny sinusoidal "straight" line.
It could be simply solved if Simulink had a one-time only Switch command. I had already tried implementing the logic on an embedded MATLAB command block, but I believe my version of MATLAB doesn't allow me to use that resource (R2009b). What can I do to fix this problem? I need help!
0 Comments
Answers (2)
Kaustubha Govind
on 16 Aug 2012
I think that simply using a Switch block for this won't do - there might be several ways of solving this problem (one of which might be a Stateflow chart if you have access to a Stateflow license). For example, an alternate way might be to use some combination of Conditionally Executed Subsystems. For example a triggered subsystem that is executed on the rising edge of (yaw-720) which produces a right-turn when yaw hits 720° in the rising direction only.
0 Comments
Jobin Geevarghese Thampi
on 16 Apr 2022
Does anyone know how to implement this figure in simulink after obtaining kp and kv values?
0 Comments
See Also
Categories
Find more on Vehicle Network Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!