Cylinders with LEDS for Swarm sorting task: LEDs not being detected

Requests regarding how to set up experiments in ARGoS.
kylenickerson
Posts: 4
Joined: Thu Aug 02, 2018 1:25 pm

Cylinders with LEDS for Swarm sorting task: LEDs not being detected

Postby kylenickerson » Thu Aug 09, 2018 6:54 pm

I'm trying to implement a task where a swarm of footbot robots try and sort objects.

My plan is to distribute cylinders in the arena with either blue or red LEDS, and have the bots push the cylinders to one side of the room based on the color of the light.

My issue is the footbots are unable to detect the colored leds on the cylinders. I know this because I tried visualizing rays, and printing the list of color blobs returned by the camaras (both are empty). If I add a multiple robots, they are able to detect each others leds.


In my .argos file I have the media set as "leds", and the color_blob_camara set to this medium.

Code: Select all

<media> <led id="leds" /> </media>

Code: Select all

<colored_blob_omnidirectional_camera implementation="rot_z_only" medium="leds" show_rays="true" />
I distribute the cylinders in the .argos file, and then set the leds in the loop_functions (I've also tried adding the leds to the cylinders in the .argos like the example in this posthttps://www.argos-sim.info/forum/viewto ... ?f=3&t=167)

Code: Select all

void GenericLoopFunctions::SetUpCylinders() { CSpace::TMapPerType& boxes = GetSpace().GetEntitiesByType("cylinder"); CLEDMedium& cLEDMedium = GetSimulator().GetMedium<CLEDMedium>("leds"); for(CSpace::TMapPerType::iterator it = boxes.begin(); it != boxes.end(); ++it) { CCylinderEntity& box = *any_cast<CCylinderEntity*>(it->second); box.AddLED(CVector3(0.0, 0.0, 0.1), // offset CColor::BLUE); // color // Enable LED management for the box box.EnableLEDs(cLEDMedium); } }
I'm sure this SetUpCylinders() method is being called after reset, before the experiment begins.


Any thoughts on where I am going wrong?

pincy
Site Admin
Posts: 300
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Cylinders with LEDS for Swarm sorting task: LEDs not being detected

Postby pincy » Mon Aug 13, 2018 8:49 am

Can you show me the relevant controller code? What you wrote above looks correct to me. If you give me the complete files you have, I'll run them on my laptop and check for bugs in ARGoS.
I made ARGoS.

kylenickerson
Posts: 4
Joined: Thu Aug 02, 2018 1:25 pm

Re: Cylinders with LEDS for Swarm sorting task: LEDs not being detected

Postby kylenickerson » Mon Aug 13, 2018 1:53 pm

I was playing around with it again, and just got it working by adding this line to my SetUpCylinders() method

Code: Select all

cLEDMedium.AddEntity(box.GetLEDEquippedEntity().GetLED(0));
The whole thing is now

Code: Select all

void GenericLoopFunctions::SetUpCylinders() { CSpace::TMapPerType& boxes = GetSpace().GetEntitiesByType("cylinder"); CLEDMedium& cLEDMedium = GetSimulator().GetMedium<CLEDMedium>("leds"); for(CSpace::TMapPerType::iterator it = boxes.begin(); it != boxes.end(); ++it) { CCylinderEntity& box = *any_cast<CCylinderEntity*>(it->second); box.AddLED(CVector3(0.0, 0.0, 0.1), // offset CColor::BLUE); // color // Enable LED management for the box cLEDMedium.AddEntity(box.GetLEDEquippedEntity().GetLED(0)); // <- Fix box.EnableLEDs(cLEDMedium); } }


Return to “How to... ?”



cron