Gait mode recognition and control for a portable-powered ankle-foot orthosis