RVR not responding after some time

I have a piico dev sensor mounted on the Sphero RVR connected to a Raspberry Pi. I have written some code that detects the distance to the obstacle and drives the RVR accordingly. My main aim is to drive around inside the house maneuvering obstacles. Things generally work well most of the time. But after some time, like if I want to run it for 90 seconds then suddenly the rover gets struck. It simply appears to hang and doesn’t respond to any commands.
I have rebooted the RPi and the problem doesn’t go away. Only restarting the RVR solves the problem. Sometimes I need to keep it switched off for few minutes for it to work again. Some times the problem happens within the first few seconds of RVR starting to run.
I am powering the RPi using the RVR USB port using the blue cable that comes with RVR. Checking the dmesg shows some voltage issues but nothing around when the problem happens.

[   23.834270] Voltage normalised (0x00000000)
[   25.914358] Under-voltage detected! (0x00050005)
[   30.074344] Voltage normalised (0x00000000)
[  593.753594] Under-voltage detected! (0x00050005)

Believe, it was not any physical issue as just restarting the RVR fixes the issue mostly. I am only using drive_control.roll_start for driving and then sleep for 1.5 seconds. Because the RVR appears to hang I don’t get any notification like on_motor_stall_notify. Does any one have any idea where the problem might be? Anything else that I can try to solve the problem.

It appears to be a firmware issue when running the motors continuously unless I am terribly wrong. In a nutshell following is what I am trying to do

import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../')))
import asyncio
from sphero_sdk import SpheroRvrAsync, Colors
from sphero_sdk import SerialAsyncDal

loop = asyncio.get_event_loop()
rvr = SpheroRvrAsync( dal=SerialAsyncDal( loop))

async def drive_rover():
    count = 60
    speed = 30
    direction = 0
    wait_interval = 1.8
    try:
        await rvr.wake()
        await asyncio.sleep(wait_interval)
        await rvr.drive_control.reset_heading()
        await asyncio.sleep(wait_interval)

        while count > 0:
            await rvr.drive_control.roll_start( speed=speed, heading=direction)

            # Delay to allow RVR to drive
            await asyncio.sleep(wait_interval)
            direction = ( direction + 90 ) % 360

            count = count - 1
            print( "Count:", count, "Direction :", direction )

        print( "Shutting the rover down" )

    except KeyboardInterrupt:
        print('\nProgram terminated with keyboard interrupt.')

    finally:
        await rvr.close()


if __name__ == '__main__':
   loop.run_until_complete(drive_rover() )

I tried to play around with wait_interval but invariably the RVR gets struck/hung after some time. And it seems the issue only happens when operating the motors. I tried similar code and tried to toggle the LEDS and it never has this issue. I tried different driving modes (like using rvr.drive_with_yaw_si) and the behaviour is exactly same i.e. RVR hanging after some time.
Is there any other way to operate the RVR continuously or is it a firmware issue?

Hi,

This issue did not replicate on my setup. I ran your script a few times and it made it to the end without issues each time.

Does it occur if you power the Pi from another source or use a shorter, high quality USB A-to-C cable to power the Pi from the RVR? Low voltage warnings mean there is excessive voltage drop across the cable, and your Pi may malfunction in unpredictable ways.

The blue cable included with RVR was intended only for charging the battery. I do commonly use the blue cable anyway to power my Pi 4 from RVR, and have never seen low voltage warnings, but that’s with my particular hardware. Component tolerances on RVR and the Pi, plus cable resistance variations, mean that undervoltage warnings can show up on some combinations of visually identical hardware but not others, and in some operating conditions but not others.

Jim

1 Like

I had this problem, it happened when I powered the pi with the rvr battery. Using a separate power source for the pi fixed it.

1 Like

Thanks for the reply. Yes, that appeared to be the issue. When I power the pi from a dedicated battery it works perfectly.