How do I add more than one Loading Station in a multi robot warehouse simulation?

5 views (last 30 days)
I am working with the matlab live script example
After adding some more robots and unloading stations I tried adding a second loading station to give out the packages. So I added another location in the existing variable just like with the unloading stations
loadingStation(2, :) = [7,15];
and its showing correctly when I show the updated map. However the simulation won't run anymore and gives out the error:
### Starting serial model reference simulation build
Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
Component: Stateflow | Category: Coder error
Size mismatch (size [2 x 1] ~= size [2 x 2]).
The size to the left is the size of the left-hand side of the assignment.
State 'GoToLoadingStation' in Chart 'robotController/Scheduler':
robotGoal = loadingStation';
Component: Stateflow | Category: Coder error
Error while generating code for chart Scheduler.
Component: Stateflow | Category: Coder error
### Build procedure for robotController aborted due to an error.
Build Summary 1
Elapsed: 0.3 sec
Simulation targets built:
Model Action Rebuild Reason
robotController Failed Global variable loadingStation has changed.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 2.618s
Unable to update models referenced by 'multiRobotExampleModel'.
Caused by:
Error while generating code for chart Scheduler.
Error occurred in 'robotController/Scheduler'.
I was thinking about saving the second loading station in a new variable instead of the same, but I think that would mean i would have to re-edit and wire the whole simulink model with the new variable. I'm not sure if thats the right way. When adding the other unloading stations it was no problem to save them in the same variable.
Any suggestions on how to correctly add the loading station?

Answers (2)

Karsh Tharyani
Karsh Tharyani on 15 Jul 2021
Edited: Karsh Tharyani on 15 Jul 2021
Hi Oliver,
This example was designed to model only a single loading station and allow the user to modify the station's location. The error is expected and stating that you are trying to assign a 2-by-2 "loadingStation" to a "robotGoal" which is supposed to be a location (2-by-1 vector) on the map. If you indexed correctly from the loadingStation (say loadingStation(2,:)' to got the second loading station) to get the right sized vector you should not see this error.
If you wish to make the robots go to two different loading stations during the simulation, you could potentially remodel the the logic in the "robotController/Scheduler" and add another state similar to "GoToLoadingStation".
You would also have to define the logic behind the state transition from a "GoToUnloadingStation" state to the newly added loading station state (say GoToLoadingStation2).
I hope that helps.
Karsh Tharyani
Karsh Tharyani on 15 Jul 2021
Edited: Karsh Tharyani on 15 Jul 2021
The visualization doesn't work probably because the variable loadingStation2 is not being passed to the visualization helper function. You could concatenate the two loading stations into one single variable.
loadingStation = [1,2; % first station
3, 4] % second station
loadingStation = 2×2
1 2 3 4
loadingStation1 = loadingStation(1,:)
loadingStation1 = 1×2
1 2
loadingStation2 = loadingStation(2,:)
loadingStation2 = 1×2
3 4
The outward branches (numbered 1 and 2) from "GoToUnloadingStation" are checked sequentially for transition. Thus, if branch 1 is successful, it won't transition via branch 2 which leads to your second loading station.
You can try making use of the "currentPose" of the robot to make it go to the nearest loading station, but it really depends on your application.
Hope that helps,

Sign in to comment.

Sriparvathi Bhattathiri
Sriparvathi Bhattathiri on 8 Mar 2022
I managed to add extra loading stations, but now I need to make sure that some packages are at loading station 1 and others at loading station 2 and so on. I made the package list two dimensional, the second row contains the loading location. But, now I dont know how to edit the scheduler such that I can ncorporate the starting loacation of the packages.
When I tried to use if..else conditions or for loop in the scheduler stateflow chart but I get an error that says I cannot use for loop or switch cases.
I was wondering where to make changes or how I can reflect the package being present at a particular location.

Community Treasure Hunt

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

Start Hunting!