Re: ROBOTC Sensing Obstacle Course
There were a couple of problems with the program that I saw.
The first problem (and the biggest) was that you had assigned the Light sensor to port two. The problem with this is that the second port in the Virtual Worlds curriculum is reserved for the Compass sensor. Running the program as-is, you can see that the value of the sensor flips between 0 and 360 (which is a good indication of the problem). To resolve this, go into the Motors and Sensors Setup window and select the 'Virtual Worlds NXT' bot from the Standard Models tab. This will automatically configure the robot for the Virtual Worlds environment.
The second, smaller issue is that the line tracking is using a zero value for the 'pivot' wheel. While this will work, you may notice that the robot moves through the line tracking segment very slowly. This is because the robot will literally pivot from side to side to follow the line; it will appear to be 'shuddering' down the line. To solve this, you can simply increase the zero value to a value that moves the motor but is still less than the other motor (for example, instead of using 80 and 0 for motor values, try using 80 and 30). You can increase this number as for a faster line tracking program, but be forewarned; by increasing the speed too much, you run the risk of losing the line on a curve (the sharper the curve, the more likely it is to lose the line).
Two ways to avoid this is to either decrease the motor speeds or increase the gap between the motor speeds. For this application though, 80 and 30 appeared to work quite well.
As a side note; you may have noticed the robot sliding a bit between maneuvers. This is because the robot's motors and wheels are going from full speed (or near to full speed) in one direction to full speed in another direction. To alleviate this, a short stop command between motions will stop the motor and decrease the amount of 'slide'.
Check out our Blog
! And our Facebook page
Need help? Take a look at our updated help documentation
and the ROBOTC Forums.