The new visualisation of OpenMASK

Presentation

The new visualisation of OpenMASK has the aim of improving the previous visualisation. In the new visualisation, simulated objects are dissociated of the visualised objects. So you can easily have different visualisations of the same objects. For example, one in filar mode, one in textured mode in two different views, or you can change the visualisation of an object during the simulation. No more need of the multi-inheritance of PsvPartner and PsSimulatedObject. The only link between simulated objects and visualisation objects are the outputs generated or the events sent by the first and read or received by the second.

Structure

The visual objects and their animators

The OMK::Vis::OgreVis class is the root of the visualization (with Ogre). Each one creates a visualisation (windows,...) It manages the visualised objects, each visual object can include some animators to update itself according to an input or a message from a simulated object. To make a parallel with the previous visualisation, visual objects are the new partners, the animators are the new input handlers. The main difference is that many visual objects can be associated to an input (or an event), so each simulated object can be associated to many visual objects, and no more only one partner.

Each visual object or animator is dynamically created through events. There are two ways for creation, the first way is by sending the events. The second one is by describing the visual objets and animators in the parameters of the configuration file. When the file is read, the corresponding events are sent to create the new visual objects or animator.

How animators find the values

For each animator created, a plug is associated, this one listen a output or an event. For listening an output, an input is created in the object in charge of visualisation and it is connected to the output. For listening an event the event id is stored in a list and used by processEvent to dispatch the event toward the appropriate animator plug. There are two ways to retrieve value from a simulated object, and a third one has no associated value. The animator uses one of these three ways to update the visual object which it is associated to. According to the previous case, an animator plug is created and associated to the animator : In the two first cases the animator doesn't know if it is associated to a output or a valued event. In both cases the plug gives to it the value.

How to create Visual Objects

The visual objects are dynamically created through events sent to the simulated object in charge of the visualisation. This one will create the visual object according to the parameters. The parameters are stored in a OMK::Vis::AddAVisualObject and can be sent through a valued event to a visualisation, they are the following:

How to create Animators

Like visual objects, the animators are dynamically created through events sent to the simulated object in charge of the visualisation. This one will create the visual object according to the parameters. The parameters are stored in a OMK::Vis::AddAVisualObject and can be sent through a valued event to a visualisation, they are the following: To access to the value which is needed to update the associated visual object, the animator is created with a plug. There are two kinds of plug, the plug can listen a valued event or can get the value from an output of a simulated objects.

The parameters for the plugs are the followings:

or if the previous parameter is not found The first case is only for valued animators, the animators without associated value can only use a simple event.

Example

The following example shows a configuration file.
The animator2 is commented because there is no output to connected with the input of the animator plug and in this situation the simulation cannot run.
#OpenMASK3

root 
{
  Class Controller
  Sons 
  {
    visuOgre // The visualisation name
    {
      Class OgreVis // The visualisation class
      Scheduling
      {
        Frequency 25
      }
      UserParams
      {
        VisualObject // The list of visual objects
        {
          visualObject1 // The name of the visual object
          {
            Class OgreObject // Class id must be registered, see DECLARE_VISUAL_OBJECT_FACTORY 
            Animator  // The list of animators, implicitly the owner of these animators is the current visual object
            {
              animator1  // The name of the animator
              {
                Class TransformAnimator     // Class id must be registered, see DECLARE_ANIMATOR_FACTORY
                ListenedEvent theFirstEvent // To create a plug which listens "theFirstEvent"
              }
              //animator2 // cannot be implemented because "theOutput" doesn't exist
              //{
              //  Class TransformAnimator                   // Class id
              //  ConnectTo[theObject theOutput] // To create a plug which is connected to the output of an object
              //}
            }
          }
        }
        Animator // The list of animators
        {
          animator3
          {
            Class TransformAnimator                     // Class id
            VisualObjectName visualObject1 // This animator will be added in the "visualObject1" list of animators
            ListenedEvent theSecondEvent         // To create a plug which listens "theSecondEvent"
          }
        }
      }
    }
    myObject // An other object name
    {
      Class MyObject
      Scheduling
      {
        Frequency 25
      }
      UserParams
      {
        VisualObject // The list of visual objects
        {
          visualObject2 // The name of the visual object
          {
            Class OgreObject // Class id must be registered 
            VisName visuOgre
          }
        }
      }
    }
  }
}

logo OpenMask

Documentation generated on Mon Jun 9 11:45:59 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007