Pi Car X insufficient Motor Calibration (Motor Speed Offset)

Issue ongoing

First up im rather new to Programming (only school and a bit of Hobby Knowledge), but I know that I have a brain and enough curiosity for a whole village.

I own 2 Pi Car X. I set them up correctly, one via Python and one via Ez Block for my little brother. I read the entire documentation (out of my own interest and while i set the Pi Cars up)

After some time, both shared the same issue and there is no information about the solution to this problem in the documentation.

The problem being:
The motors (engine motors, NOT the servo motors) run at different speeds. The right/left motor has an offset compared to its counterpart. Hence the Pi Car X cant drive in a straight line. There are no calibration options for this. The only calibration option in the documentation is about “Reversing the direction” . I need the Pi Car X to drive in a straight line. This is relevant for my finals schoolproject.

The Steering Impact is severe. The turning radius got WAY worse.

My potential Solution:

I am currently trying to code a solution in Python and add a section to the “calibration.py” that adds an option to adjust motor speed offset. In this example i use 10% as a value to show the concept. (The severity of the actual impact on my Pi Car X is 100% minimum lol, Steering via direction servo gets fully nullified)
What I want:
I want Pi Car X to go at speed 10 in straight line
What the Car does:
Due to Motor 2 being slower by default, it turns right. Actual motor speed of motor 2 probably is 9. Motor 2 has 10% less power in this example.
What i think may solve this:
Code that automatically increases the speed of the motor 2 by 1 per 10 speed units: If i want speed 10, then the code makes motor 2 go speed 11. If i want speed 20, it makes motor 2 go speed 22. Speed 30, motor 2 = 33, etc. This however means, that i can never go above 90 as due to 100 being the cap, i cant adjust the speed of the right motor to 110.

Heres what im currently trying to do:

If a moderator sees this, do u think i could get help on this Issue? Thank u in advance :3
I will update my Progress on the Code here. If i manage to solve this by myself, Ill edit this to “Issue fixed”

Update: I searched the forum for this more and saw 2 posts with the same Issue, where the Moderator effectivly said “We will send new motors if its severe”. But isnt my Idea in theory possible? Im assuming it should be because i can command both motors to change direction independently, so i could offset them separately? If not then its over ggs

Just my thoughts..Sunfounder may have much better ones!

Unfortunately, manufacturing tolerances of such motors, will always result in speed differences, to a greater or lesser extent. There are multiple instances of this reported on this forum with picarx, but it’s not a picarx problem per-se, just normal engineering variability.

Your solution looks interesting, but as you have noted: you will always need some headroom to add/subtract the calibration values, limiting the top speed. Also, temperature changes, voltage changes etc may change the calibration values required on a daily basis.

But, it depends how “straight” you need to travel. Your solution may be perfectly adequate.

I had a similar problem with my pidog: in the end I used optical flow to keep it on track. But pidog moves very slowly, so plenty of time to process the flow images!

You could also add extra hardware such as wheel speed sensors or a 9 dof imu to assist, but it depends on the constraints and accuracies required of your project.

1 Like

Thank u for your reply! I will consider these points C:

Just getting an autonomous object to travel in a straight line is a fairly major project in itself! Good luck!

Thank you for your suggestion.

If we use a power offset to balance the speed of the two motors, it will indeed be impossible to achieve the maximum possible speed, as both motors will inevitably be limited to the speed of the slower one.

Furthermore, during the development of the PiCar-X, we also noticed this issue. We tried balancing the motor speeds using a power offset, but we found that no matter how we adjusted it, we couldn’t achieve perfect balance—the results might only improve slightly.

This is because the speed of this type of motor is not constant; it fluctuates to some degree depending on different conditions.

1 Like