Loop-function in Lua

Requests regarding how to set up experiments in ARGoS.
sosoup
Posts: 5
Joined: Sun Mar 15, 2015 4:42 pm

Loop-function in Lua

Postby sosoup » Sun Mar 15, 2015 5:29 pm

How can a loop-function be implemented in Lua. Can some one please give a code snippet or some example. thanks !!

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

Re: Loop-function in Lua

Postby pincy » Sun Mar 15, 2015 6:11 pm

Hi,

Loop functions can't be coded in Lua (yet). They must be done in C++.

Wrapping all of ARGoS in Lua is a huge amount of work, and would kill performance sensibly. I'm studying solutions to avoid these problems, but for the time being C++ is the way.

Cheers,
Carlo
I made ARGoS.

sosoup
Posts: 5
Joined: Sun Mar 15, 2015 4:42 pm

Re: Loop-function in Lua

Postby sosoup » Sun Mar 15, 2015 8:16 pm

Thank you so very much for your reply. Actually I am doing a small project where the robots are looking for some "tiles". Once they find the tile they grip it and again look for some "hole". When they find a hole, the robot drops the tile.
Can you please give me some pointer as to how can I achieve this in Lua. It would be of great help for me.

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

Re: Loop-function in Lua

Postby pincy » Sun Mar 15, 2015 8:55 pm

I have some basic Lua examples here:

http://iridia.ulb.ac.be/~cpinciroli/extra/h-414/

and the foraging example, even though it is written in C++, does most of what you describe. You could readapt the loop functions of the foraging example to do what you say.

The only tricky part is to interface the loop function with the Lua controller. You can check this page:

http://iridia.ulb.ac.be/~cpinciroli/extra/h-414/2013/

In particular this code:

http://iridia.ulb.ac.be/~cpinciroli/ext ... 30.tar.bz2

for examples of interfacing Lua and the loop functions.

Let me know if you need more specific guidance.

As soon as I get the chance, I'll try and make a specific example, since your request appears to be helpful for many users.
I made ARGoS.

sosoup
Posts: 5
Joined: Sun Mar 15, 2015 4:42 pm

Re: Loop-function in Lua

Postby sosoup » Mon Mar 16, 2015 1:35 pm

Thank you so so much for your effort. I have already seen those examples and documents. For the tile problem, stated above I am developing some concept in Lua. My idea is to have the cylinders as tiles, get to the cylinder and using robot-gripper to bring them to the black spots on the floor(as holes).
Now, I don't know if this complete approach is feasible in Lua. The problem I am facing here is to make the robot search for these cylinders. I know there is a "robot-omnidirectional-camera" but how can use this in Lua to see a cylinder and go near it. Or can I be able to differentiate the approaching object, if it is a wall or another robot or a movable-cylinder using proximity sensor. Or can you please suggest me some other way to search and transport the tiles to the holes, using Lua in particular.

Thanks again !

sosoup
Posts: 5
Joined: Sun Mar 15, 2015 4:42 pm

Re: Loop-function in Lua

Postby sosoup » Mon Mar 16, 2015 5:27 pm

I have one more question based on other idea. Can a circle be drawn on the Argos floor using Lua like it has been done in the forging example here. Please help me out.

Thanks!

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

Re: Loop-function in Lua

Postby pincy » Tue Mar 17, 2015 2:24 am

The problem I am facing here is to make the robot search for these cylinders. I know there is a "robot-omnidirectional-camera" but how can use this in Lua to see a cylinder and go near it.
On how to use the camera:
  • Add the omnidirectional camera to the .argos file as shown in the <controllers> section of flocking.argos.
  • When you run ARGoS with the Lua editor activated, you can Shift+Click on robot to select it. When a robot is selected, the Lua variables and functions appear in the Lua editor. You can use that as a reference. The functions and variables to check are under robot.colored_blob_omnidirectional_camera.
I have already given you a complete example on how to setup your experiment. I link it again:

http://iridia.ulb.ac.be/~cpinciroli/ext ... 30.tar.bz2
can I be able to differentiate the approaching object, if it is a wall or another robot or a movable-cylinder using proximity sensor
The example is setup so that the robots use the camera to detect the cylinders. The trick is that red LEDs are placed on top of the cylinders, and these LEDs are detected by the camera. This way, if a robot sees a red blob with the camera, it readily knows that a cylinder is there. Refer also to the command

Code: Select all

$ argos3 -q cylinder
for more details.
Can a circle be drawn on the Argos floor using Lua like it has been done in the forging example here.
No. As I have answered in a previous post, Lua is for robot controllers only. If you want to draw, you need to use C++ like it's shown in the existing examples.
I made ARGoS.

sosoup
Posts: 5
Joined: Sun Mar 15, 2015 4:42 pm

Re: Loop-function in Lua

Postby sosoup » Tue Mar 17, 2015 3:34 pm

I am extremely thankful for your constant support. I think I have volume of information and I can go ahead with my implementations. Thank you so much again.

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

Re: Loop-function in Lua

Postby pincy » Tue Mar 17, 2015 3:36 pm

No problem, happy to help!
I made ARGoS.


Return to “How to... ?”