You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Webots中Pioneer 3AT机器人传感器数值异常问题排查求助

Webots中Pioneer 3AT机器人传感器数值异常问题排查求助

我现在在Webots模拟器里做一个简单的壁障跟随机器人,但传感器返回的数值有点不对劲。目前我写的代码只是让机器人向前行驶,同时打印所有传感器的数值:

from controller import Robot

robot = Robot()
MAX_SPEED = 6.4
timestep = 32

leftBackMotor = robot.getDevice('back left wheel')
rightBackMotor = robot.getDevice('back right wheel')

leftFrontMotor = robot.getDevice('front left wheel')
rightFrontMotor = robot.getDevice('front right wheel')

motors = [leftBackMotor, rightBackMotor, leftFrontMotor, rightFrontMotor]

for motor in motors:
    motor.setPosition(float('inf'))  
    motor.setVelocity(0.0)  

dist_sensor = []
for i in range(16):
    sensor_name = "so" + str(i)
    dist_sensor.append(robot.getDevice(sensor_name))
    dist_sensor[i].enable(timestep)    

while robot.step(timestep) != -1:
   for i in range(16):
        print(f'Sensor: {i} Valor: {dist_sensor[i].getValue()}')
    
   leftBackMotor.setVelocity(MAX_SPEED)
   leftFrontMotor.setVelocity(MAX_SPEED)
   rightBackMotor.setVelocity(MAX_SPEED)
   rightFrontMotor.setVelocity(MAX_SPEED)

我用的是Pioneer 3AT机器人,它配有16个距离传感器(其中6个是前置传感器),但现在只有两个传感器能返回非零数值——哪怕其他前置传感器的射线已经因为检测到墙壁变绿了,它们的数值还是零。明明传感器的射线碰到物体就会变绿,前置的射线已经绿了,但就是只有两个传感器的数值大于0,这到底是怎么回事啊?

备注:内容来源于stack exchange,提问作者squareface

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 14:43:04