Painting square to ground

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Painting square to ground

Postby NadirHajiyev » Mon Jul 16, 2012 10:04 am

I tried to paint the ground by using my Lego, so i wrote a code for moving (straight 2m and turn left) for times. Here is my code.
Code: Select all
import lejos.nxt.Motor;
import lejos.robotics.RegulatedMotor;
import lejos.robotics.navigation.DifferentialPilot;
import lejos.robotics.navigation.MoveController;
import lejos.util.PilotProps;

public class SquareMove{
   static PilotProps pp = new PilotProps();
   static float wheelDiameter = Float.parseFloat(pp.getProperty(PilotProps.KEY_WHEELDIAMETER, "4.32"));
   static float trackWidth = Float.parseFloat(pp.getProperty(PilotProps.KEY_TRACKWIDTH, "16.35"));
   static RegulatedMotor leftMotor = PilotProps.getMotor(pp.getProperty(PilotProps.KEY_LEFTMOTOR, "A"));
   static RegulatedMotor rightMotor = PilotProps.getMotor(pp.getProperty(PilotProps.KEY_RIGHTMOTOR, "b"));
   static boolean reverse = Boolean.parseBoolean(pp.getProperty(PilotProps.KEY_REVERSE,"false"));
   public static void main(String[] args){
      for(int i=0;i<4;i++){

   private static void rotateLeft(int angle) {
      // TODO Auto-generated method stub
      DifferentialPilot dp = new DifferentialPilot(wheelDiameter, trackWidth, leftMotor, rightMotor, reverse);

   private static void travelForward(int distance) {
      // TODO Auto-generated method stub
      ((MoveController) Motor.A).travel(distance);
      ((MoveController) Motor.B).travel(distance);

   private static void setSpeed(int speed) {
      // TODO Auto-generated method stub

But when I run it I got
Exception 26
at: 97(3)
at: 95(13)

I do not have any idea to debug this code.
Please help me.
New User
Posts: 20
Joined: Thu Jul 05, 2012 10:25 am

Re: Painting square to ground

Postby skoehler » Mon Jul 16, 2012 11:13 am

Use the "-v" switch of nxj or nxjlink, or use the -od switch to generate a *.nxd file and then use the nxjdebugtool to translate the numbers on the NXT's screen into class and method names.
leJOS Team Member
Posts: 1458
Joined: Thu Oct 30, 2008 4:54 pm

Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff