Now that my teams are finished with skyrise, I was starting to play with and figure out the advanced sensors. One such sensor is the light sensor. I was programming the robot the robot to look for a light and then move towards it. The servo does as instructed but all the robot does is go in circles. Can anybody help? I saw a similar code online that said it would work.
Is Servo 4 a drive chassis motor or some sort of sensor positioning motor or…?
Is your left light sensor and right light sensor supposed to have their light values read from the same analog input? It looks to me like they might be reading light from the same direction (if motor 4 is some kind of sensor positioning device EDIT: sorry, on second thought, maybe this is how the SetServo command works. Probably I should keep my mouth shut since I was thinking this was RobotC. ).
The servo is what moves the light sensor around a shaft. The left and right light sensors are the points the servo is pointed. I am using the “light sensor.” I am using easyC, we are currently ordering robotC.
I think I found the problem, I believe I have the sensor in a digital port. I’ll try switching it and see if it works. I’ll also post a picture ASAP.
Did you get it working or does it still move in circles? I’ve never used the light sensor but I’m guessing you need to adjust some sort of detection threshold somewhere and/or perform your tests in a fairly dark room, otherwise it will trigger on all sorts of light sources or reflective objects in the room.
As-is, it does not appear to me to have any kind of directional discrimination. In other words, the sensor is just a flat CdS cell that can accept light from a very wide angle. Would it help to put a tube over the sensor, perhaps a paper tube whose insides have been painted with a matte (non-shiny) black?
Ah yes, in a firefighting robot, someone did exactly this a few years ago (90C Cyclops I believe). They took an old 35mm film tube (we may have to explain those old relics) and cut a sliver on the end there to let in minimal light. This made it much more directional to know where the candle was in the room.
It does go in circles with the code that I posted so that may be the problem, though would adding a film tube to a competition robot be illegal because it may be considered a functional decoration that is not an official VEX part or the equivalent of??
I’m not an official, but a film tube would almost certainly be illegal. However, the rules would not prevent you from making the equivalent tube from some C-channel, black foam, black spacers, shaft collars, or whatever else you can find to fashion a tube-like shape. You are also allowed to use a certain amount of sheet plastic to cut into any shape you want.