SOLA
Loading...
Searching...
No Matches
agv_physical_basic.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_AGV_PHYSICAL_BASIC_H_
18#define DAISI_AGV_PHYSICAL_BASIC_H_
19
20#include "cpps/amr/amr_description.h"
21#include "cpps/amr/amr_topology.h"
22#include "cpps/amr/physical/amr_mobility_model_ns3.h"
23#include "ns3/socket.h"
24
25namespace daisi::cpps {
26
28public:
29 AGVPhysicalBasic(AmrDescription description, const Topology &topology,
30 ns3::Ptr<cpps::AmrMobilityModelNs3> mobility, int id_for_friendly,
31 ns3::Ptr<ns3::Socket> socket); // TODO WORKAROUND: id_for_friendly
32
33 void connect(ns3::InetSocketAddress endpoint);
34
35private:
36 void mobilityCallback();
37
38 void readFromSocket(ns3::Ptr<ns3::Socket> socket);
39
40 void sendPosUpdate();
41
42 static constexpr uint32_t kUpdateFrequencyHz = 30;
43 void sendFieldMessage(const std::string &content);
44
45 ns3::EventId next_update_event_;
46
47 // mechanical information
48 AmrDescription amr_description_;
49 ns3::Ptr<AmrMobilityModelNs3> mobility_;
50
51 // global information
52 Topology topology_;
53
54 ns3::Ptr<ns3::Socket> socket_;
55
56 ns3::Vector goal_;
57
58 enum class State { kIdle, kMoving, kLoading, kUnloading } state_ = State::kIdle;
59
60 std::string generatePosUpdate();
61};
62
63} // namespace daisi::cpps
64
65#endif // DAISI_AGV_PHYSICAL_BASIC_H_
Definition agv_physical_basic.h:27
Definition amr_description.h:27
Definition amr_topology.h:26