In Caffeine I needed a smooth simple head bob animation that was easily configurable. My final implementation worked by having the first person camera parented to a spring arm which was animated with a timeline node.

To account for different velocity the result from the timeline was then multiplied by the movement input axis.

Headbob_1