SoccerBOT - no clue how to start, Help PLZ ??

Post your NXJ projects, project ideas, etc here!

Moderators: roger, 99jonathan, imaqine

SoccerBOT - no clue how to start, Help PLZ ??

Postby Mikee_ITguy » Sat Aug 25, 2012 1:03 pm

Hello everybody,
I am completely new to the NXT programming and using and I need to make a robots for my project in school ... which play soccer ...

What I have:
several sets of Mindstorms Education, Infra seeker sensors, Infra ball, color sensors and I plan to make a football field with several colorfull lines that the robots would track to get to the oposite goal.

What I did:
So I Built a robot with 2 wheels and 3rd motor to rotate hand that either grabs or shoots ball, touch sensor to know when to hold the ball, Infra seeker to know where is the ball and Ultrasonic to know if there is obstacle on the way or not (enemy robot) and color sensor to folow the lines.

What I don't know and need help with:
At the beginning I don't really know how to navigate on the field with my grid of colorfull lines, the original idea was that the robot would simply folow lines and if he detects enemy in front he would change the direction, but I have no clue how to start writing that program.
What do you think is the best way to start / some articles to read / examples to play with (there is way to many of them on internet to go through all of them).

Thanks for any hints given,
Mike
Mikee_ITguy
New User
 
Posts: 12
Joined: Sat Aug 25, 2012 12:50 pm

Re: SoccerBOT - no clue how to start, Help PLZ ??

Postby Aswin » Sat Aug 25, 2012 11:36 pm

I think the best way is to break this down into several smaller problems. Then take the problem that you find easiest and solve this, then go to the next and so on. Once you have this you combine all your title solutions into behavior (what to do and when to do it). And then win the match and tell us. Or ask for help when you are stuck.
My NXT blog: http://nxttime.wordpress.com/
Aswin
Active User
 
Posts: 126
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: SoccerBOT - no clue how to start, Help PLZ ??

Postby Mikee_ITguy » Sat Nov 03, 2012 5:38 pm

Hello everyone,
About my soccer game - it will be more of fussball (table soccer) game in the end, where there will be 4 robots in 2 teams, each team will have master and slave robot (lets say masters attack enemy, slaves defend the net) and the field will be devided to 4 quarters where there will be only one robot, between which I will paint black lines which they will not be allowed to cross.

To navigate robots in their quarters I plan to use HT color sensors and I will make a colorful grid and update the position of the robot depending on the line it crosses.

Now my question about that is How exactly do I use OdometryPose or better still, can I update the position based on the line I cross ? So lets say I remember last vertical and last horizontal color I crossed, now I cross a new one, so I call a behavior which should update the position (coz I know now where I am on map) and based on that set a waypoint ...
Do you know some nice article/example about that ? I tried to understand the samples and documentation on the internet but I got a little lost whether waypoints are relative or absolute and Position can be updated ... does anybody know?

When I am sending some data on BT, can I put some identifiers or does it send just raw data ? What I mean - I will need to send few variables, then I will need to send the position and get received ok confirmation, how exactly should I do that?
Coz if I do just this:
Code: Select all
      boolean received = false;
         // send that it is not in my part, receive confirmation
         while (received == false){
         try {
            //send yourHalf value
            dos.writeBoolean(true);
            dos.flush();         
         } catch (IOException ioe) {         //in case of problems
            LCD.drawString("Write Exception", 0, 0);
            LCD.refresh();
         }
         try {
            received =dis.readBoolean() ;
            
         } catch (IOException ioe) {      //if received then Ok
            LCD.drawString("Read Exception ", 0, 0);
            LCD.refresh();
         }

It will only send 1 true and catch confirmation that it was sent ...then again I will be waiting until I get this confirmation ... is there some more elegant way through daemons ?? can I put some identifier to the "true" I sent ? how ?
Can I just send BT value and hope the other robot catches it or do I need to run a BT listener before on the other end?

Thanks for answers,
Mike
Mikee_ITguy
New User
 
Posts: 12
Joined: Sat Aug 25, 2012 12:50 pm

Re: SoccerBOT - no clue how to start, Help PLZ ??

Postby Mikee_ITguy » Sun Nov 04, 2012 3:32 pm

Also I would like to ask how to correctly use and update the OdometryPoseProvider
I have color sensor and map with color lines and I would like to update the position when bot crosses a line, what I am trying to write is something like this:

Code: Select all
public boolean takeControl()
  {
    return color.getColorID()!=6;   //6 should be white ... so when not on white i.e. on line
  }
public void action(){
     Point front = new Point(30, 0);
     int currentLine = color.getColorID();
     Point RedCrossingFront = new Point(20,0);
     Point RedCrossingBack = new Point(-20,0);
    
     if (currentLine == 0){
        //update horizontal position
          if( position.getPose().angleTo(front) < 40){;
          position.setPose(RedCrossingFront);
          } // going forward
         
          if( position.getPose().angleTo(front) > 120){;
          position.setPose(RedCrossingBack);         
          } // backwards



But this is wrong according to Eclypse, could anybody help me how to correct it ? or give me link to some examples / texts how to do this?
Mikee_ITguy
New User
 
Posts: 12
Joined: Sat Aug 25, 2012 12:50 pm

Re: SoccerBOT - no clue how to start, Help PLZ ??

Postby Mikee_ITguy » Sat Dec 22, 2012 11:18 pm

It is finally coming all together, now with Christmas I should have time to finish it.

So the working code should be coming after new year if anyone is interested.
Mikee_ITguy
New User
 
Posts: 12
Joined: Sat Aug 25, 2012 12:50 pm


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff