The osmeteria are displayed when the caterpillar is threatened.  They are scent organs that emit a foul odor to repel ants, mantids, spiders, etc.  I was unable to detect the odor.
<a rel="nofollow" class="external text" href="https://www.flickr.com/people/52450054@N04">Judy Gallagher</a>
CC BY 2.0
<a rel="nofollow" class="external text" href="https://www.flickr.com/photos/52450054@N04/24720909637/">Eastern Tiger Swallowtail caterpillar with osmeteria - Papilio glaucus, Lake June-in-Winter Scrub State Park, Lake Placid, Florida</a>