Design of flexible smart robotic instruments for minimally invasive surgery