-
Notifications
You must be signed in to change notification settings - Fork 8
Components and systems needed for functionality
Cristiane Naves Cardoso edited this page Feb 15, 2021
·
2 revisions
For each functionality, it is necessary to configure systems and components so that it works properly.
Components can be added directly by drawio using Edit Data or they can also be added via script using:
simulation.world.add_component(object_id, component).
Systems are added via script using:
simulation.add_system(System) or simulation.add_des_system(DESSystem).
The tables below contain the components and systems required for each functionality:
In this type of navigation, a path is created using an arrow on the drawio, and the robot will follow this arrow to its destination.
| Components |
|---|
| type: robot (set for the robot) |
| speed: float_number (set for the robot) |
| movable: true (set for the robot) |
| type: path (set for the path) |
| Systems |
| PathProcessor |
| MovementProcessor |
Setting systems for path navigation
from systems.PathProcessor import PathProcessor
from systems.MovementProcessor import MovementProcessor
simulation = Simulator(config)
width, height = simulation.window_dimensions
simulation.add_system(PathProcessor())
simulation.add_system(MovementProcessor(minx=0, miny=0, maxx=width, maxy=height))
simulation.run()
In this type of navigation the robot will move to a point that was defined by GotoPosPayload.
| Components |
|---|
| type: robot (set for the robot) |
| speed: float_number (set for the robot) |
| movable: true (set for the robot) |
| type: path (set for the path) |
| Systems |
| PathProcessor |
| MovementProcessor |
| DES Systems |
| (gotoProcessor.process,) |
Setting systems for GotoPos navigation
from systems.PathProcessor import PathProcessor
from systems.MovementProcessor import MovementProcessor
simulation = Simulator(config)
store_goto_position_event(simulation, entity_id, pos) # auxiliar method to store goto event
width, height = simulation.window_dimensions
simulation.add_des_system((gotoProcessor.process,))
simulation.add_system(PathProcessor())
simulation.add_system(MovementProcessor(minx=0, miny=0, maxx=width, maxy=height))
simulation.run()
def store_goto_position_event(simulation, entity_id, pos): # pos -> [x, y]
id = get_entity_id(simulation, entity_id)
payload = GotoPosPayload(id, pos)
new_event = EVENT(GotoPosEventTag, payload)
event_store = simulation.KWARGS['EVENT_STORE']
event_store.put(new_event)