Sensor Plugin example on Anvel 2.0

  • I am trying to run the sample sensor plugin code supplied with Anvel 2.0. I compiled it using Visual Studio Express 2015 and modified the DefaultSensorDefinitions.xml file so that it would show up in the list of sensors. However, if I create a vehicle (HMMWV) and attach the sensor to it, the simulation crashes when I open the Properties tab. A window pops up with the message "ANVEL has encountered and unhanded exception...." If I click OK, the dialog goes away, but pops right back up, and I have to kill ANVEL using the TaskManager.

  • Good morning,
    We have been able to reproduce this issue and are looking into it.

  • A co-worker found the problem. It looks like
    is throwing and exception in
    ObjectPropertySet SampleSensorFactory::GetProperties( ID objID )
    The exception message was "Incorrect thread used when accessing ThreadSpecific Singleton in" So presumably GetProperties() is being called in the wrong thread occasionally. If you catch the exception, the code runs properly and displays its registered properties in the Properties tab.

  • Thank you for the feedback. We will integrate a correction to this in an upcoming release.

  • We'd also like to point out that the code can be fixed in your local build by updating line 163 of the SampleSensor.cpp file to use the following:

    auto pBaseSensor = SensorManager::GetConstSingleton().GetSensor( objID );

    The GetConstSingleton() method allows calling thread safe operations across thread boundaries, while the standard GetSingleton() method can only be called on the thread that Singleton was created on.

    Thanks for finding this! It has been integrated into the Samples for the next release.

Log in to reply

Looks like your connection to ANVEL Forum was lost, please wait while we try to reconnect.