-
Notifications
You must be signed in to change notification settings - Fork 5
/
DemoHRMRigidBodyPlanning3D.cpp
64 lines (51 loc) · 2.25 KB
/
DemoHRMRigidBodyPlanning3D.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/HRM3D.h"
#include "hrm/test/util/DisplayPlanningData.h"
#include "hrm/test/util/GTestUtils.h"
#include "hrm/test/util/ParsePlanningSettings.h"
int main() {
// Setup environment config
hrm::parsePlanningConfig("superquadrics", "cluttered", "rabbit", "3D");
const int NUM_SURF_PARAM = 20;
const double MAX_PLAN_TIME = 5.0;
hrm::PlannerSetting3D env3D(NUM_SURF_PARAM);
env3D.loadEnvironment(CONFIG_PATH "/");
// Using fixed orientations from Icosahedral symmetry group
const std::string quatFile =
RESOURCES_PATH "/SO3_sequence/q_icosahedron_60.csv";
// Setup robot
const auto robot =
hrm::loadRobotMultiBody3D(CONFIG_PATH "/", quatFile, NUM_SURF_PARAM);
// 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::HRM3D hrm(robot, 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, "hrm_3D");
hrm::storePathInfo(res.solutionPath, "hrm_3D");
hrm::storeRoutines<hrm::planners::HRM3D>(hrm, "hrm_3D");
return 0;
}