Navigator Bugs

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

Moderators: roger, gloomyandy, skoehler

User avatar
jippiee
New User
Posts: 6
Joined: Tue Dec 26, 2017 1:07 am

Navigator Bugs

Postby jippiee » Sun Dec 31, 2017 1:54 am

Hi Andy,
(let's face it, you're probably the first and only to read this and provide me with answers :D )

I'm currently testing the Navigator class and I have found a quite severe issue. While navigating along a path with multiple waypoints the robot tends to make unpredicted rotations and after that unpredicted moves. This first moves are often still accurate, but with incresing moves the chances of an unpredicted turn increses. Also (although I haven't done enough testing to be certain) the robot seems to perform better directly after startup as after multiple runs.

For my test I took the World Robot Olympiad 2017 Regular Category Senior Mat and used the five big, colored squares (marked "Windpark") as Waypoints to navigate around. My startpoint, also refered as origin, is the crossing of two lines in the center of the mat (marked with a pink circle) with the robot facing away from the big green square ("Startbereich"). So my x-axis is parallel to the short side of the mat and my y-axis is parallel to the long side

The Robot should travel from its start point (origin) to the black, then blue, then red, then yellow, then green rectangle and return to the origin. The path is shown in this image:

Image

The code I've used for testing:

Code: Select all

package pack;

import lejos.hardware.Button;
import lejos.hardware.LED;
import lejos.hardware.ev3.LocalEV3;
import lejos.hardware.motor.Motor;
import lejos.robotics.chassis.Wheel;
import lejos.robotics.chassis.WheeledChassis;
import lejos.robotics.localization.PoseProvider;
import lejos.robotics.navigation.MovePilot;
import lejos.robotics.navigation.Navigator;
import lejos.robotics.navigation.Waypoint;
import lejos.robotics.pathfinding.Path;

public class NavigationBugs {
   WheeledChassis chassis;
   PoseProvider myPoseProv;
   LED led = LocalEV3.get().getLED();

   public static void main(String[] args) {
      new NavigationBugs();            
   }

   NavigationBugs() {
      led.setPattern(2);
      Wheel leftWheel = WheeledChassis.modelWheel(Motor.B, 6.225).offset(7.275);
      Wheel rightWheel = WheeledChassis.modelWheel(Motor.C, 6.225).offset(-7.275);
      chassis = new WheeledChassis( new Wheel[] {leftWheel, rightWheel}, WheeledChassis.TYPE_DIFFERENTIAL);
            
      myPoseProv = chassis.getPoseProvider(); // not used
      
      chassis.setAcceleration(10, 45);
      chassis.setSpeed(10, 90);
      
      MovePilot pilot = new MovePilot(chassis);
      Navigator nav = new Navigator(pilot);
            
      led.setPattern(3);
      
      // Distinctive locations on the WRO 2017 Regular Senior mat.
      Waypoint origin      = new Waypoint(  0.0,  0.0);
      Waypoint blackMark   = new Waypoint( 28.5, 32.5);
      Waypoint greenMark   = new Waypoint(-28.5, 32.5);
      Waypoint redMark   = new Waypoint(    0.0, 61.0);
      Waypoint blueMark   = new Waypoint( 28.5, 89.5);
      Waypoint yellowMark   = new Waypoint(-28.5, 89.5);
            
      Path path = new Path();
      
      path.add(blackMark);
      path.add(blueMark);
      path.add(redMark);
      path.add(yellowMark);
      path.add(greenMark);
      path.add(origin);
      
      led.setPattern(1);
      Button.ENTER.waitForPressAndRelease();
      
      nav.followPath(path);
      Button.ENTER.waitForPressAndRelease();      
   }
}


During my first testing of about 10 runs the Robot only managed to return to the origin once. That was the very first run.

Here is a video of my third testing (sorry about the jerky camera):
https://youtu.be/LnSyPS4dhRg

I would describe this problem as identical (or at leased very similar) to the one described in this post by RoboRobo: https://lejos.sourceforge.io/forum/viewtopic.php?f=18&t=7528&start=45

In that post you and Aswin discussed possible bug fixes.

Question 1: Is the bug fixed?

And if it is, the ev3classes here should have the bugfix, right? So that leads to...

Question 2: How do I update my ev3classes in eclipse?

At leased I assume I must update the ev3classes.jar in the "LeJOS EV3 EV3 Runtime" of my leJOS Project as those get written to my Brick every upload, right?

User avatar
gloomyandy
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Navigator Bugs

Postby gloomyandy » Sun Dec 31, 2017 9:28 am

Hi firstly thanks for the very clear report and for taking the time to search for other related posts.

Nope the bug we discussed has not been investigated beyond the discussion we had nor has any fix been applied.

Did you try the possible fix suggested on other threads of using the pose provider from the chassis with the navigator? I see that in your code you are obtaining it but not using it. To use it for navigation you need to pass it into the constructor of the navigator.

You can also try setting single step mode and adding a loop to perform each step one at a time followed by a short delay. If the problem you are seeing is the one we talked about in the other posts this should give better results.

If you do need to rebuild things the best option is to rebuild the ev3classes project on your PC and then replace the jar file on both your PC install and on your EV3.
leJOS news https://lejosnews.wordpress.com/

User avatar
jippiee
New User
Posts: 6
Joined: Tue Dec 26, 2017 1:07 am

Re: Navigator Bugs

Postby jippiee » Sun Dec 31, 2017 11:41 am

Simply adding the PoseProvider into the Navigator solved the problem!

But there are surely other bugfixes in the up-to-date ev3classes. So would it be a good idea to update mine, or?

I downloaded a snapshot of the whole code on sourceforge. In the extracted .zip file there is a ev3classes folder, which I opened in eclipse. But I'm not sure how to build the ev3classes.jar. Is it correct to simply run the build.xml as an Ant Build? Eclipse gives me two options for Ant Build:

1 Ant Build Alt+Shift+X,Q
2 Ant Build...

Which one should I take?

And when I have the ev3classes.jar I must overwrite "C:\Program Files\leJOS EV3\lib\ev3\ev3classes.jar" and the ev3classes.jar on my sd card. Only problem is, when I connect the sd to my PC windows can't access it and tells me to format it. Can the files maybe be accessed through the ev3Control?

User avatar
gloomyandy
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Navigator Bugs

Postby gloomyandy » Sun Dec 31, 2017 12:29 pm

Yes just build the ant project. You may need to add some additional projects that the ev3classes depends on to be honest I can't remember. I don't think there are many fixes made after the last release, there has not been very much activity on leJOS since then. I'm not sure if you can use ev3control to directly replace the ev3classes.jar file on the EV3. You may need to copy it over using that and then ssh into the EV3 and copy the file over to the actual location.
leJOS news https://lejosnews.wordpress.com/

User avatar
jippiee
New User
Posts: 6
Joined: Tue Dec 26, 2017 1:07 am

Re: Navigator Bugs

Postby jippiee » Sun Dec 31, 2017 1:39 pm

When i try to build the ev3classes I get an error message about a missing javac compiler.

Console Output:
Buildfile: C:\Users\jippiee\Documents\LeJOS\lejos-ev3-code-8f74bf2fa5e941a79d4c173c6492c9b8957cb7e7\ev3classes\build.xml
clean:
[delete] Deleting directory C:\Users\jippiee\Documents\LeJOS\lejos-ev3-code-8f74bf2fa5e941a79d4c173c6492c9b8957cb7e7\ev3classes\build
compile:
[mkdir] Created dir: C:\Users\jippiee\Documents\LeJOS\lejos-ev3-code-8f74bf2fa5e941a79d4c173c6492c9b8957cb7e7\ev3classes\build
[javac] C:\Users\jippiee\Documents\LeJOS\lejos-ev3-code-8f74bf2fa5e941a79d4c173c6492c9b8957cb7e7\ev3classes\build.xml:22: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

BUILD FAILED
C:\Users\jippiee\Documents\LeJOS\lejos-ev3-code-8f74bf2fa5e941a79d4c173c6492c9b8957cb7e7\ev3classes\build.xml:22: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre1.8.0_151"

Total time: 358 milliseconds

You said there aren't too many new additions to ev3classes. Is it worth the hassle to get these new ones working?

User avatar
gloomyandy
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Navigator Bugs

Postby gloomyandy » Sun Dec 31, 2017 2:06 pm

It's up to you really. Personally I would not bother unless you hit more problems. As to your error as it says it looks like your JAVA_HOME does not point to a JDK rather it points to a JRE (which will not include the javac command). You should probably point it to a Java 7 JDK (rather than the Java 8 JRE it is currently set to).
leJOS news https://lejosnews.wordpress.com/

User avatar
jippiee
New User
Posts: 6
Joined: Tue Dec 26, 2017 1:07 am

Re: Navigator Bugs

Postby jippiee » Sun Dec 31, 2017 2:23 pm

I did a bit more research and I found this wiki: https://sourceforge.net/p/lejos/wiki/Working%20with%20GIT/

As I've already downloaded the latest lejos-ev3-code-(bunch of numbers and letters), I simply need to follow the steps under Building Projects.

During this the EV3 should be connected and the ev3classes will also be updated on it. Is the .jar in "C:\Program Files\leJOS EV3\lib\ev3\ev3classes.jar" also going to get automatically updated or does that have to be done manually?

Are these steps enough to use the up-to-date ev3classes?

User avatar
gloomyandy
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Navigator Bugs

Postby gloomyandy » Sun Dec 31, 2017 5:07 pm

That may work, but it may not. Things are very flexible with eclipse and leJOS but that can make things rather complex and there are multiple ways of doing pretty much everything! So for instance the ant build files contain a lot of rules, one of which is to upload the ev3class.jar file after building it, but these rules are not always "enabled" and may not be the default target rule, also the settings may or may not work on your system. You will almost certainly need to try a few things to get it to work. I would also suggest that if you are going to do this sort of thing you switch to using the leJOS snapshot as the source of your libraries rather than the installed called. Then you can build the new ev3classes.jar followed by building the snapshot (which will copy the ev3classes.jar over to the correct location in the snapshot), this will also ensure that you have the most up to date native libs etc, which may be required. You should really also rebuild you sdcard using the lejosimage.zip that you will find in the snapshot. Things may work with the sdcard from the release, but there have definitely been changes since then.

If you do not want to use the snapshot, you could take the alternate route of changing your leJOS projects to reference the ev3classes project, that way you will build against your newly built ev3classes.jar file.

Sorry if this all sounds complex, but there is a big leap from simply using leJOS to developing it and we made a lot of assumptions about the people that would be doing this and their knowledge of build systems etc. You also need to ensure that you have all of the many components of leJOS in sync to be sure that they will work together. Things may work if you use a new ev3classes.jar with a release sdcard, but I can't be sure. Certainly if you run into any problems a likely first step would be to get you to make sure everything is consistent. Finally remember that if you go this route you are using code that has probably not been used by more than a handful of people and so you may well run into new problems.
leJOS news https://lejosnews.wordpress.com/

User avatar
jippiee
New User
Posts: 6
Joined: Tue Dec 26, 2017 1:07 am

Re: Navigator Bugs

Postby jippiee » Sun Dec 31, 2017 6:46 pm

Ok, as I'm still new to leJOS and first wanted to try out the capabilities of leJOS I will not take the route of updating everything right now. Though many thanks for the help you've provided me so far!


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 3 guests