View unanswered posts | View active topics It is currently Sun Jun 24, 2018 2:36 pm






Reply to topic  [ 10 posts ] 
Sample Code for Virtual World Search & Rescue Challenge? 
Author Message
Rookie

Joined: Fri Dec 04, 2015 4:07 am
Posts: 5
Post Sample Code for Virtual World Search & Rescue Challenge?
Can anyone send/show me a sample code on how to complete Virtual World Search & Rescue Challenge? thank you


Fri Dec 04, 2015 4:12 am
Profile
Rookie

Joined: Fri Dec 04, 2015 4:07 am
Posts: 5
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
can anyone give me a hint on how to proceed to each room?


Sat Dec 05, 2015 7:40 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Jun 11, 2014 9:59 am
Posts: 115
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
Hi Paulgan13,

The first thing that I would do is solve each room individually. I would use the practice tables to create programs that solve each room. Then I would then try to find ways to differentiate each room from each other. Once I was able to figure out which room I was in, I would combine my code that I wrote for each room into the respective sections. I hope this helps you get started on this challenge. If you have anymore questions please let me know.

Thanks, Lee


Mon Dec 07, 2015 10:32 am
Profile
Rookie

Joined: Fri Dec 04, 2015 4:07 am
Posts: 5
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
i have managed to differentiate the room through different sensors but cant seem to figure out how to combine my code to make it work as one


Mon Dec 07, 2015 10:35 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Jun 11, 2014 9:59 am
Posts: 115
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
Using pseudo code is a great way to visualize your program. Write out each step of your program. Then turn those steps into a program using the library of commands.

Hint* There are four different rooms. This means you will have to check what room you are in four times.

Please post your pseudo code (steps of your program) and I will be happy to help you a long the way.

Lee


Mon Dec 07, 2015 1:30 pm
Profile
Rookie

Joined: Fri Dec 04, 2015 4:07 am
Posts: 5
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
PSEUDOCODE for SEARCH and RESCUE ROOM

OBSTACLE ROOM
- IF the distance value sensor is = 174
- turn left (90 degrees) 0.72 rotation
- forward 3.4 rotations (68cm)
- turn right (90 degrees) 0.72 rotation
- forward 3 rotations (60cm)
- turn left (90 degrees) 0.72 rotation
- forward at 1 rotation at 20cm

SURVIVOR ROOM
- REPEAT UNTIL left motor encoder = or > 3600
- IF distance value sensor = 451
- stop all motors
- forward 2 rotations at 60cm
- move claw motor 1 second at 50 power to grasp
- wait 1 second
- move arm motor 2 rotation to bring it up
- move claw motor 1 second at - 50 power to release survivor
- move arm motor 2 rotation at - 50 power to bring arm down back to normal position
- forward 1 rotation at 20 cm
- turn left at (90 degrees) at 0.73 rotation
- move forward at 5 rotations at 100 cm
- ELSE set multiple motors left and right at 50 power

FIRE ROOM
- REPEAT UNTIL left motor encoder = or > 3600
- IF color grayscale = or > 190 (which is the yellow color patch on the floor) using line tracking to detect
- stop all motors
- wait 7 seconds for fire to turn off
- forward 1 rotation at 20cm
- turn left at (90 degrees) at 0.72 rotation
- forward 50 rotations at 100cm
- ELSE set multiple motors left and right at 50 power

LED ROOM
- REPEAT UNTIL left motor encoder = or > 3600
- IF distance value sensor = 809
- stop all motors
- wait 1 seconds
- turn on LED touchled (Orange)
- turn left at (90 degrees) at 0.72 rotation
- forward 50 rotations at 100cm
- ELSE set multiple motors left and right at 50 power

heres my pseudocode for each room. then problem im having is getting the program to flow together and making in flow from one room to another room


Tue Dec 08, 2015 10:38 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Jun 11, 2014 9:59 am
Posts: 115
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
I see that you are using your distance sensor which is great. Try getting a reading from the beginning of each room. Lets say the first room is the obstacle room. Your robot starts right in front of the room. The goal is to pass through the room and end up in the same spot relative to the new room. That way you can use your sensors to decide what room you are in.

For example...
Suppose: (not actual values)
-your robot's sonar sensor reads 180 at the beginning of the obstacle room
-your robot's sonar sensor reads 205 at the beginning of the survivor room
-your robot's sonar sensor reads 400 at the beginning of the LED and Fire Room

You could set your program up like this.
Code:
If sonar is less than 190
{
   I know I am in the obstacle room
}
else 
{
   it is greater than 190 so I am in the survivor room, fire room, or the LED room

 If (sonar is less than 300)
 {
   I know I am in the Survivor room.
  }
  else
  {
    I am in the LED or Fire Room.
    Since the sonar is the same for both of these rooms we will have to use a different sensor...
    if(some condition that is in the fire room but not in the LED room
    {
        I am in the fire room.
     }
    else
     {
        I am in the LED Room.
      }
  }
}


-Lee


Thu Dec 10, 2015 9:35 am
Profile
Rookie

Joined: Mon Dec 14, 2015 3:44 am
Posts: 1
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
I personally support lcarrozza ideas and thoughts and I totally agree with him.

_________________
Graduated from Soran University with First Class Degree with Honours in Computer Science.


Mon Dec 14, 2015 3:47 am
Profile
Rookie

Joined: Wed Jun 15, 2016 1:52 pm
Posts: 1
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
paulgan13,


Were you ever able to figure this out? I am currently working on this one as well and am struggling in the same area. I have solved all 4 rooms individually, but cannot figure out how to combine all of them so that it can decipher the rooms at random. If you figured it out, what did you come up with?


Wed Jun 15, 2016 1:58 pm
Profile
Rookie

Joined: Thu Feb 18, 2016 11:01 am
Posts: 5
Post Re: Sample Code for Virtual World Search & Rescue Challenge?
I'd definitely check out lcarrozza's post above, it's a pretty great pseudocode visualization of the problem.

You'd just run that series of if/else statements 4 times, and the run should work!


Wed Jun 15, 2016 3:30 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.