View unanswered posts | View active topics It is currently Sat Aug 23, 2014 10:05 am






Reply to topic  [ 2 posts ] 
Sentry Simulation 2 Has a ghost wall after obstacle is moved 
Author Message
Rookie

Joined: Tue May 07, 2013 9:11 pm
Posts: 1
Post Sentry Simulation 2 Has a ghost wall after obstacle is moved
Sentry Simulation 2 Has a ghost wall after obstacle is moved?! If you watch the sonic sensor readings the sensor goes to -1 sometime after 1st object is moved and immediately after the 2nd object (after first turn). This makes it difficult to use the sonic sensor to find the next object?! Is this a special challenge?! for the Sensing Mastery Badge?

I will continue to come up with a creative solution (timer, encoder, etc.), however my Girl Scout team members (new to RobotC) will have a real problem trying to use the sonic sensor to complete this mission with this glitch.

Thanks,
Rich Morgan
http://gsjsrobotics.wordpress.com/


Tue May 07, 2013 9:24 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 405
Post Re: Sentry Simulation 2 Has a ghost wall after obstacle is m
Hi Rich,

The "-1" that you're seeing isn't the result of an invisible barrier/ghost wall. The sonar sensor returns a value of -1 when it does not detect anything in it's field of vision.

On the "long" sides of the Sentry challenge, the sonar sensor picks up the side wall, since the sonar sensor has a field of view that widens as it goes out:
Image

On the short side, the sensor doesn't pick up the wall, or anything else once the obstacle is gone, so it gets a value of -1. You can account for this in your code. For example, this program moves forward as long as the sonar sensor doesn't detect an object within 20 cm, or has a value of -1:

Code:
task main()
{
   wait1Msec(2000);                  // Robot waits for 2000 milliseconds before executing program

   while(SensorValue(sonarSensor) > 20  || SensorValue(sonarSensor) == -1)      // Loop while robot's Ultrasonic sensor is further than 20 inches away from an object
   {                                                                         // || (or) it is '-1'.  (-1 is the value returned when nothing is in it's visable range)
      motor[rightMotor] = 50;         // Motor on motorB is run at half (50) power forward
      motor[leftMotor]  = 50;         // Motor on motorC is run at half (50) power forward
   }

}

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Wed May 08, 2013 12:18 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.