# 32U4 and maze solving

I am using the 32U4 with the example maze solving code. The jumpers are in place and the maze is white background with electricians tape for the lines. The robots solve the maze fairly reliably. Occasionally they get confused in intersections and it looks like they are not completing the 90 degree turn. In replay, I have not had a successful replay yet. On one maze, the simplified turns displayed was clearly wrong and on another maze, the robot gets off at an intersection (seeming to try to make a 45 instead of a 90 degree turn.

I dont know if it is related but there seems to be some drift in the gyro. If I leave the robots after calibration, the numbers start around 0 but migrate to larger and smaller numbers. They do this at different rates - one moves by one every 10 seconds and the other moves every 2 seconds. is that expected?

Thanks

I forgot to mention that I have two 100:1 robots and I reduced the turnspeed which improved the initial maze solving but not the replay. The turns still look like two partial turns to get around - could that be confusing the path simplification algorithm? Are there additional parameters I could tweak for the 100:1 robots?

Hello.

I am sorry you are having problems with your Zumo 32U4 Robot. Can you post your sketch and a short video showing the behavior? Please note, some gyro drift is normal.

-Derrill

I am using the example Maze sketch. This only changes that I made were in GridMovement.h to slow the turn and straight speeds which seemed to improve the maze solving (the zumo did not lose the line). I think I uploaded the video, it got to about 20% and disappeared. The maze is correctly solved with LLRRLLS and as you can see from the video, the simplified path is something different.

Thanks

Colin

``````#include <Zumo32U4.h>

// Motor speed when driving straight. 400 is the max speed.

const uint16_t straightSpeed = 150; //200

// The delay to use between first detecting an intersection and

// starting to turn. During this time, the robot drives

// straight. Ideally this delay would be just long enough to get

// the robot from the point where it detected the intersection to

// the center of the intersection.

const uint16_t intersectionDelay = 130;

// Motor speed when turning. 400 is the max speed.

const uint16_t turnSpeed = 150; //200

// Motor speed when turning during line sensor calibration.

const uint16_t calibrationSpeed = 200;

// This line sensor threshold is used to detect intersections.

const uint16_t sensorThreshold = 200;

// This line sensor threshold is used to detect the end of the

// maze.

const uint16_t sensorThresholdDark = 600;
``````

Hello.

It sounds like the video you tried uploading exceeds our forumâ€™s maximum file size limit (5120KB). Can you try uploading the video to a file sharing website and linking to it here? Alternatively, you could upload the video to a site like YouTube.

- Amanda

Thanks for posting the video. It does look like timing is off between when the Zumo 32U4 detects the intersection and when it completes a 90 degree turn. Just in case you do not already know, the code comment here says to adjust the speed and delay parameters for your motor and battery, so you should adjust those parameters, particularly the `intersectionDelay` variable in GridMovement.h for the MazeSolver example.

- Amanda