|Saad||by Saad Javed (5) 2017-03-19 11:40:21|
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.
University of Engineering and Technology
|Re: Saad||by Tom Norton (Webots PRO - 9) 2017-03-20 08:41:26|
Webots 7.1.0 is no longer supported.
Please upgrade to Webots 8.5.4, and I can offer direct assistance.
|Re: Saad||by Saad Javed (5) 2017-03-22 07:25:56|
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?
|Re: Saad||by Fabien Rohrer (Webots PRO - 1173) 2017-03-22 09:00:40|
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?
|Re: Saad||by Saad Javed (5) 2017-03-22 15:57:56|
I want to know in which cell robot is located, in which cells obstacles are located and in which cells other robots are located.
|Re: Saad||by Tom Norton (Webots PRO - 9) 2017-03-23 08:31:37|
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
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.
|Re: Saad||by 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?
|Re: Saad||by Tom Norton (Webots PRO - 9) 2017-03-30 17:25:11|
The first thing to understand is that robots/objects/devices are represented as Nodes (Robot
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.