Creating a robot simulation

6 vues (au cours des 30 derniers jours)
Joseph
Joseph le 18 Avr 2023
Commenté : Joseph le 24 Avr 2023
Hello all, I am in the process of creating a robot simulation. The goal is for a group of "robots" to gather items and then drop them off when they complete the task. Each robot has a different task to complete this mission.
Robot 1 is to detect items
Robot 2 is to gather all of the items
Robot 3 is to simulate seperating the items
Robot 4 is to count the items in groups of 5(if possible)
and Robot 5 is to bring them to a set point.
I have found a code and am trying to break it down so it works how I want it to and am having a little bit of trouble and was hoping someone could help me. I have attached the code as a link. Thanks.

Réponses (1)

Dinesh
Dinesh le 24 Avr 2023
Hi Joseph,
I looked at the code that you attached. It is a little bit hard to understand without running the code. As per my understanding, the example uses 4 Robots and two types of targets.
1. Robot 1 to sense and gather information about the targets.
2. Robot 2 to gather target 1 objects that Robot 1 has sensed to a certain destination.
3. Robot 3 to gather target 2 objects that Robot 1 has sensed to a certain destination.
4. Robot 4 carries the objects from the destinations of Robots 2 and 3 to some other path.
All these robots communicate using a Central Hub. You can find this central hub as a separate section from the line 130. Whenever robot1 senses a target. It adds it to respective target lists and if the target lists are not empty robots 2 and 3 keep moving to pick them up. When robots 2 and 3 put them down at the destination they will trigger Robot 4.
This is the high-level understanding of the code you have given.
In your case, you can directly utilize the Robot1 code but change the part about adding targets. Add all targets to one list.
Make some changes to the central hub part such that, Robot 2 picks up all targets instead of only target1.
For robots 3 and 4 implement your logic. For instance, robot 2 brings it to robot 3 which is at some (x,y) location then robot 3 counts.
For Robot 5 you can use the same code as Robot 4 in the file you attached but make some changes, such that when Robot 4 is finished Robot 5 starts the work.
  1 commentaire
Joseph
Joseph le 24 Avr 2023
Thank you Dinesh!!
I am obviously pretty new to Matlab, let alone coding in general. I went through the entry level course but there wasn't much about creating a robot swarm.
I am having trouble adding the 5th robot. Would copy and pasting the 4th bot and changing robot4_'s to robot5_ work?
Also how would I tell robot 3 to count or even just simulate that is what it is doing?
Thanks again!!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Robotics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by