Code: Select all
[FATAL] CSpace::RemoveEntity() : Entity "box1.leds_0.led_0" has not been found in the indexes.
Code: Select all
[FATAL] CSpace::RemoveEntity() : Entity "box1.leds_0.led_0" has not been found in the indexes.
Code: Select all
CLEDMedium& cLEDMedium = GetSimulator().GetMedium<CLEDMedium>("leds");
CBoxEntity* pcBox = new CBoxEntity("box1",
CVector3(randomX, randomY, 0.0),
CQuaternion(),
true,
CVector3(1.0, 1.0, 0.5),
0.5);
pcBox->EnableLEDs(cLEDMedium);
pcBox->AddLED(CVector3(0.0, 0.0, 0.2),
CColor::RED);
AddEntity(*pcBox);
cLEDMedium.AddEntity(pcBox->GetLEDEquippedEntity().GetLED(0));
Code: Select all
cLEDMedium.RemoveEntity(pcBox->GetLEDEquippedEntity().GetLED(0));
RemoveEntity(*pcBox);
Do not explicitly remove the led from the medium. Once you add an LED to a box, ARGoS takes care of cleaning up. The segmentation fault you get should be a double-free issue due to the fact that ARGoS tries to delete an object that you have already manually deleted.What is the correct way to remove an entity which is added at runtime?
Removing an existing box:Code: Select all
cLEDMedium.RemoveEntity(pcBox->GetLEDEquippedEntity().GetLED(0)); RemoveEntity(*pcBox);
Box colors are just for display, and can't be changed. They're not visible by the camera or anything.How can I set a color for a box? Other than using a LED.
I know. I wanted it just for illustration purposes.Box colors are just for display, and can't be changed. They're not visible by the camera or anything.How can I set a color for a box? Other than using a LED.
I removed that line from my code, but still getting the same error.Do not explicitly remove the led from the medium. Once you add an LED to a box, ARGoS takes care of cleaning up. The segmentation fault you get should be a double-free issue due to the fact that ARGoS tries to delete an object that you have already manually deleted.What is the correct way to remove an entity which is added at runtime?
Removing an existing box:Code: Select all
cLEDMedium.RemoveEntity(pcBox->GetLEDEquippedEntity().GetLED(0)); RemoveEntity(*pcBox);