Enhancement of gravity estimation in modulated optomechanics