机器人在转弯前后的漂移

时间:2019-04-30 09:25:33

标签: webots

我正在Webots中遥控三轮车机器人(叉车)。转动机器人时遇到问题。来回运动是可以的。但是,在转弯或急转弯之后,机器人会沿正常运动方向打滑。

对我来说,这可能是由于车辆的运动学限制所致。

  1. 滚动约束:可以,因为机器人工作正常
  2. 滑动约束:转动机器人时违反了此约束

如果这是问题,请指导我如何解决?

或者是否还有其他问题或需要调整的参数。

机器人具有一个主动脚轮,用于线性和角度运动。除此之外,还有被动轮。

编辑:

  • 仅浏览控制器的代码,我注意到转向马达一直在更新,随着时间的推移会累积位置更新,我认为这是造成滑移的原因

  • 在速度模式下使用旋转电动机,而在位置模式下使用转向电动机。但是它的初始速度为10.0(最大速度),我认为它正在引起漂移

代码

while fts.step(timestep) != -1:
    key = keys.getKey()
    if(key == keys.UP):
        state = MAX_SPEED
        wheel_main_steer_motor.setPosition(0.0)
        wheel_main_rotation_motor.setPosition(float('inf'))
        wheel_main_rotation_motor.setVelocity(state)
        print("Main Motor position:", wheel_main_rotation_postion_sensor.getValue())
        print("Main Motor velocity",wheel_main_rotation_motor.getVelocity())
        print("Steer Motor position:", wheel_main_steer_position_sensor.getValue())        
        print("Steer Motor velocity",wheel_main_steer_motor.getVelocity())
    elif(key == keys.DOWN):
        state = -MAX_SPEED
        wheel_main_steer_motor.setPosition(0.0)
        wheel_main_rotation_motor.setPosition(float('inf'))
        wheel_main_rotation_motor.setVelocity(state)
        print("Main Motor position:", wheel_main_rotation_postion_sensor.getValue())
        print("Main Motor velocity",wheel_main_rotation_motor.getVelocity())
        print("Steer Motor position:", wheel_main_steer_position_sensor.getValue())        
        print("Steer Motor velocity",wheel_main_steer_motor.getVelocity())
    elif(key == keys.RIGHT):
        wheel_main_rotation_motor.setPosition(float('inf'))
        wheel_main_rotation_motor.setVelocity(state)
        wheel_main_steer_motor.setPosition(-0.5)
        print("Main Motor position:", wheel_main_rotation_postion_sensor.getValue())
        print("Main Motor velocity",wheel_main_rotation_motor.getVelocity())
        print("Steer Motor position:", wheel_main_steer_position_sensor.getValue())        
        print("Steer Motor velocity",wheel_main_steer_motor.getVelocity())
    elif(key == keys.LEFT):
        wheel_main_rotation_motor.setPosition(float('inf'))
        wheel_main_rotation_motor.setVelocity(state)
        wheel_main_steer_motor.setPosition(0.5)
        print("Main Motor position:", wheel_main_rotation_postion_sensor.getValue())
        print("Main Motor velocity",wheel_main_rotation_motor.getVelocity())
        print("Steer Motor position:", wheel_main_steer_position_sensor.getValue())        
        print("Steer Motor velocity",wheel_main_steer_motor.getVelocity())
    else:
        wheel_main_rotation_motor.setPosition(float('inf'))
        wheel_main_rotation_motor.setVelocity(0.0)
        wheel_main_steer_motor.setPosition(0.0)
        print("Main Motor position:",     wheel_main_rotation_postion_sensor.getValue())
        print("Main Motor velocity",wheel_main_rotation_motor.getVelocity())
        print("Steer Motor position:", wheel_main_steer_position_sensor.getValue())        
        print("Steer Motor velocity",wheel_main_steer_motor.getVelocity())

0 个答案:

没有答案