![]() If it displays the correct Python version, then, everything is setup properly and you should be able to run the Python example provided with Webots in the WEBOTS_HOME/projects/languages/python/worlds/example.wbt world file. ![]() To check this was done properly, you can open a DOS console ( CMD.EXE) and type python -version. Then, you have to modify your PATH environment variable to add the path to the python.exe binary which is located in the main Python36 or Python27 installation folder. You should install the latest version of Python 3.6 (64 bit) or Python 2.7 (64 bit) from the official Python website. To check the versions of Python installed on your system, you can type in a terminal: python -version, python3.6 -version, python2.7 -version, python3 -version, etc. It is possible to install Python 3.6 from the Python web site or from various Linux repositories. MacOS has Python 2.7 installed by default. Most of the Linux distributions have Python 2.7 and 3.x already installed. If specified in the runtime.ini file of a controller, this Python command will be executed instead of the default one to launch this controller. If you set it for example to python3.6 instead of python, this version of python will be used (if available from the command line).įinally, it is also possible to set a different version of Python for each robot controller by editing the section of the runtime.ini file in each robot controller directory and setting the COMMAND value to python3, python3.6 or python2.7, etc. If you want to use a different version of Python, please install it if needed and configure your environment so that it becomes the default python version when called from the command line in a terminal.Īlternatively, you can change the default Python command from the Webots Preferences in the General tab. Webots starts Python using the standard python command line.Īs a consequence, it executes the first python binary found in the current PATH. On Ubuntu 16.04, it also supports Python 3.5. The Python API of Webots supports both Python 3.6 and Python 2.7. The classes are either representations of a node of the scene tree (such as Robot, LED, etc.) or utility classes (such as Motion, ImageRef, etc.).Ī complete description of these functions can be found in the reference guide while the instructions about the common way to program a Python controller can be found in this chapter. The Python API is currently composed of a set of about 25 classes having about 200 public functions located in the module called controller. This implies that their class hierarchy, their class names and their function names are almost identical. The Python API has been generated from the C++ API by using SWIG.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |