coreDS™ as a bridge

coreDS™ as a bridge

Did you know coreDS™ can be used to connect two different RTI/Standard together?

A couple of lines of code is all you need and you get your own network translator!

The following example shows how to create a bridge between two connections. In this case we are exchanging data between a HLA 1.3 federation (using a really old version of the RPR FOM) with a HLA 1516e federation using the latest RPR FOM.

std::map<std::string, std::set<std::string> > mExchangeableObjects; //define the list of exchangeable object between the two connections // Allow exchange of a local object of name "Aircraft" with property x, y, z
// As usual, object name and properties are just place holders used in the mapping window

Now we define callbacks for each connection. The callback will take care of transferring the information from one connection to the other.

mDSimManager[0].registerObjectUpdateHandler("Bridge", updateObjectFromConnection0);
mDSimManager[0].registerObjectRemovedHandler("Bridge", removeObjectFromConnection0);
mDSimManager[1].registerObjectUpdateHandler("Bridge", updateObjectFromConnection1);
mDSimManager[1].registerObjectRemovedHandler("Bridge", removeObjectFromConnection1);

Then, all we need to do is to send the received information, in this case from connection 0, to connection 1.

Since all the exchanged data use locally defined names, no matter the FOM file or DIS PDUs, there is no need to re-interpret the data. We just let the engine take care of converting everything to the correct format. A single line of code to the trick.

void updateObjectFromConnection0(const std::string &oLocalUniqueObjectIdentifier, const std::string &objectType, std::map<std::string, std::string > &oDataStruct)
 //prepare to send data on the other side
 mDSimManager[1].updateObject(oLocalUniqueObjectIdentifier, objectType , oDataStruct);

Everything else is done through the GUIs

First step create the connection:


In the first connection, define the mapping between the FOM file and the labels defined in the code.


Using the same labels do the mapping for the other connection.


Voilà! You can now run two simulators, using two different RTIs with two different FOM file with a minimal number of lines.

Happy coding!