Skip to content

Commit

Permalink
Merge pull request #807 from ZdenekM/indigo-devel
Browse files Browse the repository at this point in the history
Added method to set TransformListener shared_ptr.
  • Loading branch information
wjwwood committed Sep 2, 2014
2 parents 3bf631d + b9364cb commit 38d6d14
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/rviz/frame_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
namespace rviz
{

FrameManager::FrameManager()
FrameManager::FrameManager(boost::shared_ptr<tf::TransformListener> tf)
{
tf_.reset(new tf::TransformListener(ros::NodeHandle(), ros::Duration(10*60), true));
if (!tf) tf_.reset(new tf::TransformListener(ros::NodeHandle(), ros::Duration(10*60), true));
else tf_ = tf;

setSyncMode( SyncOff );
setPause(false);
}
Expand Down
5 changes: 4 additions & 1 deletion src/rviz/frame_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ Q_OBJECT
SyncApprox
};

FrameManager();
/** @brief Constructor
* @param tf a pointer to tf::TransformListener (should not be used anywhere else because of thread safety)
*/
FrameManager(boost::shared_ptr<tf::TransformListener> tf = boost::shared_ptr<tf::TransformListener>());

/** @brief Destructor.
*
Expand Down
4 changes: 2 additions & 2 deletions src/rviz/visualization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class VisualizationManagerPrivate
boost::mutex render_mutex_;
};

VisualizationManager::VisualizationManager( RenderPanel* render_panel, WindowManagerInterface* wm )
VisualizationManager::VisualizationManager( RenderPanel* render_panel, WindowManagerInterface* wm, boost::shared_ptr<tf::TransformListener> tf )
: ogre_root_( Ogre::Root::getSingletonPtr() )
, update_timer_(0)
, shutting_down_(false)
Expand All @@ -127,7 +127,7 @@ VisualizationManager::VisualizationManager( RenderPanel* render_panel, WindowMan
, private_( new VisualizationManagerPrivate )
, default_visibility_bit_( visibility_bit_allocator_.allocBit() )
{
frame_manager_ = new FrameManager();
frame_manager_ = new FrameManager(tf);

render_panel->setAutoRender(false);

Expand Down
3 changes: 2 additions & 1 deletion src/rviz/visualization_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ Q_OBJECT
* @param render_panel a pointer to the main render panel widget of the app.
* @param wm a pointer to the window manager (which is really just a
* VisualizationFrame, the top-level container widget of rviz).
* @param tf a pointer to tf::TransformListener which will be internally used by FrameManager.
*/
VisualizationManager( RenderPanel* render_panel, WindowManagerInterface* wm = 0 );
VisualizationManager( RenderPanel* render_panel, WindowManagerInterface* wm = 0, boost::shared_ptr<tf::TransformListener> tf = boost::shared_ptr<tf::TransformListener>() );

/**
* \brief Destructor
Expand Down

0 comments on commit 38d6d14

Please sign in to comment.