Message thread on Webots Modeling

Saadby Saad Javed (5) 2017-03-19 11:40:21
Respected Sir,
It is stated that i want to divide my floor into grid cells, with each cell having its own identification.
Could you help me out in this because i am stuck here. I am using webots 7.1.0.
Thank you
Your,s Obediently,
Saad Javed
Mechatronics Department
University of Engineering and Technology
Peshawar (Pakistan)

Attachment: obstacles.wbt.
Re: Saadby Tom Norton (Webots PRO - 9) 2017-03-20 08:41:26
Dear Saad,

Webots 7.1.0 is no longer supported.

Please upgrade to Webots 8.5.4, and I can offer direct assistance.

Best Regards,

Tom Norton
Re: Saadby Saad Javed (5) 2017-03-22 07:25:56
Respected Sir,
I have upgraded to webots 8.5.4. Could you now help me how to divide the floor into grid cells with each cell having its own identification?
Thank you
Saad Javed
Re: Saadby Fabien Rohrer (Webots PRO - 1173) 2017-03-22 09:00:40
Hi Saad,

How do you plan to use the grid cells?
If it's just a matter to know in which cell the robot is located in an abstract way, you can simply store some grid data (typically a 2D array of identifiers) in the robot controller, and determine only by programming in which cell the robot is using the robot GPS.
Are your expectations more complex, or do you have issues to implement this?

Fabien Rohrer
Re: Saadby Saad Javed (5) 2017-03-22 15:57:56
Hi Sir...
I want to know in which cell robot is located, in which cells obstacles are located and in which cells other robots are located.
Thank you
Your,s Obediently,
Saad Javed.
Re: Saadby Tom Norton (Webots PRO - 9) 2017-03-23 08:31:37
Hi Saad,

As Fabien said, a good approach to this is to perform this programmatically, in a controller.

The best solution for what you are trying to achieve is to use the Supervisor API to get the nodes (robots & obstacles) you wish to track, store the grid data in your controller, and perform position checks using this Supervisor function: wb_supervisor_node_get_position().

Compare its return value against your grid data to determine in which cells your tracked objects are located.

Note that the use of Supervisors and the Supervisor API requires a PRO license.

Best Regards,

Thomas Norton
Re: Saadby Saad Javed (5) 2017-03-30 15:15:14
I have read supervisor APl in webots manual but i am not understanding how i should implement it to track robots/obstacles.
Can you help me out?
Thank you,
Saad Javed
Re: Saadby Tom Norton (Webots PRO - 9) 2017-03-30 17:25:11
Hi Saad,

The first thing to understand is that robots/objects/devices are represented as Nodes (Robot, Background, Supervisor etc.), with each node having a set of Fields (translation, rotation etc.).

The supervisor API allows you to retrieve references to nodes, and using those references it is possible to get/set field values (amongst many other things!).

For example, to get the robot's translation, you may do the following assuming your robot has the def name "BOT":

WbNodeRef bot = wb_supervisor_node_get_from_def("BOT");
WbFieldRef translationField = wb_supervisor_node_get_field(bot, "translation");
const double* translation = wb_supervisor_field_get_sf_vec3f(translationField);

This would give you the Robot's translation at the time of the API call.

Let me know if that helps you get started.

Best Regards,

Tom Norton
You need to log in to be able to reply, subscribe or unsubscribe to this thread