Skip to content

Commit a558a32

Browse files
committed
Remove 2D Trajectory
1 parent d7cbb13 commit a558a32

File tree

6 files changed

+16
-25
lines changed

6 files changed

+16
-25
lines changed

src/EnvironmentXYZTheta.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,10 @@ vector<Motion> EnvironmentXYZTheta::getMotions(const vector< int >& stateIDPath)
951951

952952
void EnvironmentXYZTheta::getTrajectory(const vector<int>& stateIDPath,
953953
vector<SubTrajectory>& result,
954-
bool setZToZero, const Eigen::Vector3d &startPos,
955-
const Eigen::Vector3d &goalPos, const double& goalHeading, const Eigen::Affine3d &plan2Body)
954+
const Eigen::Vector3d &startPos,
955+
const Eigen::Vector3d &goalPos,
956+
const double& goalHeading,
957+
const Eigen::Affine3d &plan2Body)
956958
{
957959
if(stateIDPath.size() < 2)
958960
return;

src/EnvironmentXYZTheta.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ class EnvironmentXYZTheta : public DiscreteSpaceInformation
200200
std::vector<Motion> getMotions(const std::vector<int> &stateIDPath);
201201

202202
void getTrajectory(const std::vector<int> &stateIDPath, std::vector<trajectory_follower::SubTrajectory> &result,
203-
bool setZToZero, const Eigen::Vector3d &startPos, const Eigen::Vector3d &goalPos, const double& goalHeading, const Eigen::Affine3d &plan2Body = Eigen::Affine3d::Identity());
203+
const Eigen::Vector3d &startPos, const Eigen::Vector3d &goalPos, const double& goalHeading,
204+
const Eigen::Affine3d &plan2Body = Eigen::Affine3d::Identity());
204205

205206
const PreComputedMotions& getAvailableMotions() const;
206207

src/Planner.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ bool Planner::tryGoal(const Eigen::Vector3d& translation, const double yaw) noex
134134

135135
Planner::PLANNING_RESULT Planner::plan(const base::Time& maxTime, const base::samples::RigidBodyState& start_pose,
136136
const base::samples::RigidBodyState& end_pose,
137-
std::vector<SubTrajectory>& resultTrajectory2D,
138137
std::vector<SubTrajectory>& resultTrajectory3D,
139138
bool dumpOnError, bool dumpOnSuccess)
140139
{
@@ -150,7 +149,6 @@ Planner::PLANNING_RESULT Planner::plan(const base::Time& maxTime, const base::sa
150149
return NO_MAP;
151150
}
152151

153-
resultTrajectory2D.clear();
154152
resultTrajectory3D.clear();
155153
env->clear();
156154

@@ -261,8 +259,7 @@ Planner::PLANNING_RESULT Planner::plan(const base::Time& maxTime, const base::sa
261259
std::vector<PlannerStats> stats;
262260

263261
planner->get_search_stats(&stats);
264-
env->getTrajectory(solutionIds, resultTrajectory2D, true, start_translation, goal_translation, end_pose.getYaw(), ground2Body);
265-
env->getTrajectory(solutionIds, resultTrajectory3D, false, start_translation, goal_translation,end_pose.getYaw(), ground2Body);
262+
env->getTrajectory(solutionIds, resultTrajectory3D, start_translation, goal_translation,end_pose.getYaw(), ground2Body);
266263
}
267264
catch(const SBPL_Exception& ex)
268265
{

src/Planner.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ class Planner
123123
* @return An enum indicating the planner state
124124
* */
125125
PLANNING_RESULT plan(const base::Time& maxTime, const base::samples::RigidBodyState& start_pose,
126-
const base::samples::RigidBodyState& end_pose, std::vector<trajectory_follower::SubTrajectory>& resultTrajectory2D,
127-
std::vector<trajectory_follower::SubTrajectory>& resultTrajectory3D, bool dumpOnError = false, bool dumpOnSuccess = false);
126+
const base::samples::RigidBodyState& end_pose,
127+
std::vector<trajectory_follower::SubTrajectory>& resultTrajectory3D, bool dumpOnError = false,
128+
bool dumpOnSuccess = false);
128129

129130
void setTravConfig(const traversability_generator3d::TraversabilityConfig& config);
130131

src/gui/PlannerGui.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ void PlannerGui::setupUI()
7676
widget->setCameraManipulator(vizkit3d::ORBIT_MANIPULATOR);
7777
widget->addPlugin(&splineViz);
7878
widget->addPlugin(&trajViz);
79-
widget->addPlugin(&trajViz2);
8079
widget->addPlugin(&mlsViz);
8180
widget->addPlugin(&trav3dViz);
8281
widget->addPlugin(&obstacleMapViz);
@@ -96,13 +95,9 @@ void PlannerGui::setupUI()
9695
mlsViz.setPluginName("MLSMap");
9796

9897
trajViz.setLineWidth(5);
99-
trajViz.setColor(QColor("Cyan"));
100-
trajViz.setPluginEnabled(false);
101-
trajViz.setPluginName("Trajectory 2D");
102-
103-
trajViz2.setLineWidth(5);
104-
trajViz2.setColor(QColor("magenta"));
105-
trajViz2.setPluginName("Trajectory 3D");
98+
trajViz.setColor(QColor("magenta"));
99+
trajViz.setPluginEnabled(true);
100+
trajViz.setPluginName("Trajectory");
106101

107102
QVBoxLayout* layout = new QVBoxLayout();
108103

@@ -324,7 +319,7 @@ void PlannerGui::setupPlanner(int argc, char** argv)
324319
mobilityConfig.multiplierPointTurn = 3;
325320
mobilityConfig.maxMotionCurveLength = 100;
326321
mobilityConfig.spline_sampling_resolution = 0.05;
327-
mobilityConfig.remove_goal_offset = false;
322+
mobilityConfig.remove_goal_offset = true;
328323

329324
travConfig.gridResolution = res;
330325
travConfig.maxSlope = 0.45; //40.0/180.0 * M_PI;
@@ -611,9 +606,6 @@ void PlannerGui::plannerIsDone()
611606
{
612607
trajViz.updateData(path);
613608
trajViz.setLineWidth(8);
614-
615-
trajViz2.updateData(beautifiedPath);
616-
trajViz2.setLineWidth(8);
617609

618610
trav3dViz.updateData((planner->getTraversabilityMap().copyCast<maps::grid::TraversabilityNodeBase *>()));
619611
obstacleMapViz.updateData((planner->getObstacleMap().copyCast<maps::grid::TraversabilityNodeBase *>()));
@@ -655,7 +647,7 @@ void PlannerGui::plan(const base::Pose& start, const base::Pose& goal)
655647
LOG_INFO_S << "Planning: " << start << " -> " << goal;
656648

657649
const Planner::PLANNING_RESULT result = planner->plan(base::Time::fromSeconds(time->value()),
658-
startState, endState, path, beautifiedPath);
650+
startState, endState, path);
659651
switch(result)
660652
{
661653
case Planner::GOAL_INVALID:

src/gui/PlannerGui.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,5 @@ private slots:
113113
traversability_generator3d::TraversabilityConfig travConfig;
114114
ugv_nav4d::PlannerConfig plannerConfig;
115115
std::shared_ptr<ugv_nav4d::Planner> planner; //is pointer cause of lazy init
116-
std::vector<trajectory_follower::SubTrajectory> path;
117-
std::vector<trajectory_follower::SubTrajectory> beautifiedPath;
118-
116+
std::vector<trajectory_follower::SubTrajectory> path;
119117
};

0 commit comments

Comments
 (0)