-1

How in the OpenRTI to make the rti send callbacks? For example, reserve a name with the reserveObjectInstanceName

_rtiAmbassador->reserveObjectInstanceName(name);

Errors:

terminate called after throwing an instance of 'rti1516e::ObjectInstanceNameNotReserved'

Dino
  • 7,779
  • 12
  • 46
  • 85
smilemax
  • 3
  • 1
  • 1
    Please read the [info of the hla tag](https://stackoverflow.com/tags/hla/info) and decide if this tag matches [your HLA](https://en.wikipedia.org/wiki/High_Level_Architecture) – rkhb Sep 25 '19 at 14:51

2 Answers2

0

After each call to RTI, to get a callback, you need to call evokeCallback()

smilemax
  • 3
  • 1
0

If you are using the HLA 1516e API (as opposed to HLA 1516 or HLA 1.3) when you make a call to connect you can specify a CallbackModel which is either SYNCHRONOUS or ASYNCHRONOUS. In a synchronous callback model, the federate has to call the method evokeCallback in order to trigger the RTI to send whatever is queued up. In asynchronous, the callbacks are sent automatically.

What you should do in this instance is have something like this:

_rtiAmbassador->reserveObjectInstanceName(std::wstring(L"MyObject"));
_rtiAmbassador->evokeMultipleCallbacks();
MyFederateAmbassador::objectInstanceNameReservationSucceeded(std::wstring const & name){
    _rtiAmbassador->registerObjectInstance(handle, std::wstring(L"MyObject"));
}
Yserbius
  • 1,375
  • 12
  • 18