I am trying to get the led colors of nearby robots using omni-directional camera with LUA in ARGoS Simulator. But I am getting the wrong output. Actually my code is given below.
I have attached the screenshot of output here. According to above code, robot 2 should display the red messages two times while should display the green message 3 times in below attached output screenshot. But robot 2 only showing red message five times as it can be seen in log section in below image. While I think there is no mistake in above code.
Code: Select all
if robot.id == 2 then for i = 1, #robot.colored_blob_omnidirectional_camera do if robot.colored_blob_omnidirectional_camera[i].color.red then log(robot.id .. "finds red") elseif robot.colored_blob_omnidirectional_camera[i].color.green then log(robot.id .. "finds green") elseif robot.colored_blob_omnidirectional_camera[i].color.blue then log(robot.id .. "finds blue") end end end
Is there any mistake in above code?
Thanks for help!