Download the Chase Movement 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.
- Once the SRV is connected you should see the SRV camera image in the main RoboRealm interface. Try placing the
robot down on the floor away from any movement. It should remain still. Then try to move something in the right
or left view of the SRV and see if it moves towards that movement.
- To detect movement we need two images; the current image and a previous image.
Seen here are the two images merged together to give you an idea of what the actual object movement is between the
two sample images.
- We can refer to those two images using the Movement module which will determine the
difference between the current image and the previous image in order to determine those pixels that
have changed. For example, given two images the movement detected appears as white blobs.
This works well, however, an issue happens when the robot is also moving as the entire scene will change from one image to another. This will incorrectly indicate that the entire image has moved instead of just identifying the independent movement within the image. To compensate for this issue we ensure that the "Reduce global movement" checkbox in the Movement module is selected. When selected this will attempt to globally align the current image with the past image such that the overall image movement is eliminated or reduced while the independent movement remains pronounced. Note that some texture in the image needs to be visible in order for this alignment process to work.
- Once the pixels that have changed between the
current image and a previous one have been detected we need to chose a point to target for the robot. An easy point is to
choose is the Center of Gravity or middle point of the blob. 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 targeted movement is in. In our case it is slightly 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 movement. 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.