Skip to content

Commit

Permalink
Update cmake for the gui
Browse files Browse the repository at this point in the history
  • Loading branch information
mulo01 committed Aug 15, 2024
1 parent 9383e8a commit 808bae3
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 62 deletions.
97 changes: 40 additions & 57 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
16 changes: 11 additions & 5 deletions src/gui/PlannerGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

using namespace ugv_nav4d;

//#define ENABLE_V3DD_DRAWINGS

PlannerGui::PlannerGui(const std::string& dumpName): QObject()
{
setupUI();
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 808bae3

Please sign in to comment.