Path planning algorithm into Simulink

3 ビュー (過去 30 日間)
Jarne van Gemert
Jarne van Gemert 2020 年 5 月 4 日
コメント済み: Jarne van Gemert 2020 年 5 月 15 日
I recently created a path planning algorithm. Now this function returns an array with x and y coordinates independent of time. I want to combine this with my simulink model. I want to run this function when I start my simulation and then use the array to return waypoints to my quadcopter. However, I am not able to use this function in simulink. I have tried several things. An s-function doesn't work because I don't need any input. The matlab function doesn't work either. If I try to put the function into the "matlab function block" I get errors that I cannot use round. That calling the function H, which is a matrix the size of the map so 40x40, has failed.
I found a solution, but it's not optimal. I can create a matlab function with a data input parameter. But first I have to run the code for the path planning algorithm separately before I can run the simulink model. I also tried to call the function in a "matlab function block" in simulink but unfortunately this doesn't work either. I can call the function from the command window. The function only has to run once. Does anyone have any ideas on how I can call this function in matlab?
Thanks in advance!
  2 件のコメント
Githin John
Githin John 2020 年 5 月 7 日
What is the error you are getting when trying to use the function in a MATLAB function block?
Jarne van Gemert
Jarne van Gemert 2020 年 5 月 15 日
I got an error that my variable was not declared. I found the solution by using persistent.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by