Detect colored LED's with omnidirectionnal camera in LUA

Requests regarding how to set up experiments in ARGoS.
titpierrot
Posts: 5
Joined: Sun Feb 10, 2019 2:49 pm

Detect colored LED's with omnidirectionnal camera in LUA

Postby titpierrot » Mon Feb 25, 2019 11:35 pm

Hello,

I am actually trying to get informations from the colored omnidirectionnal camera in a LUA script to locate cylinder with red colored LED.

I am beginner with the use of detectors and LUA, so a lot of things are a little bit difficult for me.

Actually, I try to get the color value with this line :
detected_color = robot.colored_blob_omnidirectional_camera.color

and the angle value with this one :
color_angle = robot.colored_blob_omnidirectional_camera.angle

but it doesn't work.

Thank you very much for help !

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

Re: Detect colored LED's with omnidirectionnal camera in LUA

Postby pincy » Tue Feb 26, 2019 10:10 pm

What does not work? What do you expect to see, and what do you get instead?

Did you add the camera sensor in the .argos file?
I made ARGoS.

titpierrot
Posts: 5
Joined: Sun Feb 10, 2019 2:49 pm

Re: Detect colored LED's with omnidirectionnal camera in LUA

Postby titpierrot » Wed Feb 27, 2019 11:04 pm

Sorry, my first post was'nt really clear, I have write it too fast.

So, I added the camera sensor in the .argos file wih this line in the sensors section :

Code: Select all

<colored_blob_omnidirectional_camera implementation="rot_z_only" medium="leds" show_rays="true" />
I assume that is working because I can launch the argos simulator without error in the terminal.

I read the "ci_colored_blob_omnidirectional_camera_sensor.h" file, and I have see these lines :

Code: Select all

/* Color */ CColor Color; /* Angle */ CRadians Angle; /* Distance in cms */ Real Distance;

So, I assume that we have three output with this sensors :
  • "Angle", which is the angle in radian between the front of the footbot and the led that he detected
  • "Distance", which is the distance in cm between the bot and the led that he detected
  • "Color", which is the color of the led that the bot detected
So, I have several questions :
What is the kind of output of "Color" ? Is this a RGB code, or the name of the color like "red" if the leds are defined with color="red" ?

What is the line to get this output in a variable in a LUA script ? Will the following line work for getting the angle ?

Code: Select all

color_angle = robot.colored_blob_omnidirectional_camera.angle
If it work to the angle, is it the same syntax to get the color output ?

My objective is to detect materials (which are movable cylinders) with the footbot. To do that, I put a red led in the top of the materials, and I use the colored omnidirectionnal camera to detect them.
After the detection of a material by a footbot, I want that the footbot get the material with his gripper and move it.

Sorry for my first post, it is my mind which did not working properly :?


Return to “How to... ?”



cron