SOLA
Loading...
Searching...
No Matches
path_planning_application.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_PATH_PLANNING_PATH_PLANNING_APPLICATION_H_
18#define DAISI_PATH_PLANNING_PATH_PLANNING_APPLICATION_H_
19
20#include <deque>
21#include <utility>
22
23#include "cpps/common/cpps_logger_ns3.h"
24#include "delivery_station.h"
25#include "ns3/applications-module.h"
26#include "ns3/network-module.h"
27#include "path_planning/agv_logical.h"
28#include "path_planning/agv_physical_basic.h"
29#include "path_planning/consensus/central/central_server.h"
30#include "path_planning/consensus/paxos/constants.h"
31#include "pickup_station.h"
32#include "station.h"
33
34namespace daisi::path_planning {
35
39struct PathPlanningApplication final : public ns3::Application {
40 static ns3::TypeId GetTypeId();
41
42 void DoDispose() final {}
43 void StartApplication() final {}
44
45 void initPickupStation(const PickupStationInfo &info,
46 const consensus::ConsensusSettings &settings, NextTOMode next_to_mode);
47 void initDeliveryStation(const DeliveryStationInfo &info,
48 const consensus::ConsensusSettings &settings);
49 void initAGVLogical(const consensus::ConsensusSettings &settings, bool first_node);
50 void initAGVPhysical(const cpps::AmrDescription &description,
51 ns3::Ptr<cpps::AmrMobilityModelNs3> mobility, int id_friendly);
52 void initConsensusCentralServer(const consensus::CentralSettings &settings);
53
54 void postInit();
55
56 void setTopology(cpps::Topology topology) { topology_ = std::move(topology); };
57
64 void generateUDPSockets(uint32_t number = 3);
65 ns3::Ptr<ns3::Socket> generateTCPSocket();
66
67 ns3::Ipv4Address local_ip_address;
68 ns3::Ipv4Address local_ip_address_tcp;
71 uint16_t listening_port;
73 std::variant<std::monostate, cpps::AGVPhysicalBasic, AGVLogical, PickupStation, DeliveryStation,
76
77private:
78 bool initialized_ = false;
79 cpps::Topology topology_;
80
81 void checkInitialized();
82};
83} // namespace daisi::path_planning
84#endif // DAISI_PATH_PLANNING_PATH_PLANNING_APPLICATION_H_
Definition agv_physical_basic.h:27
Definition amr_description.h:27
Definition amr_topology.h:26
Definition agv_logical.h:41
Definition delivery_station.h:38
Definition pickup_station.h:47
Definition path_planning_application.h:39
uint16_t listening_port_tcp
ns-3 attribute with second port used for this application
Definition path_planning_application.h:72
ns3::Ipv4Address local_ip_address_tcp
Definition path_planning_application.h:68
ns3::Ipv4Address local_ip_address
ns-3 attribute with first IP of this application
Definition path_planning_application.h:67
uint16_t listening_port
ns-3 attribute with first port used for this application
Definition path_planning_application.h:71
void generateUDPSockets(uint32_t number=3)
Definition path_planning_application.cpp:45
std::variant< std::monostate, cpps::AGVPhysicalBasic, AGVLogical, PickupStation, DeliveryStation, consensus::CentralServer > application
Variant that is holding the actual application.
Definition path_planning_application.h:75
Definition central_settings.h:24