Working out that robot is blocked

Hi all. My 1st post here.
I have a SPQR robot but i think my query applies to most.
I would like to know which logic i should use to work out when my robot is faced with a block and therefore not moving forward. I tried testing the sensors but it is as if when the robot is rolling against a wall (too slowly to rely on the collision event) it continues to change location virtually despite not actually moving in space.

Without such logic there is no way to program my robot to find a way out of a maze for instance.

1 Like

I’m working with an RVR so don’t know if the SPQR is the same. The RVR has a stalled motor notification. I haven’t tested to see if it generated when the RVR stops because of an obstacle. If it does and the SPQR has that API it would be a possibility.

1 Like

Hello Peter,

There is no perfect way for your robot to solve a maze that way.
Since this is a difficult problem to solve for a spherical robot that doesn’t have the proper sensor kit, I can only make a recommendation that I’m not sure will solve your issue.
When Sphero rolls forward, it pitches up for a certain time while it accelerates, and then stabilizes back down. When you are against the wall, you are still moving, but you are always pitched up.
You could create a variable that takes a look at how long it has been since you were pitching up, and if it has been more than a certain amount of time, you can assume you are against a wall.

Let me know if that helps,


1 Like

Thank you Merriam and Quentin. I dont know about SPQR robot having this stalled api but I dont think it would work anyway since the robot does not look like stalling against a smooth wall, it keeps on rolling.

Quentin, I did think about the pitch as I did expect this to change while robot is moving. What pitch value should I compare with to assume it is pitched up?
When it accelerates, does it pitch up for a very brief time before stabilising again? So for instance, being pitched up for over 2sec could be considered as too long?

I sincerely believe that these robots should have been provided with a sensor to detect these blocked situations. Without it, it cannot learn about its surroundings, so all programs designed to make the robot behave more autonomously are not possible.

1 Like

Hello Peter!
I would suggest that you use the EDU app, and watch the Pitch go up and down while SPRK is actually driving in a straight line, until it gets up to speed. It should definitely be around a couple seconds.
Unfortunately, the SPRK robot was not designed to be autonomous, and work in those cases.
I do agree with you that autonomous robots are more fun, and that is why Sphero decided to create RVR, which has more capabilities on board, plus the ability to be customized to match your specific needs!

I hope this is helpful!

1 Like