A Little Help For Exchanging Messages

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

A Little Help For Exchanging Messages

Postby win1for » Tue Mar 16, 2010 10:00 pm

Hello Everybody,

I want to thank you all for all your replies to my previous messages. I am developing a simulation application to visualize the activities of real bots (Mindtorms robots) in a warehouse.

I will send a list of commands from the GUI to the robot so that it can execute them one after the other.

This is what i want:
Any time the robot is about to execute each command, i want it to send a message to the GUI so that the GUI can update itself that the command is executing.

After it finishes executing the command, it must also send a message to the GUI that it has finished executing that command.

The commands which will be send to the robot can include :
moving pallets, moving from a position to another etc...

1)
I am asking if someone can help me how to go about it. How can i make the robot send a message to the GUI before and after executing each command in the list.

2)
Is there a data structure in Lejos like ArrayList or Vectors that i can fill it with commands and send them to the robot through the Data input and output streams? I learnt the input and output streams accepts only ints,floats and string types and no other objects.
If there isn't any data structure like that, how can i send a bulk of commands to the robot at the same time so that it can execute them one
after the other.


Thanks for your help.
win1for
Novice
 
Posts: 48
Joined: Tue Mar 02, 2010 11:22 pm

Postby ChrisB01 » Wed Mar 17, 2010 2:58 pm

If I was going to build a simulator for robots in a warehouse I would start off by building an API (application programing interface). The api would be the interface your GUI (graphical user interface) uses as a frontend to the simulator. An example of an API is Lejos, Lejos is an API for the nxt.

I assume you are programming in java. If so you could have all the robots in the warehouse represented by java objects with navigator objects build in. This means you could do something like this:

Code: Select all
Robot robot1 = new Robot();
robot1.forward();
robot1.pickUpPallet();


You would then build the java gui that would use this api to manage the simulator.

Building a simulator will not be easy, but don't let that put you off! Break your programming and problems down to make the code easy to manage and develop. Also try to use polymorphism/object orientated programming, this will allow you to take full advantage of java.

Good luck,

Chris
ChrisB01
Advanced Member
 
Posts: 189
Joined: Sat Mar 15, 2008 12:19 pm
Location: UK

Postby win1for » Wed Mar 17, 2010 8:46 pm

Thanks for your reply but the question is not answered.

I want the robot to send a message to the GUI before and after executing each command.

In your example, i want the robot to send a message (for eg: "command is about to be executed") to the GUI before the "robot1.forward();" command is called and another message(for eg: "command is executed") after it has finished executing the command.

The same applies to "robot1.pickUpPallet();"

For instance:

//Here comes the code to send the message to the GUI before command
"robot1.forward();"
//Here comes the code to send the message to the GUI after execution

The same applies to all commands.

I want the robot to send a message to GUI before and after executing each command so that the GUI will know when the command is executing and after it is executed.

The second second in my first post in this thread is also important if someone can help me out.

Thank you all.[/code]
win1for
Novice
 
Posts: 48
Joined: Tue Mar 02, 2010 11:22 pm

Postby roger » Fri Mar 26, 2010 8:55 pm

Have you studied RCNavigator in samples and RCNavigationControl in pcsmaples? These programs exchange data and commands between a robot and a GUI.
roger
Moderator
 
Posts: 368
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron
more stuff