ROBOTC.net forums
http://www.robotc.net/forums/

Sample Code for Virtual World Search & Rescue Challenge?
http://www.robotc.net/forums/viewtopic.php?f=55&t=12709
Page 1 of 1

Author:  paulgan13 [ Fri Dec 04, 2015 4:12 am ]
Post subject:  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

Author:  paulgan13 [ Sat Dec 05, 2015 7:40 am ]
Post subject:  Re: Sample Code for Virtual World Search & Rescue Challenge?

can anyone give me a hint on how to proceed to each room?

Author:  lcarrozza [ Mon Dec 07, 2015 10:32 am ]
Post subject:  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

Author:  paulgan13 [ Mon Dec 07, 2015 10:35 am ]
Post subject:  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

Author:  lcarrozza [ Mon Dec 07, 2015 1:30 pm ]
Post subject:  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

Author:  paulgan13 [ Tue Dec 08, 2015 10:38 pm ]
Post subject:  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

Author:  lcarrozza [ Thu Dec 10, 2015 9:35 am ]
Post subject:  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

Author:  sarwanov [ Mon Dec 14, 2015 3:47 am ]
Post subject:  Re: Sample Code for Virtual World Search & Rescue Challenge?

I personally support lcarrozza ideas and thoughts and I totally agree with him.

Author:  mrzurbach [ Wed Jun 15, 2016 1:58 pm ]
Post subject:  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?

Author:  Bill_Gruss [ Wed Jun 15, 2016 3:30 pm ]
Post subject:  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!

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/