Page 1 of 1

Error while initializing light entity

Posted: Tue Jan 25, 2022 4:36 pm
by AntonioC
I tried to add a light source in the trajectory file but it gives me the following error

Code: Select all

[FATAL] Failed to initialize the space. [FATAL] Error while initializing light entity [FATAL] While updating the LED grid for LED "l0" [FATAL] CGrid<ENTITY>::UpdateCell() : index (0,0,0) out of bounds (-1,-1,0)

Code: Select all

<?xml version="1.0" ?> <argos-configuration> <!-- ************************* --> <!-- * General configuration * --> <!-- ************************* --> <framework> <system threads="0" /> <experiment length="0" ticks_per_second="10" random_seed="25" /> </framework> <!-- *************** --> <!-- * Controllers * --> <!-- *************** --> <controllers> <kilobot_controller id="kbc"> <actuators> <differential_steering implementation="default" /> <kilobot_led implementation="default" /> </actuators> <sensors> <kilobot_light implementation="rot_z_only" show_rays="true" /> </sensors> <params behavior="build/examples/behaviors/simple_movement" /> </kilobot_controller> </controllers> <!-- ****************** --> <!-- * Loop functions * --> <!-- ****************** --> <loop_functions library="build/examples/loop_functions/trajectory_loop_functions/libtrajectory_loop_functions" label="trajectory_loop_functions" /> <!-- *********************** --> <!-- * Arena configuration * --> <!-- *********************** --> <arena size = "0.750, 0.890, 1" center = "0, 0, 0.5"> <light id="l0" position="0,0,0.5" orientation="0,0,0" color="yellow" intensity="10.0" medium="leds"/> </arena> <!-- ******************* --> <!-- * Physics engines * --> <!-- ******************* --> <physics_engines> <dynamics2d id="dyn2d" /> </physics_engines> <!-- ********* --> <!-- * Media * --> <!-- ********* --> <media> <led id="leds" /> </media> <!-- ****************** --> <!-- * Visualization * --> <!-- ****************** --> <visualization> <!-- This shows how to add customized drawing in the world using the qt user functions. Check 'argos3 -q qt-opengl' for more help. --> <qt-opengl> <user_functions library="build/examples/loop_functions/trajectory_loop_functions/libtrajectory_loop_functions" label="trajectory_qtuser_functions" /> <camera> <placements> <placement index="0" position="0,0,8.14689" look_at="0,0,0" up="1,0,0" lens_focal_length="200"/> </placements> </camera> </qt-opengl> </visualization> </argos-configuration>

Re: Error while initializing light entity

Posted: Wed Jan 26, 2022 6:45 pm
by pincy
You found a bug, but fortunately there's a workaround. When you initialize the LED medium, try this:

Code: Select all

<led id="leds" grid_size="2, 2, 2" />
Essentially, what is happening is that the grid size to store the LED entities is calculated as 0 because your environment is smaller than 1m x 1m. It's a bug, your XML should be valid, but I have a mistake when I parse the values. I'll make a fix as soon as I can.

The values 2,2,2 are just to force the grid to be of a sensible size. You can experiment with values larger than 2 – there will be an impact on speed. The "best" value depends on the density of the robots. If you don't have lots of robots, the actual value doesn't matter all that much.