LeJos: all robot classes and methods in 1?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: LeJos: all robot classes and methods in 1?

Post by HaWe »

well, as I can't do it because I don't speak Java and I can't handle the OO part:
can you show me how to do it?
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: LeJos: all robot classes and methods in 1?

Post by mightor »

Helmut,

If you can't handle OO and you can't handle Java, what makes you believe you could handle one of those "ueber classes"? You're -still- using Java and you're -still- using OO. Stick with NXC or learn to use NXOS, nxtOSEK or Trampoline. It's all just gcc and can be used inside the editor of your choice.

Do you have a compelling argument for the developers of Lejos (or someone else) to do this work? Other than just you wanting someone to do the work for you?

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: LeJos: all robot classes and methods in 1?

Post by HaWe »

you yourself have been the one who told me and others that nxtosek is too complicated to handle.
Actually I once tried Java - for my RCX.
Most of the code was similar to C except the methodes like myrobot.motor(...) . that's not the problem.
the functions and tasks I wrote by my own also were not the problem.
My problem was the extension of classes by other classes
(navigator + subsumption + comm +...+...+....)
another point was adding of methods to those classes (in the navigator class was a method like getposition() and I wanted to add the method setposition. Though I re-compiled the class: no chance. But that's another issue.
Having 1 super-class would already help for the 1st step, the rest will have to be resolved later.

But best of all would be having a C-like language working on the Java VM so that I won't have to write all my code for the chess program, my navigator, my astar, my bug2, my neural net, and some specific drivers for home brewed sensors and lots of other things completely new.
physics-matt
Posts: 76
Joined: 29 Sep 2010, 06:57

Re: LeJos: all robot classes and methods in 1?

Post by physics-matt »

doc-helmut wrote: can you show me how to do it?
Well, I could...

Sounds like you're not giving Java a fair chance. The problems you've cited are pretty straightforward to solve and just require a bit of learning (there are oodles of good Java tutorials online). I doubt anyone will be willing to help write an uber-class for you if you're not willing to put in a bit of effort to get Java to work for yourself.

Matt
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: LeJos: all robot classes and methods in 1?

Post by HaWe »

well, I already did. As I wrote I already once worked with java, and I prgrammed a RCX behaviour robot with some odometric navigation facilities.
But I failed to construct a super class, that's why I once sacrificed Java about 10 years ago.

this was my try, but I already got completely confused what an implementation is, what a constructor is, and what the instance variable is:

Code: Select all

//*****************  DriveRoute    (Normalverhalten) *****************

import josx.platform.rcx.*;
import josx.robotics.*;


public class DriveRoute implements Behavior {

   private Navigator nav; // 

   public DriveRoute(Navigator n) { 
   }

   public boolean takeControl(){
      return true;
   }

   public void suppress() {
      nav.stop();
   }

   public void action() {

     boolean da;
     int xpos, ypos;
     

        nav.stop();
        xpos=(int)nav.getX();
        ypos=(int)nav.getY();

        basics.print_S1();

        nav.gotoPoint(basics.TabX[2], basics.TabY[2]);
        
        da=  (basics.TabX[2]-xpos==0) && (basics.TabY[2]-ypos==0) ;

     nav.stop();
   }
}
(ps: why do you call it "uber" class - it sounds like the German word "über"="ueber" which means actually nothing else than "super" or "hyper"...?)
Last edited by HaWe on 01 Nov 2010, 18:46, edited 1 time in total.
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: LeJos: all robot classes and methods in 1?

Post by mightor »

The word ueber is used a lot in the English (especially among gamers/technophiles/geeks) to denote just that, something super or better than average. I use it all the time. You can even use it in a normal sentence "that's really ueber" to say that something is cool, super, that sort of thing :)

Java has progressed a lot since 10 years ago. Perhaps you should give it another go. Lejos is wonderful and really nicely made. I am sure it won't disappoint you.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: LeJos: all robot classes and methods in 1?

Post by HaWe »

I added my old code above. I guess it's still like today, isn't it?
this was my try, but I already got completely confused what an implementation is, what a constructor is, and what the instance variable is
edit: I can't imagine yet how the code had looked like if I had implemented still 3 or 4 classes more than just those 2... :cry:
( maybe I'd give it a try, but only if I had a "ueber-class")
" too old for Java, too young to die "
physics-matt
Posts: 76
Joined: 29 Sep 2010, 06:57

Re: LeJos: all robot classes and methods in 1?

Post by physics-matt »

mightor wrote:that's really ueber
Didn't realise you were so down with the kids! 8-)
doc-helmut wrote: this was my try, but I already got completely confused what an implementation is, what a constructor is, and what the instance variable is:
You really need to take the effort to learn Java properly. Any good tutorial will take you through what each of these are and how to use them. Then you'll be in a position to write your uber-class, or you may even decide you can go without it!

Matt
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: LeJos: all robot classes and methods in 1?

Post by HaWe »

can somebody pls show me?
maybe using sort of word processing copying all Java class files into 1?
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: LeJos: all robot classes and methods in 1?

Post by gloomyandy »

Doc,
There are lots of samples supplied with leJOS perhaps some of those would help?
http://lejos.svn.sourceforge.net/viewvc ... 5/samples/

The code you posted above is using the leJOS subsumption architecture (which to be honest is not a robotics model that I've ever really liked that much, but it does seem to be popular). This sample:
http://lejos.svn.sourceforge.net/viewvc ... iew=markup
uses subsumption. I'm not sure this is the best pace to start if you don't like OO. Some of the other samples may be easier to understand...

Andy
Locked

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests