SOLA
Loading...
Searching...
No Matches
amr_mobility_helper.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_CPPS_AMR_AMR_MOBILITY_HELPER_H_
18#define DAISI_CPPS_AMR_AMR_MOBILITY_HELPER_H_
19
20#include <vector>
21
22#include "cpps/amr/amr_description.h"
23#include "cpps/amr/amr_topology.h"
24#include "cpps/amr/physical/amr_mobility_status.h"
25#include "cpps/amr/physical/functionality.h"
26#include "utils/structure_helpers.h"
27
28namespace daisi::cpps {
31public:
39 static util::Duration estimateDuration(const util::Pose &start_pose,
40 const std::vector<FunctionalityVariant> &functionalities,
41 const AmrDescription &description,
42 const Topology &topology, bool check_positioning = true);
43
51 static util::Duration estimateDuration(const util::Pose &start_pose,
52 const FunctionalityVariant &functionality,
53 const AmrDescription &description,
54 const Topology &topology, bool check_positioning = true);
55
64 static std::vector<daisi::cpps::AmrMobilityStatus> calculatePhases(
65 const util::Duration &start_timestamp, const util::Pose &start_pose,
66 const FunctionalityVariant &functionality, const AmrDescription &description,
67 const Topology &topology);
68
74 const daisi::cpps::AmrMobilityStatus &current_phase, const util::Duration &current_timestamp);
75
79 static daisi::util::Distance calculateDistance(
80 const daisi::util::Position &start_position,
81 const std::vector<FunctionalityVariant> &functionalities);
82
87 static std::tuple<daisi::util::Duration, daisi::util::Duration, daisi::util::Duration,
88 daisi::util::Distance, daisi::util::Distance>
89 calculateMetricsByDomain(const daisi::util::Position &start_position,
90 const std::vector<FunctionalityVariant> &functionalities,
91 const AmrDescription &description, const Topology &topology);
92
93private:
96 static std::vector<util::Duration> calculatePhaseDurations(const std::vector<double> &distances_m,
97 const AmrDescription &description);
98
101 static std::vector<double> calculatePhaseDistances(const util::Position &start_position,
102 const FunctionalityVariant &functionality,
103 const AmrDescription &description);
104
105 static std::vector<AmrMobilityStatus> calculatePhases(const util::Duration &start_timestamp,
106 const util::Position &start_position,
107 const util::Position &destination,
108 const std::vector<double> &distances,
109 const util::Duration &stationary_time,
110 const AmrDescription &description);
111
112 static std::vector<AmrMobilityStatus> calculatePhases(const util::Duration &start_timestamp,
113 const util::Position &start_position,
114 const Navigate &navigate,
115 const AmrDescription &description);
116
119 static daisi::util::Distance calculateDistance(const util::Position &start_position,
120 const FunctionalityVariant &functionality);
121
122 static daisi::util::Distance calculateDistance(const util::Position &start_position,
123 const Navigate &functionality);
125
126 static void arePositionsInTopology(const daisi::cpps::FunctionalityVariant &functionality,
127 const Topology &topology);
128
129 static void arePositionsInTopology(const std::vector<FunctionalityVariant> &functionalities,
130 const Topology &topology);
131
132 static bool isFunctionalityInDescription(const FunctionalityVariant &functionality,
133 const AmrDescription &description);
134
135 static void sanityCheck(const util::Pose &start_pose, const FunctionalityVariant &functionality,
136 const AmrDescription &description, const Topology &topology);
137};
138
139} // namespace daisi::cpps
140#endif
Definition amr_description.h:27
Definition amr_mobility_helper.h:30
static daisi::util::Distance calculateDistance(const daisi::util::Position &start_position, const std::vector< FunctionalityVariant > &functionalities)
Calculates distance it takes to execute reach functionality starting from start_position.
Definition amr_mobility_helper.cpp:475
static std::vector< daisi::cpps::AmrMobilityStatus > calculatePhases(const util::Duration &start_timestamp, const util::Pose &start_pose, const FunctionalityVariant &functionality, const AmrDescription &description, const Topology &topology)
Calculates acceleration, constant velocity and deceleration phases for simulation....
Definition amr_mobility_helper.cpp:82
static util::Duration estimateDuration(const util::Pose &start_pose, const std::vector< FunctionalityVariant > &functionalities, const AmrDescription &description, const Topology &topology, bool check_positioning=true)
Estimates how much time (seconds) it takes to complete a list of FunctionalityVariant .
Definition amr_mobility_helper.cpp:30
static daisi::cpps::AmrMobilityStatus calculateMobilityStatus(const daisi::cpps::AmrMobilityStatus &current_phase, const util::Duration &current_timestamp)
Calculates the current status of the AMR for simulation.
Definition amr_mobility_helper.cpp:108
static std::tuple< daisi::util::Duration, daisi::util::Duration, daisi::util::Duration, daisi::util::Distance, daisi::util::Distance > calculateMetricsByDomain(const daisi::util::Position &start_position, const std::vector< FunctionalityVariant > &functionalities, const AmrDescription &description, const Topology &topology)
Calculates durations and distances different parts of the execution. The domains are empty travel (wh...
Definition amr_mobility_helper.cpp:497
Definition navigate.h:26
Definition amr_topology.h:26
Definition amr_mobility_status.h:32
Definition structure_helpers.h:64