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
125 stars 121 forks source link

ARDUINO code generation error (title changed) #97

Closed rbudde closed 5 years ago

rbudde commented 6 years ago

writing promitive types to the display invokes c_str() on them, which fails.

10:07:24.368 [main] INFO d.f.i.r.j.i.CompilerWorkflowIT - [[[[[ Robot: ardu compile nepo file: /crossCompilerTests/ardu/standardSensors.xml =====
10:07:24.368 [main] INFO d.f.i.r.j.r.all.ClientAdmin - command is: setRobot
10:07:24.368 [main] INFO d.f.i.r.r.RobotCommunicator - token 3_1--b4QMssR is not waited for. Ok.
10:07:24.368 [main] INFO d.f.i.r.j.r.all.ClientAdmin - set robot to ardu
10:07:24.369 [main] INFO d.f.i.r.j.r.all.ClientProgram - command is: compileP, userId is -1
10:07:24.431 [main] INFO d.f.i.r.j.r.all.ClientProgram - compiler workflow started for program prog
10:07:24.434 [main] INFO d.f.i.r.f.AbstractCompilerWorkflow - stored under: /tmp/userProjects/toknTokn/prog/src/prog.ino
/tmp/userProjects/toknTokn/prog/src/prog.ino: In function ‘void loop()’:
/tmp/userProjects/toknTokn/prog/src/prog.ino:53:50: error: request for member ‘c_str’ in ‘bnr.BnrRoberta::colorSensorLight(((byte*)(& colorsLeft)), 1)’, which is of non-class type ‘int’
     one.lcd1(bnr.colorSensorLight(colorsLeft, 1).c_str());
                                                  ^
exit status 1
10:07:25.095 [main] INFO d.f.i.r.f.a.b.CompilerWorkflow - COMPILERWORKFLOW_ERROR_PROGRAM_COMPILE_FAILED
10:07:25.095 [main] INFO d.f.i.r.j.r.all.ClientProgram - compileN terminated with COMPILERWORKFLOW_ERROR_PROGRAM_COMPILE_FAILED
10:07:25.096 [main] ERROR d.f.i.r.j.i.CompilerWorkflowIT - ----- Robot: ardu compile nepo file: /crossCompilerTests/ardu/standardSensors.xml FAILED(response-info) ]]]]]
elhele commented 6 years ago

@rbudde it seems to be Botnroll, not NXT

rbudde commented 6 years ago

@elhele you are right. It wasn't NXT, but arduino!

bjost2s commented 6 years ago

Do we have to fix it anyway?

VinArt commented 5 years ago

image

unsigned int colorSensorColor(byte colors[], int port);

So basically c_str() is called for uint.

BotnRollCppVisitor.java:

if ( (isVar && (varType.equals("STRING"))) || ((mode != null) && !mode.toString().equals("RED") && !mode.toString().equals("RGB")) ) {
    toChar = ".c_str()";
}