Author |
Message |
paulgan13
Rookie
Joined: Fri Dec 04, 2015 4:07 am Posts: 5
|
 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 |
|
 |
paulgan13
Rookie
Joined: Fri Dec 04, 2015 4:07 am Posts: 5
|
 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 |
|
 |
lcarrozza
Site Admin
Joined: Wed Jun 11, 2014 9:59 am Posts: 115
|
 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 |
|
 |
paulgan13
Rookie
Joined: Fri Dec 04, 2015 4:07 am Posts: 5
|
 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 |
|
 |
lcarrozza
Site Admin
Joined: Wed Jun 11, 2014 9:59 am Posts: 115
|
 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 |
|
 |
paulgan13
Rookie
Joined: Fri Dec 04, 2015 4:07 am Posts: 5
|
 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 |
|
 |
lcarrozza
Site Admin
Joined: Wed Jun 11, 2014 9:59 am Posts: 115
|
 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. -Lee
|
Thu Dec 10, 2015 9:35 am |
|
 |
sarwanov
Rookie
Joined: Mon Dec 14, 2015 3:44 am Posts: 1
|
 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 |
|
 |
mrzurbach
Rookie
Joined: Wed Jun 15, 2016 1:52 pm Posts: 1
|
 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 |
|
 |
Bill_Gruss
Rookie
Joined: Thu Feb 18, 2016 11:01 am Posts: 5
|
 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 |
|
|