OpenRoberta / openroberta-lab

The programming environment »Open Roberta Lab« by Fraunhofer IAIS enables children and adolescents to program robots. A variety of different programming blocks are provided to program motors and sensors of the robot. Open Roberta Lab uses an approach of graphical programming so that beginners can seamlessly start coding. As a cloud-based application, the platform can be used without prior installation of specific software but runs in any popular browser, independent of operating system and device.
Apache License 2.0
122 stars 118 forks source link

Edison - using repeat x times loop #1632

Open Thorlogy opened 4 months ago

Thorlogy commented 4 months ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Open Roberta Lab'
  2. Click on 'Edison'
  3. Code the "repeat x times loop"
  4. Download to Edison
  5. See error

Expected behavior

Screenshots

image image

Device information

bjost2s commented 4 months ago

Please be more precise and send a screenshot of the generated source code (Source Code View) of line 12

Thorlogy commented 4 months ago
image

here you go.

rbudde commented 4 months ago

I tried the following code in the EdPy-IDE and it works:

import Ed

Ed.EdisonVersion = Ed.V1

Ed.DistanceUnits = Ed.TIME
Ed.Tempo = Ed.TEMPO_MEDIUM

#--------Your code below-----------

for x in range(10):
    Ed.RightLed(Ed.ON)

Using this code in our source code editor, generates an error of the Edison compiler we are using:

Achtung

Das Programm kann nicht auf dem Roboter oder in der Simulation ausgeführt werden. Das Program kann nicht übersetzt werden. Die Fehlermeldung ist:
{"error": true, "messages": ["ERR: file:10:0: Syntax Error, FOR code too complex for Ed.Py"], "wavFilename": null}

A possible reason: our Edison compiler is outdated. BTW: the program can be executed in the simulation. We should change the error message.

bjost2s commented 4 months ago

The "old" (and origin) Edison Python compiler works, but unfortunately only with Python 2. That's why we changed it here to a python 3 compatible version. Seem like the issue with "too complex" comes from this compiler: https://github.com/thonny/thonny-edison One workaround would be, to switch back to the Python 2 version or trying to fix the thonny solution. Last year the information from Edison was, that they are not working on a Python 3 compatible compiler for Python.