I'm creating a simulation environment that involves a really high amount of boxes, so, to not enter all manually I created them with a python program and stored them in a .txt file, I want to include it in my arena configuration, but I don't know how, I tried creating a Lua file to read the .txt:
Code: Select all
local textFile = io.open("/home/jazmin/tuttifrutti/log/Tesis/Codigos/big_walls.txt", "r")
if textFile then
local fileContent = textFile:read("*all")
textFile:close()
-- Define a local function to include the content in your Argos arena configuration
local function includeTextContent()
-- Start your XML element here
io.write('<obstacle>')
-- Insert the content of your text file
io.write(fileContent)
-- Close your XML element here
io.write('</obstacle>')
end
-- Call the function
includeTextContent()
else
print("Error: Unable to open the text file.")
end
Code: Select all
<lua>
includeTextContent(/home/jazmin/tuttifrutti/log/Tesis/Codigos/text.lua)
</lua>
[FATAL] Failed to initialize the space.
[FATAL] Symbol "lua" not found
Saw somewhere I could use obstacles? So I tried:
Code: Select all
<obstacles>
<lua>
includeTextContent("/path/to/your_script.lua")
</lua>
</obstacles>
[FATAL] Failed to initialize the space.
[FATAL] Symbol "obstacles" not found
Please help me, what can I do to include my .txt file in the .argos connfiguration file, especifically in the <arena> configThank you in advance for the help.
Here is the full .argos code in case it helps:
Code: Select all
<?xml version="1.0" ?>
<argos-configuration>
<!-- ************* -->
<!-- * Framework * -->
<!-- ************* -->
<framework>
<experiment length="400" random_seed="3" ticks_per_second="10"></experiment>
<!--si 77 30 55 20 66 89 99 (no detecta timer5=100) 18 20 -->
<!--no 65 25 16 33-->
</framework>
<!-- ****************** -->
<!-- * Loop functions * -->
<!-- ****************** -->
<loop_functions label="tutti_tmt_loop_function" library="/home/jazmin/tuttifrutti/experiments-loop-functions/build/loop-functions/moca/libtutti_tmt_loopfunc.so">
<params build_arena="false" lenght_boxes="0.25" maximization="false" number_boxes_per_edge="3" number_edges="8" number_robots=""></params>
</loop_functions>
<!-- *************** -->
<!-- * Controllers * -->
<!-- *************** -->
<controllers>
<!-- TRANSMITTER -->
<automode_controller id="tuttifrutti" library="/home/jazmin/tuttifrutti/AutoMoDe-tuttifrutti/build/src/libautomode.so">
<actuators>
<epuck_wheels implementation="default" noise_std_dev="0.05"></epuck_wheels>
<epuck_rgb_leds implementation="default" medium="leds"></epuck_rgb_leds>
<epuck_range_and_bearing data_size="4" implementation="medium" medium="rab" range="0.5"></epuck_range_and_bearing>
</actuators>
<sensors>
<epuck_proximity calibrated="true" implementation="default" noise_level="0.05" show_rays="false"></epuck_proximity>
<epuck_range_and_bearing calibrated="true" data_size="4" implementation="medium" loss_probability="0.85" medium="rab" noise_std_deviation="1.5"></epuck_range_and_bearing>
<epuck_light calibrated="true" implementation="default" noise_level="0.05" show_rays="false"></epuck_light>
<epuck_ground calibrated="true" implementation="rot_z_only" noise_level="0.05"></epuck_ground>
<epuck_omnidirectional_camera implementation="rot_z_only" medium="leds" show_rays="false"></epuck_omnidirectional_camera>
</sensors>
<params fsm-config=" --nstates 4 --s0 8 --vel0 1.2 --cle0 0 --clr0 2 --n0 3 --n0x0 0 --c0x0 7 --p0x0 1 --l0x0 1 --n0x1 1 --c0x1 7 --p0x1 0.15 --l0x1 3 --n0x2 2 --c0x2 2 --p0x2 1 --s1 9 --vel1 1.2 --cle1 0 --clr1 1 --n1 3 --n1x0 0 --c1x0 7 --p1x0 1 --l1x0 2 --n1x1 1 --c1x1 7 --p1x1 1 --l1x1 3 --n1x2 2 --c1x2 2 --p1x2 1 --s2 9 --vel2 1.2 --cle2 4 --clr2 3 --n2 2 --n2x0 0 --c2x0 7 --p2x0 1 --l2x0 2 --n2x1 1 --c2x1 7 --p2x1 1 --l2x1 1 --s3 1 --cle3 3 --n3 1 --n3x0 2 --c3x0 7 --p3x0 1 --l3x0 3" history="false" readable="true"></params>
<!-- From sa -> n0x0 sb = n0x0 sb+1, (a < b) -->
<!-- From sa -> n0x0 sb = n0x0 sb , (a > b)-->
</automode_controller>
</controllers>
<!-- ********* -->
<!-- * Arena * -->
<!-- ********* -->
<arena center="0,0,0.075" size="10, 10, 0.25">
<!-- Change the floor here -->
<floor id="floor" pixels_per_meter="300" source="loop_functions"></floor>
<!-- Change the light here -->
<!-- Please note that this light has an intensity equal to 0 -->
<!-- and therefore does not affect the experiment. -->
<!-- ARGoS requires at least one light when using the light sensor -->
<light color="black" id="light" intensity="0.0" medium="leds" orientation="0,0,0" position="1.5,1.5,0.10"></light>
<!-- ********** -->
<!-- * E-Puck * -->
<!-- ********** -->
<distribute>
<position max="0.4,0.4,0" method="uniform" min="-1,-1,0"></position>
<orientation mean="0,0,0" method="gaussian" std_dev="360,0,0"></orientation>
<entity max_trials="100" quantity="6">
<e-puck id="epuck">
<controller config="tuttifrutti"></controller>
</e-puck>
</entity>
</distribute>
<!-- * Arena * -->
<lua>
includeTextContent(/home/jazmin/tuttifrutti/log/Tesis/Codigos/text.lua)
</lua>
</arena>
<!-- ******************* -->
<!-- * Physics engines * -->
<!-- ******************* -->
<physics_engines>
<dynamics2d id="dyn2d"></dynamics2d>
</physics_engines>
<!-- ********* -->
<!-- * Media * -->
<!-- ********* -->
<media>
<led grid_size="20,20,1" id="leds"></led>
<range_and_bearing grid_size="20,20,1" id="rab"></range_and_bearing>
</media>
<!-- ***************** -->
<!-- * Visualization * -->
<!-- ***************** -->
<visualization>
<qt-opengl>
<camera>
<placement idx="0" lens_focal_length="30" look_at="0,0,0" position="0,0,2.7"></placement>
</camera>
</qt-opengl>
</visualization>
</argos-configuration>