Screenshots     Download     Pricing     Docs     Tutorials     Resources     Contact     Forum     Search  

Surveyor SRV-1 Maze

The Surveyor SRV-1 is a great platform for experimenting in machine vision. With the wireless communication and built in camera the SRV-1 is a natural choice for machine vision processing using a PC.

In this tutorial we experiment with the wall avoidance capabilities that can be performed using RoboRealm and the SRV-1. In particular we have a look at how the SRV-1 operates within a confined location surrounded by walls. The environment has been re-purposed from a Trinity FireFighting Maze to show how the SRV-1 can operate within that environment.

Surveyor SRV-1

First left us have a look at our simple environment ...

Example Room

Example Maze Room

Nothing special here. This is basically a pentagon type of room with a sharp corner in the far end of the room. The floor is a painted black metallic sheet while the walls are cut polystyrene insulform with magnets clued to the bottom to provide support. This environment is idea for testing robots as the walls will fall or bend with enough pressure and therefore do not harm uncontrolled robots.

The purpose is to have the SRV-1 roam around within this room while avoiding the walls. We first experimented with the built in "wander mode" of the SRV-1. This mode works fine in a spacious environment but simply keeps rotating on spot within this small room.

Part of the problem is that the camera on the SRV-1 is angled slightly up and therefore not much of the floor becomes visible. Due to the lack of visible floor we then decided to use the IR capabilities of the SRV-1 instead of vision.

The IR works nicely within its designed space requirements in a living room but are set too bright for our maze room. Turning on the IR and setting the robot within the room would completely saturate the entire room (all walls are bright white) with IR light and cause all readings to be at their maximum. Therefore IR was just not going to work either!

Back to vision ...

Camera View

If the robot is placed in one end of the room facing the other we get an image like

Far Room View

This view is from the robot looking towards the sharp corner as seen in the following overview image.

Rooftop View

The robot view is a nice image but as the machine approaches the wall the black floor quickly disappears. To remedy this issue we need to tilt the camera down a little to see more floor. The SRV-1 camera is attached to the robot using double sided sticky tape. You can carefully un-stick part of the camera and simply prop it downwards to reveal more of the floor. This simple movement of the camera now allows us to see enough floor to be usable within our maze room.

Another possibility is to bend the aluminum bracket that holds the camera downwards a bit. There is enough room under the bracket to change the angle between 10-15 degrees which should be plenty. From the Surveyor folks themselves: "The only caveat is to make certain that there's no contact between the bracket and the front of the battery."

Far Room Adjusted View

The robot is in the same position. Compare with first image above. Notice the floor space has substantially increased. This is the modification we used:

Camera Original

Camera Tilted

A subtle change but now that we can see the floor we can detect the boundary between the floor and the wall using vision.

Onto the Wall Detector ...

Wall Detection

The intensity difference between the floor and the wall is easily determined by the Wall Finder module. This module will place a red stripe where it seems a maximum change from the bottom of the image towards the top. This is not unlike the built in capabilities of the SRV-1 used in the wander mode.

Running this module on the image reveals

Processed Far Room View

where we can nicely see the red line separating the floor and the wall. When this module runs it produces a couple of variables that help describe the line seen in the image.


In particular we are interested in the LOWEST_WALL_Y and WALL_SLOPE variables. The LOWEST_WALL_Y indicates the lowest point of the detected boundary and effectively indicates how close the robot is to the wall. The WALL_SLOPE variable provides an estimate of the slope of the detected line and can be used to determine the angle of approach of the robot to the wall.

Using these variables it is now possible to create a script to navigate the robot around our room.

Onto some VBScript scripting ...

VBScripting the SRV-1

Using the variables provide by the Wall Finder module we can create the following VBScript that will map the wall variables to motor values that are then send to the SRV-1.

We would like to turn the robot away from the wall using the most efficient angle. Always turning in one direction would cause the robot to turn into the wall in many of the wall collision cases. In other words, if the robot approaches a wall like this

Turn Left

the robot should rotate to the left instead of the right. This can be accomplished by checking the sign of the WALL_SLOPE variable (-16 for the above image). If it is negative turn right, otherwise turn left.

However, there is an interesting problem using this technique when approaching a sharp angle corner (like the one at the tip of the room). The problem is that when the robot approaches the corner from one side it will use the WALL_SLOPE to turn the other direction. Once this is done the robot re-samples what it seems and determines that the WALL_SLOPE has now switched signs and therefore will move in the opposite direction to what it just did. Thus the robot is stuck in an oscillation between left and right movements.

To prevent this oscillation from happening we need to bias the rotational movement until we determine that it is safe to resample the WALL_SLOPE for a potentially new rotational direction. We do this by setting a "turn_bias" variable that once set will ensure the robot only rotates in that direction. This variable is then reset when the robot proceeds forward for a least three or more steps. This reset will only occur when the robot has decided that it is safe to move forward and can then resample the slope once again when approaching another wall.

The following VBScript is used within the VBScript module

' check if we are near a wall
if GetVariable("LOWEST_WALL_Y") < 10 then

' if we need to turn check the 
  ' turn bias to make sure that
  ' if we have already turned that
  ' we continue to turn in the same
  ' direction
turnBias GetStrVariable("turn_bias")
if turnBias "right" then
SetVariable "left_motor"95
SetVariable "right_motor"165
elseif turnBias "left" then
SetVariable "left_motor"165
SetVariable "right_motor"95
' otherwise check the wall slope to determine
  ' the best direction to turn
elseif GetVariable("WALL_SLOPE")  < 0.then
SetVariable "left_motor"95
SetVariable "right_motor"165
' don't forget to bias successive
    ' turns in the same direction
SetVariable "turn_bias""right"
SetVariable "left_motor"165
SetVariable "right_motor"95
SetVariable "turn_bias""left"
end if

' increment the forward counter
forwardCount GetVariable("forward_count")
"forward_count", forwardCount+1
' if we have moved forward for 3+ steps reset
  ' the turning bias
if forwardCount > then
SetVariable "turn_bias"""
end if
' move the robot forward
SetVariable "left_motor"150
SetVariable "right_motor"150
end if

Lets see it in action!

Surveyor SRV-1 Room Video

(3.6 MB) Video of the SRV-1 from an overview perspective as it roams around the room.

(338 KB) Video of what the robot sees while navigating around the maze. It is very jumpy since the video stops streaming during the motor moves which are very noticeable when turning.


It is worth pointing out some of the failures that we experienced during the creating of this tutorial. As one can learn much from mistakes we chose to share some of the issues.

1. The video image size for processing is 80x64. While this is sufficient for wall avoidance a higher frame rate would be desired in order to increase the speed of the robot. We achieved about 4 fps while running the robot within the room. The wireless transmission does add in some delays which can causes the robot "blindspots" during a move. With increased wireless speed the robot would receive more frequent updates from the PC and thus could move in a more reliable and faster way.

2. There are still times that the robot can become stuck within the room. Since we are using a black painted metallic floor (to ensure the wall magnets stick) the robot has a tendency to slip when rotating. This slippage can cause the robot to unintentionally backup into a wall if it is close to it while turning.

3. We did not factor in any noise suppression for the wall detection. Adding a mean or gaussian filter would soften the image and provide a less noisy line detection. This would allow the robot to more confidently approach a wall without turning too soon.

Your turn ...

Want to try this yourself?  Download the Surveyor Maze robofile to run the example yourself. Clicking on any of the modules will bring up that module's interface and allow you to customize it for your needs.


We are extremely happy with the Surveyor SRV-1. It is a nicely built platform that is just fun to work with largely due to its small size. The battery lasts longer than most of the other vision platforms we have experimented with. The small size and weight allows us to experiment with it in confined environments so setup is quicker and less costly. The form factor also allows us to check motor and sensor values while actually holding the robot so a raised testing mount is not needed. Please see the Surveyor Website for more information on how to purchase this little wonder!

The End

That's all folks. We hope you've enjoyed this little adventure into an application of machine vision processing and have inspired you to download a free trial of our software.

If you have any questions or comments about this tutorial please feel free to contact us.

Have a nice day!

 New Post 
Wall Avoidance Related Forum PostsLast postPostsViews

© 2005 - 2017 RoboRealm. All Rights Reserved. | Contact | Privacy | Disclaimer | Link to Us |