Setting Waypoints

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

Setting Waypoints

Postby Katsarida » Tue May 28, 2013 7:32 pm

Hi everyone! An idea popped in my mind... I was thinking of making a program that opens a window, in which you draw a path with the mouse, and the NXT follows the same path on the floor...
Is it possible with the stock Lego Mindstorm NXT?
Katsarida
New User
 
Posts: 10
Joined: Sun Mar 04, 2012 9:27 am

Re: Setting Waypoints

Postby Katsarida » Wed Jul 17, 2013 9:27 am

OK.... so far I have managed to make a GUI where you can draw with the mouse. All the drawn pixels are stored in a vector.
The thing is i don't want the NXT to follow every single pixel, but skip a few. Can someone give me an idea on how to draw the new simplified shape with the skipped pixels?
Katsarida
New User
 
Posts: 10
Joined: Sun Mar 04, 2012 9:27 am

Re: Setting Waypoints

Postby skoehler » Wed Jul 17, 2013 9:58 am

Well, basically you have a path consisting of lots of waypoints (the pixels). And now you want to reduce the number of waypoints. Basically, what you can do is that you look at every 2nd waypoint and compute by how much it would deform the path if that waypoint was deleted. If the change is not too big, delete the waypoint. Apply this simple step to the path over and over again, until no waypoint is removed.
skoehler
leJOS Team Member
 
Posts: 1390
Joined: Thu Oct 30, 2008 4:54 pm

Re: Setting Waypoints

Postby Katsarida » Sun Sep 01, 2013 11:46 am

Thanks for the reply! It helped a lot! :)
Now I want to ask, for something else... I've created an array in which the data are the degrees that the wheel needs to turn in order
to move to the next waypoint. How can I transfer this whole array to the robot?... i'm using the USB cable for the transfer.
Katsarida
New User
 
Posts: 10
Joined: Sun Mar 04, 2012 9:27 am

Re: Setting Waypoints

Postby Katsarida » Mon Sep 09, 2013 4:13 pm

I think I've resolved my above post... now I would like to ask something else...
I want my robot to start moving when i clap my hands. Then it starts to follow the waypoints.
I want it to continuously check with the sonic sensor for objects in the path and when it finds one to stop and beep and to always check if I clap my hands again to stop.
Do i use more threads?
Katsarida
New User
 
Posts: 10
Joined: Sun Mar 04, 2012 9:27 am

Re: Setting Waypoints

Postby Katsarida » Fri Dec 27, 2013 4:37 pm

I think i'm done writing the code... the problem is I have multiple classes to upload to the brick.
When i go to the main class and click "Run As"->"Lejos NXT Program" it only upload the main one.

How can I upload the rest of them?

I've also tried right clicking on the whole project the go "Lejos NXT" but the upload is grayed out.
Please, I really need help.
Katsarida
New User
 
Posts: 10
Joined: Sun Mar 04, 2012 9:27 am

Re: Setting Waypoints

Postby gloomyandy » Fri Dec 27, 2013 4:57 pm

What do you mean you have multiple classes to upload? All of your classes will normally be linked into a single program and the entire program will then be uploaded and run. Do you have more than one main method, why?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3892
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Setting Waypoints

Postby Katsarida » Fri Dec 27, 2013 5:02 pm

No no, I have just one main...
Do you mean the classes "merge" into one and are uploaded?
Is this why I can only see the main class when I browse the files in the NXT?
Katsarida
New User
 
Posts: 10
Joined: Sun Mar 04, 2012 9:27 am

Re: Setting Waypoints

Postby gloomyandy » Fri Dec 27, 2013 5:25 pm

If the classes are reachable from your main class then they will be linked together into a single .nxj file which is the thing that is executed on the NXT. This is all explained in the leJOS tutorial, see the section on the linker:
http://www.lejos.org/nxt/nxj/tutorial/P ... rogram.htm
http://www.lejos.org/nxt/nxj/tutorial/P ... dRun.htm#3
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3892
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Setting Waypoints

Postby Katsarida » Fri Dec 27, 2013 5:51 pm

Thank you for your answers and being so informative :D
Katsarida
New User
 
Posts: 10
Joined: Sun Mar 04, 2012 9:27 am

Re: Setting Waypoints

Postby Katsarida » Tue Jan 21, 2014 4:46 pm

I have encountered yet another problem...
The program basically sends the waypoints to the NXT brick via USB and that works great from inside the Eclipse...
Although, when i export a runnable jar file and run it, it seems that it is not sending the waypoints... The NXT says it is waiting
for USB, but it is connected!
I know the problem is not in the code because, as I mentioned it works from within the eclipse.
Katsarida
New User
 
Posts: 10
Joined: Sun Mar 04, 2012 9:27 am


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff