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 »

xander: It wouldn't be the first time I used a srewdriver for hammering a nail - that's not my problem...
gloomy: with Motor.A.rotate(70) I could deal. But I can't expand methods by 7 or 8 different ones.
Can you design a robot instance by which I can access everything that's possible in Java?
Or can you show me a real simple C GUI for Lejos? (no gcc, and no eclipse, just C plus simple multithreading, nothing like nctOSEK)
Otherwise I'll have to wait for stack and heap and recursion by NXC...
mpscholz
Posts: 17
Joined: 29 Sep 2010, 09:32

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

Post by mpscholz »

gloomyandy wrote:Yes I can understand that. Unfortunately the leJOS classes are designed assuming an OO model
I can't see anything "unfortunate" in this.
doc-helmut wrote:I'd like to use LeJos, but without objects.
I'm afraid that you will neither get lucky with that nor achieve satisfying results, as it's like trying to use a plane without wings and motors or a computer without the electronics in it.
If you are not into OO, don't use an OO-based framework.

Better invest your valuable time in, say, NXC, when you want to do procedural stuff - in your case, what is the actual problem at hand that you can't solve with NXC?
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

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

Post by HaWe »

in your case, what is the actual problem at hand that you can't solve with NXC?
as I often wrote:
no stack, no heap, no pointers, no recursions, no dynamic memory allocation

with the underlying OOP part it's to me like when using C++: you may use the OO part, but you don't have to.
mpscholz
Posts: 17
Joined: 29 Sep 2010, 09:32

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

Post by mpscholz »

Doc,
doc-helmut wrote: no stack, no heap, no pointers, no recursions, no dynamic memory allocation
These seem to be no real NXT robotic problems to me but rather technical issues of a language architecture.
I'm yet to see a real-world NXT robot issue that can be solved with leJOS, but not with NXC.
doc-helmut wrote:
with the underlying OOP part it's to me like when using C++: you may use the OO part, but you don't have to.
Except for the fact that unlike to C++ (which technically was a wrapper around a C core, conceptually an OO extension to C), there is no noticeable non-OO part in Java (thus non in leJOS NXJ beyond the firmware access layer).
So just putting everything in one monster class will not help - you do not remove the object-orientated concept from an OO-based framework simply by reducing the API to just one class.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

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

Post by HaWe »

I need pointers, memalloc, recursion.

But maybe 1 Lejos monster class to bind them all would help ;)
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 »

Java has no pointers.
| 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 »

correct :oops:
(...again thinking in C categories...)
but I need them actually only for dynamic mem allocation - that's possible, isn't it?
aswin0
Posts: 201
Joined: 29 Sep 2010, 06:58

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

Post by aswin0 »

I really did not want to get involved in this discussion but.....

An advise first. Use your tools the way they are intended to. Otherwise you'll get frustrated ( in case of software tools) or hurt (in case of hardware tools).

.......If you really need recursion you can write your function in such a way that it mimics recursion. If you need dynamic memory you can do so by using arrays. If you needs stacks, again your solution is in using arrays.

Remember, programming is the art of finding solutions within the limited resources you have.
My blog: nxttime.wordpress.com
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

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

Post by HaWe »

If you really need recursion you can write your function in such a way that it mimics recursion.
...
Remember, programming is the art of finding solutions within the limited resources you have.
this is easily said and sounds a bit flashy.
It was not possible though I already tried it (e.g., in my chess program).
You may show me how to do it if you can, but anyway it's not the topic (please read the TO question closely again).
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: But maybe 1 Lejos monster class to bind them all would help ;)
Of course, you would have to write the code for this class, so you'd still have to figure out OO to some extent. IMHO, if you're going to do that, you may as well go the whole hog and learn how to use Java properly.

Matt
Locked

Who is online

Users browsing this forum: No registered users and 8 guests