  The raw coronagraphic performance of current high-contrast imaging
instruments is limited by the presence of a quasi-static speckle (QSS)
background, resulting from instrumental non-common path errors (NCPEs). Rapid
development of efficient speckle subtraction techniques in data reduction has
enabled final contrasts of up to 10-6 to be obtained, however it remains
preferable to eliminate the underlying NCPEs at the source. In this work we
introduce the coronagraphic Modal Wavefront Sensor (cMWS), a new wavefront
sensor suitable for real-time NCPE correction. This pupil-plane optic combines
the apodizing phase plate coronagraph with a holographic modal wavefront
sensor, to provide simultaneous coronagraphic imaging and focal-plane wavefront
sensing using the science point spread function. We first characterise the
baseline performance of the cMWS via idealised closed-loop simulations, showing
that the sensor successfully recovers diffraction-limited coronagraph
performance over an effective dynamic range of +/-2.5 radians root-mean-square
(RMS) wavefront error within 2-10 iterations. We then present the results of
initial on-sky testing at the William Herschel Telescope, and demonstrate that
the sensor is able to retrieve injected wavefront aberrations to an accuracy of
10nm RMS under realistic seeing conditions. We also find that the cMWS is
capable of real-time broadband measurement of atmospheric wavefront variance at
a cadence of 50Hz across an uncorrected telescope sub-aperture. When combined
with a suitable closed-loop adaptive optics system, the cMWS holds the
potential to deliver an improvement in raw contrast of up to two orders of
magnitude over the uncorrected QSS floor. Such a sensor would be eminently
suitable for the direct imaging and spectroscopy of exoplanets with both
existing and future instruments, including EPICS and METIS for the E-ELT.
