diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 9eb8204..e748c55 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -8,81 +8,64 @@ if(ROCK_QT_VERSION_4) PlannerGui.h MOC PlannerGui.h - DEPS ugv_nav4d Qt4::QtCore - DEPS_PKGCONFIG vizkit3d - vizkit3d-viz - maps-viz - base-viz - sbpl_spline_primitives-viz - base-types - trajectory_follower-viz - pcl_common-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} - pcl_io-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} + DEPS ugv_nav4d Qt4::QtCore + DEPS_PKGCONFIG vizkit3d + vizkit3d-viz + maps-viz + base-viz + sbpl_spline_primitives-viz + base-types + trajectory_follower-viz + pcl_common-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} + pcl_io-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} ) -endif(ROCK_QT_VERSION_4) - -if(ROCK_QT_VERSION_5) - rock_library(ugv_nav4d_gui-qt5 - SOURCES - PlannerGui.cpp - HEADERS - PlannerGui.h - MOC5 - PlannerGui.h - DEPS ugv_nav4d-qt5 Qt5::Core - DEPS_PKGCONFIG vizkit3d-qt5 - vizkit3d-viz-qt5 - maps-viz-qt5 - base-viz-qt5 - sbpl_spline_primitives-viz-qt5 - base-types - trajectory_follower-viz-qt5 - pcl_common-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} - pcl_io-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} - ) -endif(ROCK_QT_VERSION_5) -if(ROCK_QT_VERSION_4) rock_executable(ugv_nav4d_bin - SOURCES + SOURCES Main.cpp DEPS ugv_nav4d ugv_nav4d_gui ) rock_executable(ugv_nav4d_replay - SOURCES + SOURCES ReplayDump.cpp DEPS ugv_nav4d ugv_nav4d_gui DEPS_PKGCONFIG vizkit3d maps-viz base-viz sbpl_spline_primitives-viz base-types trajectory_follower-viz ) - if(ROCK_QT_VERSION_5) - rock_executable(ugv_nav4d_bin-qt5 - SOURCES - Main.cpp - DEPS ugv_nav4d-qt5 ugv_nav4d_gui-qt5 - ) +endif(ROCK_QT_VERSION_4) - rock_executable(ugv_nav4d_replay-qt5 - SOURCES - ReplayDump.cpp - DEPS ugv_nav4d-qt5 ugv_nav4d_gui-qt5 - DEPS_PKGCONFIG vizkit3d-qt5 maps-viz-qt5 base-viz-qt5 - sbpl_spline_primitives-viz-qt5 base-types trajectory_follower-viz-qt5 - ) - endif(ROCK_QT_VERSION_5) -elseif(ROCK_QT_VERSION_5) - rock_executable(ugv_nav4d_bin +if(ROCK_QT_VERSION_5) + rock_library(ugv_nav4d_gui-qt5 + SOURCES + PlannerGui.cpp + HEADERS + PlannerGui.h + MOC5 + PlannerGui.h + DEPS ugv_nav4d-qt5 Qt5::Core + DEPS_PKGCONFIG vizkit3d-qt5 + vizkit3d-viz-qt5 + maps-viz-qt5 + base-viz-qt5 + sbpl_spline_primitives-viz-qt5 + base-types + trajectory_follower-viz-qt5 + pcl_common-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} + pcl_io-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} + ) + + rock_executable(ugv_nav4d_bin-qt5 SOURCES Main.cpp - DEPS ugv_nav4d-qt5 ugv_nav4d_gui-qt5 + DEPS ugv_nav4d-qt5 ugv_nav4d_gui-qt5 ) - rock_executable(ugv_nav4d_replay + rock_executable(ugv_nav4d_replay-qt5 SOURCES ReplayDump.cpp - DEPS ugv_nav4d-qt5 ugv_nav4d_gui-qt5 - DEPS_PKGCONFIG vizkit3d-qt5 maps-viz-qt5 base-viz-qt5 - sbpl_spline_primitives-viz-qt5 base-types trajectory_follower-viz-qt5 + DEPS ugv_nav4d-qt5 ugv_nav4d_gui-qt5 + DEPS_PKGCONFIG vizkit3d-qt5 maps-viz-qt5 base-viz-qt5 + sbpl_spline_primitives-viz-qt5 base-types trajectory_follower-viz-qt5 ) -endif() +endif(ROCK_QT_VERSION_5) \ No newline at end of file diff --git a/src/gui/PlannerGui.cpp b/src/gui/PlannerGui.cpp index b055e4f..cf44cff 100644 --- a/src/gui/PlannerGui.cpp +++ b/src/gui/PlannerGui.cpp @@ -22,6 +22,8 @@ using namespace ugv_nav4d; +//#define ENABLE_V3DD_DRAWINGS + PlannerGui::PlannerGui(const std::string& dumpName): QObject() { setupUI(); @@ -64,8 +66,9 @@ void PlannerGui::setupUI() goal.orientation.setIdentity(); widget = new vizkit3d::Vizkit3DWidget(); +#ifdef ENABLE_V3DD_DRAWINGS V3DD::CONFIGURE_DEBUG_DRAWINGS_USE_EXISTING_WIDGET(widget); - +#endif trav3dViz.setPluginName("TravMap"); obstacleMapViz.setPluginName("ObstacleMap"); @@ -448,11 +451,12 @@ void PlannerGui::picked(float x, float y, float z, int buttonMask, int modifierM { start.position << x, y, z; start.position.z() += travConfig.distToGround; //because we click on the ground but need to put robot position - + +#ifdef ENABLE_V3DD_DRAWINGS V3DD::CLEAR_DRAWING("ugv_nav4d_start_aabb"); V3DD::DRAW_WIREFRAME_BOX("ugv_nav4d_start_aabb", start.position + base::Vector3d(0, 0, travConfig.distToGround / 2.0), start.orientation, base::Vector3d(travConfig.robotSizeX, travConfig.robotSizeY, travConfig.robotHeight - travConfig.distToGround), V3DD::Color::cyan); - +#endif QVector3D pos(start.position.x(), start.position.y(), start.position.z()); startViz.setTranslation(pos); LOG_INFO_S << "Start: " << start.position.transpose(); @@ -536,10 +540,11 @@ void PlannerGui::startOrientationChanged(int newValue) const double rad = newValue/180.0 * M_PI; start.orientation = Eigen::AngleAxisd(rad, Eigen::Vector3d::UnitZ()); startViz.setRotation(QQuaternion(start.orientation.w(), start.orientation.x(), start.orientation.y(), start.orientation.z())); - +#ifdef ENABLE_V3DD_DRAWINGS V3DD::CLEAR_DRAWING("ugv_nav4d_start_aabb"); V3DD::DRAW_WIREFRAME_BOX("ugv_nav4d_start_aabb", start.position + Eigen::Vector3d(0, 0, travConfig.distToGround), start.orientation, base::Vector3d(travConfig.robotSizeX, travConfig.robotSizeY, travConfig.robotHeight), V3DD::Color::cyan); +#endif } void PlannerGui::obstacleDistanceSpinBoxEditingFinished() @@ -569,8 +574,9 @@ void PlannerGui::startPlanThread() { bar->setMaximum(0); std::thread t([this](){ +#ifdef ENABLE_V3DD_DRAWINGS V3DD::CONFIGURE_DEBUG_DRAWINGS_USE_EXISTING_WIDGET(this->widget); - +#endif this->plan(this->start, this->goal); }); t.detach(); //needed to avoid destruction of thread at end of method