Chasing Light
Download the Chase Light robofile.
- First double click on the Surveyor_SRV1b module in the processing pipeline. It may
take a while to appear since it will immediately try to connect to the default SRV setting at 192.168.1.15. When it does appear change the IP address
to the one you are using. If you do not know the IP address of the robot you will have to check your router information
or see the Surveyor forum
for more information.
If you have already configured the SRV in a previous robofile then the IP address should already be configured for your robot assuming the "Remember as default" in the SRV GUI interface is set.
- Once you get the right IP address you should see the image from the SRV in the main RoboRealm GUI and the
robot starting to react to light and dark lighting. Try using just a single light in your darkened room to see
if the SRV heads towards that light.
- We do this by first cropping the image to ignore lights on the ceiling using the Crop module.
- Then we remove pixels that are not very bright using the RGB_Filter module.
- Since small blobs are not very good indicators of where light is we remove them from the image using the Blob Size module.
- Now we want to know the center of gravity of the remaining light blobs which is a good indication of where we should head in order to get into the light. We
do this using the Center of Gravity module.
-
Finally we now need to tell the SRV how to move in order to get to the identified point. We do this by
understanding on what side of the image the identified target is. In our case it is on the right side.
If the desired target point is right of the center of the
image we need to move the robot right, whilst if it is on the left we need to move left. If we create this
behavior the robot will move in the direction of the light. The VBscript
module allows us to write some VBScript to scale the motor values of the SRV based on the X coordinate of the target
point. The more the X location is to the right the faster the LEFT wheel should turn and the slower the RIGHT one
should turn and vice versa for the other side. The VBScript module produces a left_motor and right_motor
variable that contains the suggested values that the SRV should perform. The SRV module then grabs those values
and passes them onto the SRV to complete the cycle.