Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cmdline parsing and add --fullscreen option #1413

Merged
merged 1 commit into from
Sep 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rviz/visualization_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ void VisualizationFrame::loadWindowGeometry( const Config& config )
}
}

bool b;
bool b = false;
config.mapGetBool( "Hide Left Dock", &b );
hide_left_dock_button_->setChecked( b );
hideLeftDock(b);
Expand Down
12 changes: 6 additions & 6 deletions src/rviz/visualization_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ public Q_SLOTS:
/** Set the message displayed in the status bar */
virtual void setStatus( const QString & message );

/** @brief Set full screen mode. */
void setFullScreen( bool full_screen );

/** @brief Exit full screen mode. */
void exitFullScreen();

Q_SIGNALS:
/** @brief Emitted during file-loading and initialization to indicate progress. */
void statusUpdate( const QString& message );
Expand Down Expand Up @@ -236,12 +242,6 @@ protected Q_SLOTS:
* the name of the panel. */
void onDeletePanel();

/** @brief Set full screen mode. */
void setFullScreen( bool full_screen );

/** @brief Exit full screen mode. */
void exitFullScreen();

protected Q_SLOTS:
/** @brief Set loading_ to false. */
void markLoadingDone();
Expand Down
112 changes: 25 additions & 87 deletions src/rviz/visualizer_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,28 +131,25 @@ bool VisualizerApp::init( int argc, char** argv )

startContinueChecker();

std::string display_config, fixed_frame, splash_path, help_path;
int force_gl_version = 0;

po::options_description options;
options.add_options()
("help,h", "Produce this help message")
("splash-screen,s", po::value<std::string>(), "A custom splash-screen image to display")
("help-file", po::value<std::string>(), "A custom html file to show as the help screen")
("display-config,d", po::value<std::string>(), "A display config file (.rviz) to load")
("fixed-frame,f", po::value<std::string>(), "Set the fixed frame")
("splash-screen,s", po::value<std::string>(&splash_path), "A custom splash-screen image to display")
("help-file", po::value<std::string>(&help_path), "A custom html file to show as the help screen")
("display-config,d", po::value<std::string>(&display_config), "A display config file (.rviz) to load")
("fullscreen", "Trigger fullscreen display")
("fixed-frame,f", po::value<std::string>(&fixed_frame), "Set the fixed frame")
("ogre-log,l", "Enable the Ogre.log file (output in cwd) and console output.")
("in-mc-wrapper", "Signal that this is running inside a master-chooser wrapper")
("opengl", po::value<int>(), "Force OpenGL version (use '--opengl 210' for OpenGL 2.1 compatibility mode)")
("opengl", po::value<int>(&force_gl_version), "Force OpenGL version (use '--opengl 210' for OpenGL 2.1 compatibility mode)")
("disable-anti-aliasing", "Prevent rviz from trying to use anti-aliasing when rendering.")
("no-stereo", "Disable the use of stereo rendering.")
("verbose,v", "Enable debug visualizations")
("log-level-debug", "Sets the ROS logger level to debug.");
po::variables_map vm;
std::string display_config, fixed_frame, splash_path, help_path;
bool enable_ogre_log = false;
bool in_mc_wrapper = false;
bool verbose = false;
int force_gl_version = 0;
bool disable_anti_aliasing = false;
bool disable_stereo = false;
try
{
po::store( po::parse_command_line( argc, argv, options ), vm );
Expand All @@ -164,62 +161,12 @@ bool VisualizerApp::init( int argc, char** argv )
return false;
}

if( vm.count( "in-mc-wrapper" ))
{
in_mc_wrapper = true;
}

if (vm.count("display-config"))
{
display_config = vm["display-config"].as<std::string>();
if (display_config.size() >= 4 && display_config.substr( display_config.size() - 4, 4 ) == ".vcg")
{
std::cerr << "ERROR: the config file '" << display_config << "' is a .vcg file, which is the old rviz config format." << std::endl;
std::cerr << " New config files have a .rviz extension and use YAML formatting. The format changed" << std::endl;
std::cerr << " between Fuerte and Groovy. There is not (yet) an automated conversion program." << std::endl;
return false;
}
}

if (vm.count("splash-screen"))
{
splash_path = vm["splash-screen"].as<std::string>();
}

if (vm.count("help-file"))
{
help_path = vm["help-file"].as<std::string>();
}

if (vm.count("fixed-frame"))
{
fixed_frame = vm["fixed-frame"].as<std::string>();
}

if (vm.count("ogre-log"))
{
enable_ogre_log = true;
}

if (vm.count("no-stereo"))
if (display_config.size() >= 4 && display_config.substr( display_config.size() - 4, 4 ) == ".vcg")
{
disable_stereo = true;
}

if (vm.count("opengl"))
{
//std::cout << vm["opengl"].as<std::string>() << std::endl;
force_gl_version = vm["opengl"].as<int>();
}

if (vm.count("disable-anti-aliasing"))
{
disable_anti_aliasing = true;
}

if (vm.count("verbose"))
{
verbose = true;
std::cerr << "ERROR: the config file '" << display_config << "' is a .vcg file, which is the old rviz config format." << std::endl;
std::cerr << " New config files have a .rviz extension and use YAML formatting. The format changed" << std::endl;
std::cerr << " between Fuerte and Groovy. There is not (yet) an automated conversion program." << std::endl;
Copy link
Contributor

@simonschmeisser simonschmeisser Sep 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not (yet)

sounds optimistic 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably it's time to remove this check completely. I will do this for Noetic.

return false;
}

if (vm.count("log-level-debug"))
Expand Down Expand Up @@ -247,45 +194,36 @@ bool VisualizerApp::init( int argc, char** argv )

nh_.reset( new ros::NodeHandle );

if( enable_ogre_log )
{
if (vm.count("ogre-log"))
OgreLogging::useRosLog();
}

if ( force_gl_version )
{
RenderSystem::forceGlVersion( force_gl_version );
}
RenderSystem::forceGlVersion( force_gl_version );

if (disable_anti_aliasing)
{
if (vm.count("disable-anti-aliasing"))
RenderSystem::disableAntiAliasing();
}

if ( disable_stereo )
{
if (vm.count("no-stereo"))
RenderSystem::forceNoStereo();
}

frame_ = new VisualizationFrame();
frame_->setApp( this->app_ );
if( help_path != "" )
{
frame_->setHelpPath( QString::fromStdString( help_path ));
}
frame_->setShowChooseNewMaster( in_mc_wrapper );
frame_->setShowChooseNewMaster( vm.count( "in-mc-wrapper" ) > 0 );
if( vm.count("splash-screen") )
{
frame_->setSplashPath( QString::fromStdString( splash_path ));
}
frame_->setSplashPath( QString::fromStdString( splash_path ) );

frame_->initialize( QString::fromStdString( display_config ));

if( !fixed_frame.empty() )
{
frame_->getManager()->setFixedFrame( QString::fromStdString( fixed_frame ));
}

frame_->getManager()->getSelectionManager()->setDebugMode( verbose );
frame_->getManager()->getSelectionManager()->setDebugMode( vm.count("verbose") > 0 );

if ( vm.count( "fullscreen" ) )
frame_->setFullScreen(true);
frame_->show();

ros::NodeHandle private_nh("~");
Expand Down