The hla.rti module provides standard HLA services. Each service defined in Clause 4 through Clause 10 of IEEE 1516.1 correspond to one method in the Python API. This may differ from the C++ API.
First, import the module functions
import hla.rti as hla
Each federate should subclass the FederateAmbassador and implement some of the federate ambassador services.
class MyAmbassador(hla.FederateAmbassador): def discoverObjectInstance(self, object, objectClass, objectName): print "DISCOVERED", objectName
A federate ambassador object is passed to the joinFederationExecution service.
fed = MyAmbassador() rtia = hla.RTIAmbassador() rtia.joinFederationExecution("python-01", "MyFederation", fed)
Services of a RTI ambassador are provided by the RTIAmbassador class.
try: while(1): rtia.tick(1.0, 1.0) except KeyboardInterrupt: pass rtia.resignFederationExecution(hla.ResignAction.DeleteObjectsAndReleaseAttributes)