Problem running simulation

Help
Anonymous
2013-03-02
2013-04-29

  • Anonymous
    2013-03-02

    #define MOVE_TIME 500
    #define TURN_TIME 500

    task main()
    {
      repeat(4)
      {
        OnFwd(OUT_AC, 75);
        Wait(MOVE_TIME);
        OnRev(OUT_C, 75);
        Wait(TURN_TIME);
      }
      Off(OUT_AC);
    }

    This is the code I'm running. My OS is Lubuntu 12.10, my nxcEditor is version 0.0.98, and my gambas version is 3.1.1 .
    When trying to run the mentioned code, the robot won't move, although the "Start" button is disabled (together with other buttons). Trying to move it from the left panel (left/right, turn, move back/forth), does not create any problem. Where am I mistaking?

     
  • Knefel
    Knefel
    2013-03-03

    The code works for me (Ubuntu 12.04 - Intel Atom N270 - nxcEditor 0.1.1 - gambas 3.4.0). The code should also work with your configuration. If you are using the PPA for Ubuntu, please make an update …

    1) Start the nxcEditor and open the nxcSimulator from the menu (click on "nxcSimulator" -> click on "Open nxcSimulator"). Now click on "Start program" - the robot should write "NXC" very fast on the black background (and all other backgrounds). If this doesn't work (the robot is slow for example) then you have to install another driver for the graphics card with 3D support (or you have to activate this support - the nxcSimulator needs OpenGL). It's possible to test the 3D support with the program "glxgears" inside a Terminal.

    2) It depends on the computer to determine whether the next tip will help. You should reduce the framerate of the simulator. Open the "Help -> Correct display-bugs" menu of the simulator and choose "40" for the framerate (since nxcEditor 0.1.0: mark a check box and this will be the default value). Now run your program. You may test other values (50, 60) …

    Tip: In order to really create a square, you should use the "RotateMotor" command.