I am a Student in Newcastle University, currently undergoing my Master's Degree. My final project is a simulation using webots. I have to simulate a mobile robot, using python 2.7 coding. The problem is that I cannot find any documentation on python robot programming and the webots website has no python documentation. Everything in the website is based on C examples except from the names of some commands. Where can I find python documentation for webots in the internet? Or If anyone has documentation can they provide me with it? It will be very helpful for my project. Thank you.
-
4Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it. – Dima Kozhevin Nov 25 '17 at 18:35
-
the problem is that i haven't used Python before and I do not know how to program sensors. I dont know where to look if what im doing is right or wrong. I dont know where to begin... – George Tsoufis Nov 25 '17 at 19:32
-
1Learning Python before using Webots is very recommended. – FabienRohrer Nov 26 '17 at 10:21
1 Answers
The complete Python API of the Webots controller module is described in the sections of this chapter: https://www.cyberbotics.com/doc/reference/nodes-and-api-functions For example: https://www.cyberbotics.com/doc/reference/accelerometer?tab=python#wb_accelerometer_enable
In Webots, the Python API is exactly the same as the C++ oriented-object API, and the link with the C API is one-to-one too. So "translating" a Webots controller written in C / C++ to Python is often straight forward.
General instructions about programming a Webots controller (written for C) are true for Python too: https://www.cyberbotics.com/doc/guide/controller-programming
Webots contains several Python examples, including:
$WEBOTS_HOME/resources/templates/controllers/template.py
(The template used when creating a new Python controller, reading the comments there should help you.)$WEBOTS_HOME/projects/languages/python/...
(a demo to study showing how to control a robot, communicate between robots, do Supervisor tasks, get the Computer keyboard, etc.)
Note also that all the benchmarks of robotbenchmark are written in Python and are using the Webots API (it could be a very good starting point to perform some of these benchmarks).

- 1,794
- 2
- 15
- 26