[Documentation] [TitleIndex] [WordIndex

  Show EOL distros: 

Package Summary

This package is basically an OpenSceneGraph (OSG) adaptation of the Interactive Markers client writen for rviz/Ogre.

  • Maintainer: Javier Perez <japerez AT uji DOT es>
  • Author: Mario Prats <marioprats AT gmail DOT com>
  • License: BSD

Package Summary

This package is basically an OpenSceneGraph (OSG) adaptation of the Interactive Markers client writen for rviz/Ogre.

  • Maintainer status: maintained
  • Maintainer: Javier Perez <japerez AT uji DOT es>
  • Author: Mario Prats <marioprats AT gmail DOT com>
  • License: BSD

Package Summary

This package is basically an OpenSceneGraph (OSG) adaptation of the Interactive Markers client writen for rviz/Ogre.

  • Maintainer status: maintained
  • Maintainer: Javier Perez <japerez AT uji DOT es>
  • Author: Mario Prats <marioprats AT gmail DOT com>
  • License: BSD

Package Summary

This package is basically an OpenSceneGraph (OSG) adaptation of the Interactive Markers client writen for rviz/Ogre.

  • Maintainer status: maintained
  • Maintainer: Javier Perez <japerez AT uji DOT es>
  • Author: Mario Prats <marioprats AT gmail DOT com>
  • License: BSD

Package Summary

This package is basically an OpenSceneGraph (OSG) adaptation of the Interactive Markers client writen for rviz/Ogre.

  • Maintainer status: maintained
  • Maintainer: Javier Perez <japerez AT uji DOT es>, Diego Centelles <centelld AT uji DOT es>
  • Author: Mario Prats <marioprats AT gmail DOT com>
  • License: BSD

Introduction

This package is basically an OpenSceneGraph (OSG) adaptation of the Interactive Markers client writen for rviz/Ogre. Most of the code has been taken from the rviz sources, and adapted to use OSG data types and facilities when possible. It allows the creation of Interactive Markers in OpenSceneGraph applications.

Setting an Interactive Markers client in OSG

Let's have a look to the osg_interactive_markers_demo.cpp example, inside the osg_interactive_markers package:

   1 #include <osgViewer/Viewer>
   2 #include <osgViewer/ViewerEventHandlers>
   3 #include <osg/Group>
   4 #include <osgGA/TrackballManipulator>
   5 #include <osgGA/GUIEventHandler>
   6 
   7 #include <osg_interactive_markers/interactive_marker_display.h>
   8 #include <osg_utils/osg_utils.h>
   9 #include <osg_utils/frame_manager.h>
  10 
  11 using namespace osg_utils;
  12 using namespace osg_interactive_markers;
  13 
  14 int main(int argc, char *argv[])
  15 {
  16 
  17    osg::Group *root=new osg::Group();
  18 
  19    osgViewer::Viewer viewer;
  20 
  21    viewer.setSceneData( root );
  22    viewer.setUpViewInWindow (0, 0, 800, 600);
  23 
  24    osgGA::TrackballManipulator* tb = new osgGA::TrackballManipulator;
  25    tb->setHomePosition( osg::Vec3f(20,20,20), osg::Vec3f(0,-15,0), osg::Vec3f(0,0,1) );
  26    viewer.setCameraManipulator( tb );
  27 
  28    viewer.addEventHandler( new osgViewer::StatsHandler );
  29    viewer.addEventHandler(new osgViewer::WindowSizeHandler);
  30 
  31    ros::init(argc, argv, "osg_interactive_markers");
  32 
  33    boost::shared_ptr<FrameManager> frame_manager = FrameManager::instance();
  34    frame_manager->setFixedFrame("/base_link");
  35    InteractiveMarkerDisplay marker_cli("osg_im","/basic_controls/update", root, *(frame_manager->getTFClient()));
  36 
  37    viewer.realize();
  38    viewer.frame();
  39     
  40     ros::WallTime last_wall_time = ros::WallTime::now();
  41     ros::Time last_ros_time = ros::Time::now();
  42     while( !viewer.done() && ros::ok())
  43     {
  44         ros::spinOnce();
  45         
  46         viewer.frame();
  47        
  48         ros::WallTime current_wall_time=ros::WallTime::now();
  49         ros::Time current_ros_time=ros::Time::now();
  50         marker_cli.update((current_wall_time-last_wall_time).toSec(), (current_ros_time-last_ros_time).toSec());
  51         last_wall_time=current_wall_time;
  52         last_ros_time=current_ros_time;
  53     }
  54     return 0;
  55 }

The example above creates an OpenSceneGraph application that listens for Interactive Markers in the basic_controls/update topic. By running the above example and the Interactive Markers: Getting Started tutorial in different terminals you should see something like the following:

$ rosrun osg_interactive_markers osg_interactive_markers_demo

$ rosrun interactive_marker_tutorials basic_controls

OSG Interactive Markers

Unlike in rviz, here you need to press the Control key for enabling interaction. For instance, if you want to interact with a marker, you have to press the Control key, and then click on the marker and drag.

Let's have a look to the code required for setting the Interactive Markers client. First you need to create a FrameManager instance and set the fixed frame where you expect the markers to be referenced to. After that, InteractiveMarkerDisplay is the main class you have to instantiate, giving as input the topic where to listen to Interactive Markers, a node in your OSG scene that will hold the geometry, and a TF client:

   1 boost::shared_ptr<FrameManager> frame_manager = FrameManager::instance();
   2 frame_manager->setFixedFrame("/base_link");
   3 InteractiveMarkerDisplay marker_cli("osg_im","/basic_controls/update", root, *(frame_manager->getTFClient()));

Then you need to call the update method at each iteration in your main loop, with the Wall and ROS ellapsed times as arguments:

   1    ...
   2    marker_cli.update((current_wall_time-last_wall_time).toSec(), (current_ros_time-last_ros_time).toSec());
   3    ...

What does not work

osg_interactive_markers does not currently offer all the potential of Interactive Markers. However, the most frequent use cases should be supported.

This is a list of the functionality still not implemented:


2024-12-07 14:58