I have code like

\caption{Testing Apparatus}

Then on the next pages the text is pushed to the left, for the size of the wrapfigure, even though the figure does not appear there. How can I prevent this?

\usepackage[top=1.0in, bottom=1.0in, left=1.0in, right=1.0in]{geometry}
\author{Ashvin Nair}
\title{Camera as Distance Sensor}
Camera as Distance Sensor\\
Ashvin Nair\\
Winchester High School\\
[email protected]

        \textbf{Camera as Distance Sensor}

The camera is easily Botball's most versatile and useful sensor.  Color recognition enables many of the Botball tasks to be completed.  We decided that along with knowing \textit{what} things are, knowing \textit{where} those things are is just as important.  The distance sensors provided with the kit are easily distracted, sometimes unpredictable and limited, and generally hard to trust.  With the camera, objects can generally be tracked smoothly and predictably.

Our approach to using the camera to find distance to objects is deriving a statistical model based on controlled trials.  In the past, we have used simple algorithms to close in on objects by manipulating the speeds of the wheels based on their position on the camera.  However, we wanted to know the distance to objects, mainly to  constantly map objects while the robot is moving so that the robot always has the most accurate idea of where objects are located.  Additionally, fixed objects can be used for the robot to localize itself.

\caption{Testing Apparatus}

Trials were conducted on large graph paper.  The CBC was placed on one side and the height and angle of the camera were measured.  The paper was marked into 6-inch boxes, and in each individual trial, a pompom was placed on the corner of a box.  Multiple trials were strung together in one program which performed several trials in a pattern and emptied the data into a comma-separated-values file.

With this data, specific situations were used to obtain a model.  In practice, each time the camera is adjusted on the robot (height or angle is changed), a new model may be required.  Of course, the next step in analysis is to model the camera generally, incorporating height and angle.


To analyze the data, we used the statistics package R \cite{stats}.  The model above is specifically for a camera height of 20 cm and an angle of elevation of $55^{\circ}$.  The original data showed an inverse relationship so the inverse of the distance values was taken and a linear model was obtained.  To use this model, one would  first get the value of a blob's bbox\_bottom from the camera.  Say that the value was 70.  First, plug in 70 for the value of p, then evaluate the expression and take the inverse:
\frac{1}{d} &= 0.01158 + 0.0004387p \\
\frac{1}{d} &= 0.01158 + 0.0004387(70) \\
\frac{1}{d} &= 0.04229 \\
d &= 23.6

\caption{Model For Distance}

The model was taken in a straight line in front of the camera, but later data showed that the value of pixels of bbox\_bottom varied very little when the object was moved horizontally with respect to the camera.

\section*{Dealing with Variables}
Intuitively, as the camera is raised, the model is affected linearly.

Although being able to use the camera to approximate distances to objects is infinitely useful, the usefulness is limited by the camera hardware and drivers.  Still, using this process, a lot more information can be gathered by the robot.


  R Development Core Team (2011). R: A language and environment for
  statistical computing. R Foundation for Statistical Computing,
  Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R-project.org/.


  • 2
    You need to extend this example a bit, so that people can compile it and see the effect you mention. Jun 4, 2012 at 15:54

1 Answer 1


This happens because wrapfig doesn't handle page breaks and sectioning commands very well. Your figure exceeds the space left on the page. Plus there is some eerie interaction with the starred \section* command. (You can check: if you use the unstarred version for section 'Introduction', this problem will go away). I don't know any elaborate hack to prevent this and the alternative, the (much older) floatflt package doesn't handle this any better. In fact, manual adjustment is suggested in the documentation.

So I suggest you move the wrapfigure environment one (or two) paragraphs up, if you need unnunmbered sections. If (it's rather likely) there is still bothersome whitespace below the figure (caption) you can remove it with a hack:

\caption{Testing Apparatus}

Modify the negative amount for \vspace according to your needs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .