Problems with Working with A GUI to Simulink and back in realtime
4 次查看(过去 30 天)
显示 更早的评论
Hi Guys I have been working on using a simulink model to control a toy helicopters flight in realtime. Anyway the model is fine and works by a simple matlab script but my aim is to use a GUI to control it.
The Model works by comparing inputs of X,Y,Z and YAW of the aircraft and comparing it with The current values then reducing the error till there is none so putting the aircraft in the position it needs to be . Originally I used a matlab script to assign waypoints due to time in the simulation.
I Have built a GUI so data can be imputed into it but I am having problems sending that into simulink and then a read out of the aircraft's position to be pulled from it real time.
The data I'm inputting is a set of waypoints and are not time dependent. So my aim is to have the controller get the helicopter to this point and then switch to another waypoint which i think is going to be tricky.
Back to the main problem
1. How do I update blocks in simulink in real time - I have been looking into the set_para function which looks promising but im no entirely sure how to pull this wapoint information into my simulink. I have been trying to use gains with constants of one.
2. How could i make a real time plot of the aircraft in my GUI on an axes. I have tried to use a listening block on the function to pull each variable out but im not entirely sure how to do this or to make it into ad 2d plot or 3d plot as they are seperate signals.
Hope that makes sense
0 个评论
采纳的回答
TAB
2012-3-12
(1) To update the model during simulation, you can call
set_param('YourModel','SimulationCommand','update')
from your GUI.
Here you can find a good example of GUI<-->Simulink communication during run time.
(2) To find a good example of plotting simulink data during runtime using listener, type
>>sldemo_msfcn_lms
on your command window.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multicore Processor Targets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!