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

1 visualización (últimos 30 días)
I am working with the matlab live script example
openExample('robotics/ControlAndSimulateMultipleWarehouseRobotsExample')
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?

Respuestas (2)

Karsh Tharyani
Karsh Tharyani el 15 de Jul. de 2021
Editada: Karsh Tharyani el 15 de Jul. de 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.
Best,
Karsh
  2 comentarios
Oliver Van
Oliver Van el 15 de Jul. de 2021
Hi Karsh,
Thank you for the suggestion, it definitely helped me getting rid of the error to run to simulation. Now by changing the vector size as you mentioned I successfully added a second loading station to the map, which is unused in the simulation(the robots wont drive to the new station to get packages). So I tried adding a new state for a loading station and tried to remodel the logic as you suggested and ended up with this model
The Simulation runs without any errors fortunately, but it doesn't display the added Loading station anymore, neither does it use it.
The new Loading Station is supposed to be shown above the displayed existing loading station.
Besides that, I suppose the edited logic in the model isn't quite right yet, as I still have to find a way to say, that the robots should go to the other loading station if the default one is already occupied by one robot.
Is there a way to model that in that way or maybe model it in a way, where the robots randomly decide wether they go to the first or the second loading station?
I also tried adding a 'condition' from the first state-transition to either 'GoToLoadingStaion' or 'GoToLoadingStation2'. But I ended up with a simulation where the robots first went to loading station1 to get their packages and after that only went to the loading station2 for the rest of the simulation.
Do you maybe have a suggestion on how to make that newly added Loading Station usable? I'd appreciate your thoughts on my approach to remodel the logic too.
Karsh Tharyani
Karsh Tharyani el 15 de Jul. de 2021
Editada: Karsh Tharyani el 15 de Jul. de 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,
Karsh

Iniciar sesión para comentar.


Sriparvathi Bhattathiri
Sriparvathi Bhattathiri el 8 de Mzo. de 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.

Categorías

Más información sobre Robotics en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by