Vision System problem

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

Vision System problem

Postby kevinn » Sat May 14, 2011 10:47 am

Hi there,

For my bachelor project i'm developing a vision system for the mindstorm robots. The system provides more information for the robots. There will be a camera hanging over the playfield of the robots. With a tracking algorithm i can follow the robots and get their positions. This works so far.
But now the thing is that I need to send this information to the robots through bluetooth so they can do things with the information, like avoiding incoming robots or go to another robot. The vision system is implemented in c++ so i would like to send the data from there via bluetooth to the robots.

What i already managed to do is to send commands to the robot to let him go forward or to turn without running a .java program on the robot. But i don't want to send commands but i need to send data. So there must be a java program running on the robot who receives the data . I started with the basic BTReceive.java sample but i always crashes when i send something from the pc.
The robot throws this error:
Code: Select all
Java Exceptioin:
Class: 65
Method: 117
PC: 8871



Can you guys help me with this or point me in the right direction please?
kevinn
New User
 
Posts: 2
Joined: Sat May 14, 2011 8:14 am

Re: Vision System problem

Postby gloomyandy » Sat May 14, 2011 11:09 am

If you want to understand how to decode the exception take a look here:
viewtopic.php?f=7&t=236
If you want more specific help then you probably need to tell us a little more about what it is you are doing, what programs you are using on the PC side, what data it is you are sending, how you have created the connection, what data you want to send etc...

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

Re: Vision System problem

Postby kevinn » Sat May 14, 2011 12:40 pm

the "data" i want to send to the robot are just integers.
Right after i posted here i read something about putting the waitForConnection in RAW mode. I tried it and i think i was able to create a connection. this i what i've put on the robot:
Code: Select all
String connected = "Connected";
        String waiting = "Waiting...";
        String closing = "Closing...";
        LCD.drawString(waiting,0,0);
   LCD.refresh();

      BTConnection btc = Bluetooth.waitForConnection(0, NXTConnection.RAW);
          
   LCD.clear();
   LCD.drawString(connected,0,0);
   LCD.refresh();   

   LCD.clear();
   LCD.drawString(closing,0,0);
   LCD.refresh();
   btc.close();
   LCD.clear();


I started the program and it started waiting. Then i ran the c++ program to make a connection. After two seconds "Waiting..." disappeared from the screen and it showed "connected". And then i came back on the main lejos menu. So i think i made a succesfull connection otherwise the waitForConnection would wait forever on a connection. The next step is to transmit data, i will try this now.

BTW does anybody know if I should send the data using Big Endian of little endian? i don't know what format lejos uses?

EDIT: On the pc side I use lestat 0.2
kevinn
New User
 
Posts: 2
Joined: Sat May 14, 2011 8:14 am

Re: Vision System problem

Postby gloomyandy » Sat May 14, 2011 1:41 pm

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


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron
more stuff