New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASSERT: Condition 'mController' does not hold in function 'getVehicleController' #330
Comments
The field The failing assertion seems to be unrelated to your modification. Possibly an invalid |
Thank you @riebl |
If you want your fake objects to become detectable by sensors, you will need to extend the |
Hi @riebl bool GlobalEnvironmentModel::addFakeVehicle(traci::VehicleController* vehicle, std::shared_ptr object, uint32_t id) { And I used a new ObjectDB FakeObjects, then I added the fake object that I created using this function like this: res = const_cast<GlobalEnvironmentModel*>(globalenv)->addFakeVehicle(&FakevehicleController, object.lock(), id); But during the simulation, I encountered this error: libsumo::TraCIException: .. Answered with error to command (164), [description: Vehicle '100' is not known.] – in module artery::GVattackService, World.node[0].middleware.GVattackService (id=100), at t=0.334426574409s, event 13. Do you know what causes this error? And thank you again. |
Currently the |
Thank you @riebl |
All objects registered at the |
Thank you, Mr. @riebl , once again. I've updated the project by incorporating the
I've also added a function in the GlobalEnvironmentModel:
And here are the types and variables used:
And these modifications were integrated into the initialization function of the service:
Despite these modifications, the issue persists. I encountered the error libsumo::TraCIException: .. Answered with error to command (206), [description: Person '100' is not known] -- in module (artery::CollectivePerceptionMockService) World.node[0].middleware.CollectivePerceptionMockService (id=100), at t=0.334426574409s, |
Hi, for better readability, you could post your code in tags or push your code to a fork on GitHub so it is easier to follow your code and also see its context. Your error is thrown by SUMO which does not know the object you are referencing in a TraCI call.
As far as I understand your code, here, you create a new controller for an SUMO object with some ID and then you try to set its speed in SUMO. If the ID is arbitrary, SUMO might throw this error. |
As @awillecke has pointed out, you are (probably) forging some |
If I change the type of the fake objects, for example, like this: |
You only need a controller, if your object relates to an object in SUMO. In that case, you can instantiate a controller with the ID of a SUMO object, e.g. vehicle ID, and request its attributes and such. In your case, I suppose, you want an object in the EnvMod that is unrelated to SUMO objects. In that case, you do not need nor want a controller. With @riebl changes, you can implement your own envmod object, by creating a new class, that inherits from The |
Hi @riebl and @awillecke , Using the function I've created in the global environment: |
If your fake objects are added successfully to the You can check if it works as you expect with a debugger or by equipping the You could also use the Envmod visualizer in Omnet++ GUI. Here, you would have to enable the drawing feature with:
|
Hi @riebl
I am using CollectivePerceptionMockService. I am trying to add a static object to the object container in the generatePacket function. To initiate this object, I tried the following:
std::weak_ptr object;
auto& vehicle = getFacilities().get_consttraci::VehicleController();
std::unique_ptr uniqueObject = std::make_unique(&vehicle, id);
And then:
uniqueObject->mCentrePoint = position;
object = std::weak_ptr(std::shared_ptr(std::move(uniqueObject)));
CollectivePerceptionMockMessage::ObjectContainer objc;
objc.object = object;
objc.objectId = id;
objc.sensorId = 0;
objc.timeOfMeasurement = omnetpp::simTime();
After that, I used this function to add the newly created object: objectContainers1.emplace_back(...)
Now, when I try to run my project, I encounter the following error:
"ASSERT: Condition 'mController' does not hold in function 'getVehicleController' at //artery/src/artery/traci/VehicleMobility.cc:36 -- in module (artery::VehiclePositionProvider) World.node[0].vanetza[0].position (id=105), during network initialization."
Can you help me understand the problem or provide any other ideas to create the static object?
Thank you.
The text was updated successfully, but these errors were encountered: