Incorrect positioning on the map using motor encoders

Hello. I have a problem. I try to use wheel-encoders for non-gps navigation for my rover. I used instructions from here Wheel Encoders — Rover documentation (ardupilot.org) . When I choose the point the map in auto mode, rover drive there and everything is ok, until it reaches waypoint, after that rover just moves on the map with huge speed (around 180 m/s). But in reality it stopped. I have checked wheel distance in MAVlink inspector and readings from encoders are accurate. They do not change when rover stopped. I am using AUX pins for my encoders. I use JGB37-520 motors with encoders. Could somebody help me? (sorry for mistakes in the next, it is not my native language, i am 15 years old and need this rover for competition :smiley: )

Regards

Mihail

I have tried this at home many times on a reduced space, and I think this has happened with one wheel encoder wrong (going negative when it should go positive (simply exchange WENC_ pin definitions)).

For above video, these are the WENC_ distances:

WENC_ distances go both positive for forward movement, and both negative going backwards. When the doll rotates (in Acro or Manual) one goes positive and the other negative. So make sure you have the WENC_ pin assingments correct.

Do the following:

  • Start with some WENC_ definitions and move forward the vehicle straight a known distance, such as 10m. Adjust pin definitions and WENC_CPR’s until above curves on MP show exactly 10m, both positive.
  • Prepare some mission on a reduced space (such as that on the video) and define the home position with a lua script. Coordinates can be virtual.

Thank you so much! Now everything works well. I have changed WENC_PIN parameters and WENC_CPR. Now rover can drive in auto mode without problems.

Regards

Mihail

пн, 5 февр. 2024 г. в 18:52, Webillo via ArduPilot Discourse <noreply@ardupilot.org>:

Great. Other considerations:

  • Motor 1 is left, motor 2 is right.
  • Easy assignment: lower number FC signals to motor 1, higher to 2.
  • FC limitations: enough number of signals, WENC_PIN signals to FC inputs with interrupt capability, DIR signals not on IOMCU…

Thank you. This information is really useful for me. I will keep it in mind.

Regards

Mihail