ice_conversions.h
Go to the documentation of this file.
1 /**
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @author Fabian Reister ( fabian dot reister at kit dot edu )
17  * @date 2021
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
22 #pragma once
23 
24 #include <optional>
25 #include <string>
26 #include <vector>
27 
29 
30 #include <armarx/navigation/client/ice/NavigatorInterface.h>
33 
35 {
36 
37  // TODO move type out of this header (e.g. to types.h)
39  {
40  std::optional<std::string> locationId = std::nullopt;
41  std::optional<core::Pose> pose = std::nullopt;
42 
44 
45  //client::Config config;
46  };
47 
48  inline std::ostream&
49  operator<<(std::ostream& str, const WaypointTarget& res)
50  {
51  str << "WaypointTarget { ";
52 
53  if (res.locationId.has_value() and not res.locationId->empty())
54  {
55  str << "location: " << res.locationId.value();
56  }
57  else if (res.pose.has_value())
58  {
59  str << "pose :" << res.pose->matrix();
60  }
61 
62  str << "}";
63 
64  return str;
65  }
66 
67 
68  // TODO move to util file
69  inline void
70  validate(const std::vector<WaypointTarget>& path)
71  {
72  std::for_each(path.begin(),
73  path.end(),
74  [](const WaypointTarget& wpTarget)
75  {
76  ARMARX_CHECK(wpTarget.locationId.has_value() or wpTarget.pose.has_value())
77  << "Either `locationId` or `pose` has to be provided.";
78  });
79  }
80 
81  using WaypointTargets = std::vector<WaypointTarget>;
82 
86 
90 
91 } // namespace armarx::navigation::client
armarx::navigation::client::detail::GlobalPlanningStrategy
GlobalPlanningStrategy
Definition: NavigatorInterface.ice:43
str
std::string str(const T &t)
Definition: UserAssistedSegmenterGuiWidgetController.cpp:42
types.h
basic_types.h
armarx::navigation::client::GlobalPlanningStrategy::Free
@ Free
armarx::navigation::client::freeze
client::detail::GlobalPlanningStrategy freeze(const client::GlobalPlanningStrategy &strategy)
Definition: ice_conversions.cpp:77
armarx::navigation::client::WaypointTarget::strategy
client::GlobalPlanningStrategy strategy
Definition: ice_conversions.h:43
boost::target
Vertex target(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:688
armarx::navigation::client
This file is part of ArmarX.
Definition: ComponentPlugin.cpp:20
armarx::navigation::client::WaypointTarget::pose
std::optional< core::Pose > pose
Definition: ice_conversions.h:41
armarx::navigation::client::WaypointTarget::locationId
std::optional< std::string > locationId
Definition: ice_conversions.h:40
armarx::navigation::client::defrost
client::GlobalPlanningStrategy defrost(const client::detail::GlobalPlanningStrategy &strategy)
Definition: ice_conversions.cpp:16
armarx::navigation::client::detail::Waypoints
sequence< Waypoint > Waypoints
Definition: NavigatorInterface.ice:58
armarx::navigation::client::operator<<
std::ostream & operator<<(std::ostream &str, const WaypointTarget &res)
Definition: ice_conversions.h:49
armarx::navigation::client::WaypointTarget
Definition: ice_conversions.h:38
ExpressionException.h
armarx::navigation::client::validate
void validate(const std::vector< WaypointTarget > &path)
Definition: ice_conversions.h:70
armarx::navigation::client::GlobalPlanningStrategy
GlobalPlanningStrategy
Definition: types.h:27
armarx::navigation::client::WaypointTargets
std::vector< WaypointTarget > WaypointTargets
Definition: ice_conversions.h:81
armarx::navigation::client::detail::Waypoint
Definition: NavigatorInterface.ice:50