wiki:visual_dataIO

Version 1 (modified by Torben Dannhauer, 11 years ago) (diff)

--

Module for Data Input/Output? : dataIO

Introduction

dataIO is the module to unitize data input or output of a render node, independend if the node is connected via cluster or externalLink. It provides a unified interface to query or set data values and set or execute executer tasks.

Behind this interface, dataIO syncronise at appropriate positions the relevant data over the cluster module to all connected render nodes, so the osgVisual cluster renders consistend views. The connection to the simulator is hold by the module extLink, which gets all values, queries and executer from simulation host and returns the queried return values.

Every rendering node in the visual system does not need to care if it's role is cluster master or cluster slave, it hast just to use the unified dataIO interface. Picture 1 clarifies the structore of the dataIO module.

SLOT concept

The main conecpt for data exchange is the slot concept. Therein dataIO holds a array of slots, each containing the following values:

  • variableName (string)
  • direction (enum: TO_OBJ, FROM_OBJ)
  • variableType (enum: DOUBLE, STRING)
  • value (double)
  • sValue (string)

Each slot in dataIO's slot list can be accessed by all application modules (modules, objects etc). A slot may updated from any module - this can be a return value of an object as well as the cluster or extLink module.

Data flow

To explain the dataflow, lets follow an virtual variable from simulation host to osgVisual, to a specific visual_object, and return. PLease read prior the concept of visual_object and the object_updater?.

  • At first lets assume the virtual variable is:
    variableName = "testObject_prop_rpm"
    direction = TO_OBJ
    variableType = DOUBLE
    value = 500
    
  • testVar should be used by a visual_object named "testObject" to update the object's propeller rotations per minute.
  • extLink recieves the latitude for the object (TO_OBJ) "testObject" and stores the value in the slot array. If the slot exists already, the value is updated. Otherweise the slot is added and then updated with the current value.
  • cluster reads all values who should transfered to clusters (TO_OBJ) and transfers it over network to all slave nodes' slot array.
  • independent of the cluster role of any rendering node (SLAVE or MASTER), now the current value is available on nodes' slot array and can be accessed in an unified way.
  • the object_updater can retrieve the value via getSlotDataAsDouble() or getSlotDataAsString() and store it as propeller rpm value.
  • Any return value like Height above Terrain (HAT) queries are written as FROM_OBJ variable to the slot array. This happens only at the master node.
  • extLink sends all FROM_OBJ slot values to the simulation host.

Accessing SLOTs

Slots are accessible with several approaches:

  • Via Pointer
    • void* getSlotPointer( std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_, osgVisual::dataIO_slot::DOUBLE );
  • Via References
    • std::string& getSlotRefAsString( std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_);
    • double& getSlotRefAsDouble( std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_);
  • Via get/set methods
    • double getSlotDataAsDouble(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_ );
    • std::string getSlotDataAsString(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_ );
    • void setSlotData(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_, std::string sValue_ );
    • void setSlotData(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_, double value_ );

Executer

Cluster