-
Notifications
You must be signed in to change notification settings - Fork 5
/
DemoProbHRMArticulatedBodyPlanning3D.cpp
64 lines (52 loc) · 2.28 KB
/
DemoProbHRMArticulatedBodyPlanning3D.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/** \author Sipu Ruan */
#include "hrm/config.h"
#include "hrm/planners/ProbHRM3D.h"
#include "hrm/test/util/DisplayPlanningData.h"
#include "hrm/test/util/GTestUtils.h"
#include "hrm/test/util/ParsePlanningSettings.h"
int main() {
// Setup environment config
const std::string robotType = "snake";
hrm::parsePlanningConfig("superquadrics", "cluttered", robotType, "3D");
const int NUM_SURF_PARAM = 20;
const double MAX_PLAN_TIME = 5.0;
hrm::PlannerSetting3D env3D(NUM_SURF_PARAM);
env3D.loadEnvironment(CONFIG_PATH "/");
// Setup robot
const auto robot =
hrm::loadRobotMultiBody3D(CONFIG_PATH "/", "0", NUM_SURF_PARAM);
const std::string urdfFile =
RESOURCES_PATH "/3D/urdf/" + robotType + ".urdf";
// Planning requests
hrm::PlanningRequest req;
req.start = env3D.getEndPoints().at(0);
req.goal = env3D.getEndPoints().at(1);
hrm::defineParameters(robot, env3D, req.parameters);
// Main algorithm
std::cout << "Highway RoadMap for 3D rigid-body planning" << std::endl;
std::cout << "----------" << std::endl;
std::cout << "Input number of C-slices: " << req.parameters.numSlice
<< std::endl;
std::cout << "Input number of sweep lines {X,Y}: {"
<< req.parameters.numLineX << ',' << req.parameters.numLineY
<< '}' << std::endl;
std::cout << "----------" << std::endl;
std::cout << "Start planning..." << std::endl;
hrm::planners::ProbHRM3D hrm(robot, urdfFile, env3D.getArena(),
env3D.getObstacle(), req);
hrm.plan(MAX_PLAN_TIME);
hrm::PlanningResult res = hrm.getPlanningResult();
// Planning results: Time and Path Cost
std::cout << "----------" << std::endl;
std::cout << "Final number of sweep lines {X,Y}: {"
<< hrm.getPlannerParameters().numLineX << ','
<< hrm.getPlannerParameters().numLineY << '}' << std::endl;
// Display and store results
hrm::displayPlanningTimeInfo(res.planningTime);
hrm::displayGraphInfo(res.graphStructure);
hrm::displayPathInfo(res.solutionPath);
hrm::storeGraphInfo(res.graphStructure, "prob_hrm_3D");
hrm::storePathInfo(res.solutionPath, "prob_hrm_3D");
hrm::storeRoutines<hrm::planners::HRM3D>(hrm, "prob_hrm_3D");
return 0;
}