30 #include <QApplication>
31 #include <QProcessEnvironment>
34 #include <boost/program_options.hpp>
35 #include <boost/filesystem.hpp>
37 #include <OgreMaterialManager.h>
38 #include <OgreGpuProgramManager.h>
39 #include <OgreHighLevelGpuProgramManager.h>
40 #include <std_srvs/Empty.h>
43 #include <ApplicationServices/ApplicationServices.h>
63 #define CATCH_EXCEPTIONS 0
65 namespace po = boost::program_options;
66 namespace fs = boost::filesystem;
70 bool reloadShaders(std_srvs::Empty::Request& , std_srvs::Empty::Response& )
74 Ogre::ResourceManager::ResourceMapIterator it =
75 Ogre::MaterialManager::getSingleton().getResourceIterator();
76 while (it.hasMoreElements())
78 Ogre::ResourcePtr resource = it.getNext();
82 ROS_INFO(
"Reloading high-level gpu shaders.");
84 Ogre::ResourceManager::ResourceMapIterator it =
85 Ogre::HighLevelGpuProgramManager::getSingleton().getResourceIterator();
86 while (it.hasMoreElements())
88 Ogre::ResourcePtr resource = it.getNext();
94 Ogre::ResourceManager::ResourceMapIterator it =
95 Ogre::GpuProgramManager::getSingleton().getResourceIterator();
96 while (it.hasMoreElements())
98 Ogre::ResourcePtr resource = it.getNext();
117 ROS_INFO(
"compiled against Qt version " QT_VERSION_STR);
118 ROS_INFO(
"compiled against OGRE version %d.%d.%d%s (%s)", OGRE_VERSION_MAJOR, OGRE_VERSION_MINOR,
119 OGRE_VERSION_PATCH, OGRE_VERSION_SUFFIX, OGRE_VERSION_NAME);
122 ProcessSerialNumber PSN;
123 GetCurrentProcess(&PSN);
124 TransformProcessType(&PSN, kProcessTransformToForegroundApplication);
125 SetFrontProcess(&PSN);
136 std::string display_config, fixed_frame, splash_path, help_path;
137 int force_gl_version = 0;
139 po::options_description options;
140 options.add_options()
141 (
"help,h",
"Produce this help message")
142 (
"splash-screen,s", po::value<std::string>(&splash_path),
143 "A custom splash-screen image to display")
144 (
"help-file", po::value<std::string>(&help_path),
145 "A custom html file to show as the help screen")
146 (
"display-config,d", po::value<std::string>(&display_config),
147 "A display config file (.rviz) to load")
148 (
"fullscreen",
"Trigger fullscreen display")
149 (
"fixed-frame,f", po::value<std::string>(&fixed_frame),
"Set the fixed frame")
150 (
"ogre-log,l",
"Enable the Ogre.log file (output in cwd) and console output.")
151 (
"in-mc-wrapper",
"Signal that this is running inside a master-chooser wrapper")
152 (
"opengl", po::value<int>(&force_gl_version),
153 "Force OpenGL version (use '--opengl 210' for OpenGL 2.1 compatibility mode)")
154 (
"disable-anti-aliasing",
"Prevent rviz from trying to use anti-aliasing when rendering.")
155 (
"no-stereo",
"Disable the use of stereo rendering.")(
"verbose,v",
"Enable debug visualizations")
156 (
"log-level-debug",
"Sets the ROS logger level to debug.");
158 po::variables_map vm;
161 po::store(po::parse_command_line(argc, argv, options), vm);
164 if (vm.count(
"help"))
166 std::cout <<
"rviz command line options:\n" << options;
170 if (vm.count(
"log-level-debug"))
178 catch (std::exception& e)
180 ROS_ERROR(
"Error parsing command line: %s", e.what());
187 if (dialog.exec() != QDialog::Accepted)
195 if (vm.count(
"ogre-log"))
200 if (vm.count(
"disable-anti-aliasing"))
203 if (vm.count(
"no-stereo"))
207 if (!help_path.empty())
212 if (vm.count(
"splash-screen"))
217 if (!fixed_frame.empty())
222 if (vm.count(
"fullscreen"))
238 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
240 if(!env.contains(
"DISABLE_ROS1_EOL_WARNINGS"))
249 catch (std::exception& e)
251 ROS_ERROR(
"Caught exception while loading: %s", e.what());
278 frame_->setWindowModified(
false);
280 QApplication::closeAllWindows();
286 fs::path path = req.path.data;
287 if (fs::is_regular_file(path))
295 rviz::SendFilePathResponse& res)
297 fs::path path = req.path.data;
298 if (fs::is_regular_file(path))
300 bool discard_changes =
true;