The VisualizationManager class is the central manager class of rviz, holding all the Displays, Tools, ViewControllers, and other managers. More...
#include <visualization_manager.h>
Signals | |
void | configChanged () |
Emitted whenever the display configuration changes. More... | |
void | escapePressed () |
Emitted when ESC key is pressed. More... | |
void | preUpdate () |
Emitted before updating all Displays. More... | |
void | statusUpdate (const QString &message) |
Emitted during file-loading and initialization to indicate progress. More... | |
Public Member Functions | |
void | addDisplay (Display *display, bool enabled) |
Add a display to be managed by this panel. More... | |
Display * | createDisplay (const QString &class_lookup_name, const QString &name, bool enabled) |
Create and add a display to this panel, by class lookup name. More... | |
void | emitStatusUpdate (const QString &message) |
Emits statusUpdate() signal with the given message. More... | |
uint32_t | getDefaultVisibilityBit () const override |
DisplayFactory * | getDisplayFactory () const override |
Return a factory for creating Display subclasses based on a class id string. More... | |
PropertyTreeModel * | getDisplayTreeModel () const |
QString | getFixedFrame () const override |
Return the fixed frame name. More... | |
uint64_t | getFrameCount () const override |
Return the current value of the frame count. More... | |
FrameManager * | getFrameManager () const override |
Return the FrameManager instance. More... | |
virtual QString | getHelpPath () const |
RenderPanel * | getRenderPanel () const |
Return the main RenderPanel. More... | |
DisplayGroup * | getRootDisplayGroup () const override |
double | getROSTime () |
Return the ROS time, in seconds. More... | |
double | getROSTimeElapsed () |
Return the ROS time in seconds since the last reset. More... | |
Ogre::SceneManager * | getSceneManager () const override |
Returns the Ogre::SceneManager used for the main RenderPanel. More... | |
SelectionManager * | getSelectionManager () const override |
Return a pointer to the SelectionManager. More... | |
std::shared_ptr< tf2_ros::Buffer > | getTF2BufferPtr () const |
Convenience function: returns getFrameManager()->getTF2BufferPtr(). More... | |
ros::CallbackQueueInterface * | getThreadedQueue () override |
Return a CallbackQueue using a different thread than the main GUI one. More... | |
ToolManager * | getToolManager () const override |
Return a pointer to the ToolManager. More... | |
ros::CallbackQueueInterface * | getUpdateQueue () override |
Return the CallbackQueue using the main GUI thread. More... | |
ViewManager * | getViewManager () const override |
Return a pointer to the ViewManager. More... | |
double | getWallClock () |
Return the wall clock time, in seconds since 1970. More... | |
double | getWallClockElapsed () |
Return the wall clock time in seconds since the last reset. More... | |
WindowManagerInterface * | getWindowManager () const override |
Return the window manager, if any. More... | |
void | handleChar (QKeyEvent *event, RenderPanel *panel) override |
Handle a single key event for a given RenderPanel. More... | |
void | handleMouseEvent (const ViewportMouseEvent &event) override |
Handle a mouse event. More... | |
void | initialize () |
Do initialization that wasn't done in constructor. Initializes tool manager, view manager, selection manager. More... | |
void | load (const Config &config) |
Load the properties of each Display and most editable rviz data. More... | |
void | lockRender () |
Lock a mutex to delay calls to Ogre::Root::renderOneFrame(). More... | |
void | notifyConfigChanged () |
Notify this VisualizationManager that something about its display configuration has changed. More... | |
void | queueRender () override |
Queues a render. Multiple calls before a render happens will only cause a single render. More... | |
void | removeAllDisplays () |
Remove and delete all displays. More... | |
void | resetTime () |
Resets the wall and ROS elapsed time to zero and calls resetDisplays(). More... | |
void | save (Config config) const |
Save the properties of each Display and most editable rviz data. More... | |
void | setFixedFrame (const QString &frame) |
Set the coordinate frame we should be transforming all fixed data into. More... | |
virtual void | setHelpPath (const QString &help_path) |
void | setStatus (const QString &message) override |
void | startUpdate () |
Start timers. Creates and starts the update and idle timers, both set to 30Hz (33ms). More... | |
void | stopUpdate () |
void | unlockRender () |
Unlock a mutex, allowing calls to Ogre::Root::renderOneFrame(). More... | |
BitAllocator * | visibilityBits () override |
VisualizationManager (RenderPanel *render_panel, WindowManagerInterface *wm=nullptr, std::shared_ptr< tf2_ros::Buffer > tf_buffer=std::shared_ptr< tf2_ros::Buffer >(), std::shared_ptr< tf2_ros::TransformListener > tf_listener=std::shared_ptr< tf2_ros::TransformListener >()) | |
Constructor Creates managers and sets up global properties. More... | |
~VisualizationManager () override | |
Destructor Stops update timers and destroys all displays, tools, and managers. More... | |
Public Member Functions inherited from rviz::DisplayContext | |
std::shared_ptr< tf2_ros::Buffer > | getTF2BufferPtr () const |
Convenience function: returns getFrameManager()->getTF2BufferPtr(). More... | |
Protected Slots | |
void | onToolChanged (Tool *) |
void | onUpdate () |
Call update() on all managed objects. More... | |
Protected Member Functions | |
void | createColorMaterials () |
void | threadedQueueThreadFunc () |
void | updateFrames () |
void | updateTime () |
Private Slots | |
void | updateBackgroundColor () |
void | updateDefaultLightVisible () |
void | updateFixedFrame () |
void | updateFps () |
Private Attributes | |
uint32_t | default_visibility_bit_ |
Ogre::Light * | directional_light_ |
DisplayFactory * | display_factory_ |
QString | help_path_ |
VisualizationManagerPrivate * | private_ |
BitAllocator | visibility_bit_allocator_ |
Additional Inherited Members | |
Public Slots inherited from rviz::DisplayContext |
The VisualizationManager class is the central manager class of rviz, holding all the Displays, Tools, ViewControllers, and other managers.
It keeps the current view controller for the main render window. It has a timer which calls update() on all the displays. It creates and holds pointers to the other manager objects: SelectionManager, FrameManager, the PropertyManager s, and Ogre::SceneManager.
The "protected" members should probably all be "private", as VisualizationManager is not intended to be subclassed.
Definition at line 96 of file visualization_manager.h.
|
explicit |
Constructor Creates managers and sets up global properties.
render_panel | a pointer to the main render panel widget of the app. |
wm | a pointer to the window manager (which is really just a VisualizationFrame, the top-level container widget of rviz). |
tf_buffer | an (optional) pointer to the tf2_ros::Buffer to be used by the FrameManager |
tf_listener | an (optional) pointer to the tf2_ros::TransformListener to be used This listener's tf buffer needs to be the same as the passed tf_buffer! Both tf_buffer and tf_listener are automatically created if not provided. |
Definition at line 119 of file visualization_manager.cpp.
|
override |
Destructor Stops update timers and destroys all displays, tools, and managers.
Definition at line 216 of file visualization_manager.cpp.
void rviz::VisualizationManager::addDisplay | ( | Display * | display, |
bool | enabled | ||
) |
Add a display to be managed by this panel.
display | The display to be added |
Definition at line 433 of file visualization_manager.cpp.
|
signal |
Emitted whenever the display configuration changes.
|
protected |
Definition at line 305 of file visualization_manager.cpp.
Display * rviz::VisualizationManager::createDisplay | ( | const QString & | class_lookup_name, |
const QString & | name, | ||
bool | enabled | ||
) |
Create and add a display to this panel, by class lookup name.
class_lookup_name | "lookup name" of the Display subclass, for pluginlib. Should be of the form "packagename/displaynameofclass", like "rviz/Image". |
name | The name of this display instance shown on the GUI, like "Left arm camera". |
enabled | Whether to start enabled |
Definition at line 474 of file visualization_manager.cpp.
void rviz::VisualizationManager::emitStatusUpdate | ( | const QString & | message | ) |
Emits statusUpdate() signal with the given message.
Definition at line 445 of file visualization_manager.cpp.
|
signal |
Emitted when ESC key is pressed.
|
inlineoverridevirtual |
Implements rviz::DisplayContext.
Definition at line 348 of file visualization_manager.h.
|
inlineoverridevirtual |
Return a factory for creating Display subclasses based on a class id string.
Implements rviz::DisplayContext.
Definition at line 330 of file visualization_manager.h.
|
inline |
Definition at line 335 of file visualization_manager.h.
|
overridevirtual |
Return the fixed frame name.
Implements rviz::DisplayContext.
Definition at line 597 of file visualization_manager.cpp.
|
inlineoverridevirtual |
Return the current value of the frame count.
The frame count is just a number which increments each time a frame is rendered. This lets clients check if a new frame has been rendered since the last time they did something.
Implements rviz::DisplayContext.
Definition at line 320 of file visualization_manager.h.
|
inlineoverridevirtual |
Return the FrameManager instance.
Implements rviz::DisplayContext.
Definition at line 310 of file visualization_manager.h.
|
inlinevirtual |
Definition at line 364 of file visualization_manager.h.
|
inline |
Return the main RenderPanel.
Definition at line 207 of file visualization_manager.h.
|
inlineoverridevirtual |
Implements rviz::DisplayContext.
Definition at line 343 of file visualization_manager.h.
double rviz::VisualizationManager::getROSTime | ( | ) |
Return the ROS time, in seconds.
Definition at line 489 of file visualization_manager.cpp.
double rviz::VisualizationManager::getROSTimeElapsed | ( | ) |
Return the ROS time in seconds since the last reset.
Definition at line 499 of file visualization_manager.cpp.
|
inlineoverridevirtual |
Returns the Ogre::SceneManager used for the main RenderPanel.
Implements rviz::DisplayContext.
Definition at line 199 of file visualization_manager.h.
|
inlineoverridevirtual |
Return a pointer to the SelectionManager.
Implements rviz::DisplayContext.
Definition at line 258 of file visualization_manager.h.
std::shared_ptr< tf2_ros::Buffer > rviz::VisualizationManager::getTF2BufferPtr | ( | ) | const |
Convenience function: returns getFrameManager()->getTF2BufferPtr().
Definition at line 418 of file visualization_manager.cpp.
|
overridevirtual |
Return a CallbackQueue using a different thread than the main GUI one.
Implements rviz::DisplayContext.
Definition at line 258 of file visualization_manager.cpp.
|
inlineoverridevirtual |
Return a pointer to the ToolManager.
Implements rviz::DisplayContext.
Definition at line 264 of file visualization_manager.h.
|
overridevirtual |
Return the CallbackQueue using the main GUI thread.
Implements rviz::DisplayContext.
Definition at line 273 of file visualization_manager.cpp.
|
inlineoverridevirtual |
Return a pointer to the ViewManager.
Implements rviz::DisplayContext.
Definition at line 270 of file visualization_manager.h.
double rviz::VisualizationManager::getWallClock | ( | ) |
Return the wall clock time, in seconds since 1970.
Definition at line 484 of file visualization_manager.cpp.
double rviz::VisualizationManager::getWallClockElapsed | ( | ) |
Return the wall clock time in seconds since the last reset.
Definition at line 494 of file visualization_manager.cpp.
|
inlineoverridevirtual |
Return the window manager, if any.
Implements rviz::DisplayContext.
Definition at line 294 of file visualization_manager.h.
|
overridevirtual |
Handle a single key event for a given RenderPanel.
If the key is Escape, switches to the default Tool (via getDefaultTool()). All other key events are passed to the current Tool (via getCurrentTool()).
Implements rviz::DisplayContext.
Definition at line 561 of file visualization_manager.cpp.
|
overridevirtual |
Handle a mouse event.
This just copies the given event into an event queue. The events in the queue are processed by onUpdate() which is called from the main thread by a timer every 33ms.
Implements rviz::DisplayContext.
Definition at line 524 of file visualization_manager.cpp.
void rviz::VisualizationManager::initialize | ( | ) |
Do initialization that wasn't done in constructor. Initializes tool manager, view manager, selection manager.
Definition at line 246 of file visualization_manager.cpp.
void rviz::VisualizationManager::load | ( | const Config & | config | ) |
Load the properties of each Display and most editable rviz data.
This is what is called when loading a "*.rviz" file.
config | The Config object to read from. Expected to be a Config::Map type. |
Definition at line 450 of file visualization_manager.cpp.
void rviz::VisualizationManager::lockRender | ( | ) |
Lock a mutex to delay calls to Ogre::Root::renderOneFrame().
Definition at line 263 of file visualization_manager.cpp.
void rviz::VisualizationManager::notifyConfigChanged | ( | ) |
Notify this VisualizationManager that something about its display configuration has changed.
Definition at line 580 of file visualization_manager.cpp.
|
protectedslot |
Definition at line 585 of file visualization_manager.cpp.
|
protectedslot |
Call update() on all managed objects.
This is the central place where update() is called on most rviz objects. Display objects, the FrameManager, the current ViewController, the SelectionManager, PropertyManager. Also calls ros::spinOnce(), so any callbacks on the global CallbackQueue get called from here as well.
It is called at 30Hz from the update timer.
Definition at line 322 of file visualization_manager.cpp.
|
signal |
Emitted before updating all Displays.
|
overridevirtual |
Queues a render. Multiple calls before a render happens will only cause a single render.
Implements rviz::DisplayContext.
Definition at line 317 of file visualization_manager.cpp.
void rviz::VisualizationManager::removeAllDisplays | ( | ) |
Remove and delete all displays.
Definition at line 440 of file visualization_manager.cpp.
void rviz::VisualizationManager::resetTime | ( | ) |
Resets the wall and ROS elapsed time to zero and calls resetDisplays().
Definition at line 423 of file visualization_manager.cpp.
void rviz::VisualizationManager::save | ( | Config | config | ) | const |
Save the properties of each Display and most editable rviz data.
This is what is called when saving a "*.vcg" file.
config | The object to write to. |
Definition at line 466 of file visualization_manager.cpp.
void rviz::VisualizationManager::setFixedFrame | ( | const QString & | frame | ) |
Set the coordinate frame we should be transforming all fixed data into.
frame | The name of the frame – must match the frame name broadcast to libTF |
Definition at line 602 of file visualization_manager.cpp.
|
inlinevirtual |
Definition at line 360 of file visualization_manager.h.
|
overridevirtual |
Set the message displayed in the status bar
Implements rviz::DisplayContext.
Definition at line 607 of file visualization_manager.cpp.
void rviz::VisualizationManager::startUpdate | ( | ) |
Start timers. Creates and starts the update and idle timers, both set to 30Hz (33ms).
Definition at line 278 of file visualization_manager.cpp.
|
signal |
Emitted during file-loading and initialization to indicate progress.
void rviz::VisualizationManager::stopUpdate | ( | ) |
Definition at line 284 of file visualization_manager.cpp.
|
protected |
Definition at line 568 of file visualization_manager.cpp.
void rviz::VisualizationManager::unlockRender | ( | ) |
Unlock a mutex, allowing calls to Ogre::Root::renderOneFrame().
Definition at line 268 of file visualization_manager.cpp.
|
privateslot |
Definition at line 504 of file visualization_manager.cpp.
|
privateslot |
Definition at line 519 of file visualization_manager.cpp.
|
privateslot |
Definition at line 589 of file visualization_manager.cpp.
|
privateslot |
Definition at line 511 of file visualization_manager.cpp.
|
protected |
Definition at line 403 of file visualization_manager.cpp.
|
protected |
Definition at line 386 of file visualization_manager.cpp.
|
inlineoverridevirtual |
Implements rviz::DisplayContext.
Definition at line 353 of file visualization_manager.h.
|
protected |
Definition at line 433 of file visualization_manager.h.
|
protected |
Definition at line 424 of file visualization_manager.h.
|
private |
Definition at line 458 of file visualization_manager.h.
|
private |
Definition at line 461 of file visualization_manager.h.
|
private |
Definition at line 456 of file visualization_manager.h.
|
protected |
Definition at line 414 of file visualization_manager.h.
|
protected |
Frame to transform fixed data to.
Definition at line 421 of file visualization_manager.h.
|
protected |
Definition at line 423 of file visualization_manager.h.
|
protected |
Definition at line 441 of file visualization_manager.h.
|
protected |
Definition at line 445 of file visualization_manager.h.
|
protected |
Definition at line 436 of file visualization_manager.h.
|
protected |
Definition at line 420 of file visualization_manager.h.
|
protected |
Definition at line 422 of file visualization_manager.h.
|
private |
Definition at line 460 of file visualization_manager.h.
|
protected |
Stores how long it's been since the last update.
Definition at line 409 of file visualization_manager.h.
|
protected |
Definition at line 410 of file visualization_manager.h.
|
protected |
Definition at line 447 of file visualization_manager.h.
|
protected |
Ogre Root.
Definition at line 405 of file visualization_manager.h.
|
private |
Definition at line 457 of file visualization_manager.h.
|
protected |
Definition at line 426 of file visualization_manager.h.
|
protected |
Definition at line 440 of file visualization_manager.h.
|
protected |
Definition at line 415 of file visualization_manager.h.
|
protected |
Definition at line 429 of file visualization_manager.h.
|
protected |
Definition at line 431 of file visualization_manager.h.
|
protected |
Ogre scene manager associated with this panel.
Definition at line 406 of file visualization_manager.h.
|
protected |
Definition at line 438 of file visualization_manager.h.
|
protected |
Definition at line 412 of file visualization_manager.h.
|
protected |
Definition at line 435 of file visualization_manager.h.
|
protected |
Definition at line 417 of file visualization_manager.h.
|
protected |
Display::update is called on each display whenever this timer fires.
Definition at line 408 of file visualization_manager.h.
|
protected |
Definition at line 418 of file visualization_manager.h.
|
private |
Definition at line 459 of file visualization_manager.h.
|
protected |
Definition at line 428 of file visualization_manager.h.
|
protected |
Definition at line 430 of file visualization_manager.h.
|
protected |
Definition at line 443 of file visualization_manager.h.