30 #include <QApplication>
33 #include <boost/program_options.hpp>
34 #include <boost/filesystem.hpp>
36 #include <OgreMaterialManager.h>
37 #include <OgreGpuProgramManager.h>
38 #include <OgreHighLevelGpuProgramManager.h>
39 #include <std_srvs/Empty.h>
42 #include <ApplicationServices/ApplicationServices.h>
61 #define CATCH_EXCEPTIONS 0
63 namespace po = boost::program_options;
64 namespace fs = boost::filesystem;
68 bool reloadShaders(std_srvs::Empty::Request& , std_srvs::Empty::Response& )
72 Ogre::ResourceManager::ResourceMapIterator it =
73 Ogre::MaterialManager::getSingleton().getResourceIterator();
74 while (it.hasMoreElements())
76 Ogre::ResourcePtr resource = it.getNext();
80 ROS_INFO(
"Reloading high-level gpu shaders.");
82 Ogre::ResourceManager::ResourceMapIterator it =
83 Ogre::HighLevelGpuProgramManager::getSingleton().getResourceIterator();
84 while (it.hasMoreElements())
86 Ogre::ResourcePtr resource = it.getNext();
92 Ogre::ResourceManager::ResourceMapIterator it =
93 Ogre::GpuProgramManager::getSingleton().getResourceIterator();
94 while (it.hasMoreElements())
96 Ogre::ResourcePtr resource = it.getNext();
115 ROS_INFO(
"compiled against Qt version " QT_VERSION_STR);
116 ROS_INFO(
"compiled against OGRE version %d.%d.%d%s (%s)", OGRE_VERSION_MAJOR, OGRE_VERSION_MINOR,
117 OGRE_VERSION_PATCH, OGRE_VERSION_SUFFIX, OGRE_VERSION_NAME);
120 ProcessSerialNumber PSN;
121 GetCurrentProcess(&PSN);
122 TransformProcessType(&PSN, kProcessTransformToForegroundApplication);
123 SetFrontProcess(&PSN);
134 std::string display_config, fixed_frame, splash_path, help_path;
135 int force_gl_version = 0;
137 po::options_description options;
138 options.add_options()
139 (
"help,h",
"Produce this help message")
140 (
"splash-screen,s", po::value<std::string>(&splash_path),
141 "A custom splash-screen image to display")
142 (
"help-file", po::value<std::string>(&help_path),
143 "A custom html file to show as the help screen")
144 (
"display-config,d", po::value<std::string>(&display_config),
145 "A display config file (.rviz) to load")
146 (
"fullscreen",
"Trigger fullscreen display")
147 (
"fixed-frame,f", po::value<std::string>(&fixed_frame),
"Set the fixed frame")
148 (
"ogre-log,l",
"Enable the Ogre.log file (output in cwd) and console output.")
149 (
"in-mc-wrapper",
"Signal that this is running inside a master-chooser wrapper")
150 (
"opengl", po::value<int>(&force_gl_version),
151 "Force OpenGL version (use '--opengl 210' for OpenGL 2.1 compatibility mode)")
152 (
"disable-anti-aliasing",
"Prevent rviz from trying to use anti-aliasing when rendering.")
153 (
"no-stereo",
"Disable the use of stereo rendering.")(
"verbose,v",
"Enable debug visualizations")
154 (
"log-level-debug",
"Sets the ROS logger level to debug.");
156 po::variables_map vm;
159 po::store(po::parse_command_line(argc, argv, options), vm);
162 if (vm.count(
"help"))
164 std::cout <<
"rviz command line options:\n" << options;
168 if (vm.count(
"log-level-debug"))
176 catch (std::exception& e)
178 ROS_ERROR(
"Error parsing command line: %s", e.what());
185 if (dialog.exec() != QDialog::Accepted)
193 if (vm.count(
"ogre-log"))
198 if (vm.count(
"disable-anti-aliasing"))
201 if (vm.count(
"no-stereo"))
205 if (!help_path.empty())
210 if (vm.count(
"splash-screen"))
215 if (!fixed_frame.empty())
220 if (vm.count(
"fullscreen"))
236 catch (std::exception& e)
238 ROS_ERROR(
"Caught exception while loading: %s", e.what());
265 frame_->setWindowModified(
false);
267 QApplication::closeAllWindows();
273 fs::path path = req.path.data;
274 if (fs::is_regular_file(path))
282 rviz::SendFilePathResponse& res)
284 fs::path path = req.path.data;
285 if (fs::is_regular_file(path))
287 bool discard_changes =
true;