Point2Point.cpp
Go to the documentation of this file.
1 #include "Point2Point.h"
2 
3 #include <memory>
4 
5 #include <VirtualRobot/Robot.h>
6 
7 #include <ArmarXCore/interface/serialization/Eigen/Eigen_fdi.h>
8 
13 #include <armarx/navigation/global_planning/aron/Point2PointParams.aron.generated.h>
16 
18 {
19 
20  // Point2PointParams
21 
24  {
26  }
27 
30  {
31  arondto::Point2PointParams dto;
32 
34  aron_conv::toAron(dto, bo);
35 
36  return dto.toAron();
37  }
38 
41  {
43 
44  arondto::Point2PointParams dto;
45  dto.fromAron(dict);
46 
48  aron_conv::fromAron(dto, bo);
49 
50  return bo;
51  }
52 
53  // Point2Point
54 
56  GlobalPlanner(ctx), params(params)
57  {
58  }
59 
60  std::optional<GlobalPlannerResult>
62  {
63  std::vector<core::GlobalTrajectoryPoint> trajectory;
64 
66  {
67  trajectory.push_back(core::GlobalTrajectoryPoint{
68  .waypoint = core::Waypoint{.pose = core::Pose(scene.robot->getGlobalPose())},
69  .velocity = params.velocity});
70  }
71 
72  trajectory.push_back(core::GlobalTrajectoryPoint{.waypoint = core::Waypoint{.pose = goal},
73  .velocity = params.velocity});
74 
75  return GlobalPlannerResult{.trajectory = trajectory};
76  }
77 
78  std::optional<GlobalPlannerResult>
79  Point2Point::plan(const core::Pose& start, const core::Pose& goal)
80  {
81  std::vector<core::GlobalTrajectoryPoint> trajectory;
82 
84  {
85  trajectory.push_back(core::GlobalTrajectoryPoint{.waypoint = core::Waypoint{.pose = start},
86  .velocity = params.velocity});
87  }
88 
89  trajectory.push_back(core::GlobalTrajectoryPoint{.waypoint = core::Waypoint{.pose = goal},
90  .velocity = params.velocity});
91 
92  return GlobalPlannerResult{.trajectory = trajectory};
93  }
94 
95 } // namespace armarx::navigation::global_planning
armarx::navigation::core::Scene::robot
VirtualRobot::RobotPtr robot
Definition: types.h:78
armarx::navigation::core::Waypoint::pose
Pose pose
Definition: basic_types.h:50
armarx::navigation::global_planning::Point2PointParams::algorithm
Algorithms algorithm() const override
Definition: Point2Point.cpp:23
aron_conversions.h
armarx::navigation::core::Pose
Eigen::Isometry3f Pose
Definition: basic_types.h:31
armarx::navigation::core::GlobalTrajectoryPoint::waypoint
Waypoint waypoint
Definition: Trajectory.h:37
armarx::navigation::global_planning::Algorithms::Point2Point
@ Point2Point
see Point2Point
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::navigation::global_planning::GlobalPlannerResult::trajectory
core::GlobalTrajectory trajectory
Definition: GlobalPlanner.h:40
armarx::navigation::global_planning::Point2Point::plan
std::optional< GlobalPlannerResult > plan(const core::Pose &goal) override
Definition: Point2Point.cpp:61
armarx::navigation::global_planning::GlobalPlanner::scene
const core::Scene & scene
Definition: GlobalPlanner.h:75
armarx::navigation::global_planning::Point2PointParams::FromAron
static Point2PointParams FromAron(const aron::data::DictPtr &dict)
Definition: Point2Point.cpp:40
constants.h
armarx::navigation::global_planning::Point2PointParams::toAron
aron::data::DictPtr toAron() const override
Definition: Point2Point.cpp:29
armarx::navigation::global_planning::aron_conv::toAron
void toAron(arondto::GlobalPlannerParams &dto, const GlobalPlannerParams &bo)
Definition: aron_conversions.cpp:23
armarx::navigation::core::GlobalTrajectoryPoint
Definition: Trajectory.h:35
Point2Point.h
armarx::navigation::global_planning::aron_conv::fromAron
void fromAron(const arondto::GlobalPlannerParams &dto, GlobalPlannerParams &bo)
Definition: aron_conversions.cpp:28
armarx::navigation::core::Waypoint
Definition: basic_types.h:48
GlobalPlanner.h
armarx::navigation::global_planning::GlobalPlannerResult
Definition: GlobalPlanner.h:38
armarx::navigation::core::Scene
Definition: types.h:71
armarx::navigation::global_planning::Point2Point::params
const Params params
Definition: Point2Point.h:64
armarx::navigation::global_planning::GlobalPlanner
Definition: GlobalPlanner.h:64
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::navigation::global_planning::Point2Point::Point2Point
Point2Point(const Params &params, const core::Scene &ctx)
Definition: Point2Point.cpp:55
armarx::navigation::global_planning::Point2PointParams
Parameters for Point2Point.
Definition: Point2Point.h:35
armarx::navigation::global_planning::Point2PointParams::velocity
float velocity
Definition: Point2Point.h:39
core.h
armarx::navigation::global_planning::Algorithms
Algorithms
Definition: core.h:38
Trajectory.h
armarx::navigation::global_planning::Point2PointParams::includeStartPose
bool includeStartPose
Definition: Point2Point.h:37
types.h
armarx::aron::bo
const std::optional< BoT > & bo
Definition: aron_conversions.h:168
armarx::navigation::global_planning
This file is part of ArmarX.
Definition: fwd.h:29