Installation Verification Drive Runs Continuously

Just got the XRP and went through initial startup. Range sensor didn’t seem to be working (always read 0.0) and I am not sure why (I double checked the pinout and cable orientation), but I think that is a separate issue. When it got to the drive section it seemed to drive a bit guessing it was straight from the code but then it started turning and never stopped. I had to hit the stop button in the editor which then stopped it.

It did the same thing on the next run of the installation_verification program. I unplugged it and plugged it back in. With no changes to any of the connections this time the distance sensor worked! The drive still turned continuously on step 2.

Sorry to hear that you’re having issues with the verification program.

Can you try running this code and seeing if the issue is from the encoders or the IMU?

from XRPLib.defaults import *
import time

while True:
    left_encoder = drivetrain.get_left_encoder_position()
    right_encoder = drivetrain.get_right_encoder_position()
    imu_heading = imu.get_heading()
    print(f"Encoder Left: {left_encoder}\tEncoder Right: {right_encoder}\tIMU Heading: {imu_heading}")
    time.sleep(0.5)

With this code you should be able to turn the wheels and the robot manually to confirm that the values are updating correctly. This should help us isolate your issue so that we can further help.

The code above misspelled position but once I fixed that it ran and I was able to see that all 3 were working fine:
Encoder Left: 3.769911 Encoder Right: 4.124347 IMU Heading: 320.1536

I retested the Installation Verification again and this time the range finder didn’t work again. I will also note that the servo only barely moves. I can hear it trying to move and can manually verify it isn’t near the end of travel but it barely moves and I am not sure if that is intended doesn’t seem right. Lastly the drive operated the same as above even after verifying all of the sensors.

One other thing. If you were holding the XRP so that it would not fall off the table, then the turn would not stop. The turn uses the gyro to confirm how far it has turned, not just wheel counts. It won’t stop until the XRP has turned the correct number of degrees it was programmed to turn. In this case 90 degrees.

1 Like

This was it I was indeed holding it and not letting it turn the full 90. Makes sense!

Now I am curious about my rangefinder and servo issues? Especially the rangefinder which seems to only intermittently work.

Do you have 4xAA batteries installed? If you’re just powering over USB, the servos don’t always like that.

Not sure about the intermittent ultrasonic sensor behavior. Could you please send a picture of the wiring so we can confirm everything looks correct?

I didn’t realize that both battery and USB were required to run the tests. The battery connector was not plugged in.

When I ran it with power from both the test worked completely.

1 Like

Great to hear! The batteries aren’t strictly required, but they can just provide a lot more power than USB can, which mostly affects the motors and servos.