Modeling of robots in contact with a dynamic environment