Need Help Setting Up Encoders

Using Rover 3.5.2 on a BalanceBot with brushed motors and quadrature encoders. The tuning screen in MP 1.3.68 for rpm1 and rpm2, shows the rpm’s that look like a square wave for a few seconds, then maybe jump to the opposite side of 0, or stop showing any thing. The AB leads are connected to ports 3/4 and 5/6 of the Pixhawk 4. The ground and power leads are connected to the ± pins of ports 4 and 6. Can someone look over the parameter and log files and provide some guidance?

Chuck

https://www.servocity.com/313-rpm-hd-premium-planetary-gear-motor-w-encoder

BalanceBot1Oct17 PlanteryMotor 2019.param (13.3 KB) BalanceBot1Oct17 PlanteryMotor 2019.param

Those parameters are not from Rover. Looks like it’s from Plane?

And I assume you’ve followed the instructions at Wheel Encoders — Rover documentation

It’s ArduRover V3.5.2 which is current stable.

Are Encoders working in current stable? I suppose they are it’s the dev version they are not.

As far as I can tell wheel encoders are working in stable and in the dev version (aka latest, aka 4.0.0). There are some problems (fixes coming in Rover-4.0.0-rc2) but the wheel encoder driver itself works I think.

Your parameters look pretty OK except that the two wheels are in the same place (probably one of the POS_X values should be made negative). Also I think the POS_Z values is unused although it probably doesn’t hurt to have it set.

The log shows that the wheel encoders aren’t working though. I guess you moved the wheels during this logging period? The motors were powered of course? The wheel encoders won’t provide any “pings” unless the motor is powered. I guess you’ve double checked the wiring to make sure it’s similar to what’s shown on the wiki?

Another way to check if AP is correctly reading data from the wheel encoders is to go to MP’s Flight Data screen and press Ctrl-F, then push the “MAVLink Inspector” button (in the middle) and then expand “Vehicle 1”, “Comp 1” and check the WHEEL_DISTANCE messages’s “distance” values. The first two values will be the total distance travelled by the first two wheels.

It might be a good idea to double check with Rover-4.0.0-rc1 which is available using the “Beta Firmwares” link in MP (and QGC I think).

Thanks for the replies. It did follow the Wiki with the exception that power was supplied from ports 4 and 6. This wasn’t shown in the Wiki. Was this the correct thing to do?

I haven’t set the POS settings yet. The motors were powered and turning. I’ve included the MAVLink Inspector screen capture and wheel distance heading does appear. I looked at rpm values while the motors were running and they showed 0. The .bin file was from this run. What bugs me is that I was getting rpm values with different motors some time ago.

Chuck


@chuckl74,

It’s possible to provide power using a BEC which is connected to a battery and to the flight controller’s real power rail. Most flight controllers will not provide power to that rail on their own though.

I think it might be best to double check with Rover-4.0.0-rc1 and then look for the WHEEL_ENCODER messages (not RPM).

I got the encoders working by using power from the RoboClaw motor controller. I haven’t tuned the PID’s yet, but it is fairly stable with just setting the minimum throttle. It can be steered and moved forward/backward, but not easily controlled as expected. However when switched to the Acro Mode, it just spins up very fast and violently, without touching the sticks. The left motor is connected to pin 1 and its encoder 5/6. Right motor is connected to pin 3 and the encoder to 3/4. I’ve also swapped the encoder locations and it still spins violently. Please look over the parameters and log and see if you find the problem.

Chuck
BalanceBot10-23-2019.param (12.7 KB)

Any feedback on my parameters or logs? I’ve had this bot working before but with 3.5.1 and spent lots of time today trying to download and install it. I had no problem installing the Rover-4.0.0-rc1 or reinstalling 3.5.2. Is there some Wiki on installing an older version. 3.5.1 doesn’t show up in the drop down box and I can’t figure out how to install it from the firmware downloads.

Chuck

It’s been a while since I posted here because other things got in the way. I 3D printed at new bot to locate the battery at the bottom, just above the gear motors, and made it taller to get the compass further away from the metal in the motors. It balances pretty well by gradually increasing the MOT_THR_MIN until the bot wobbles too much, than gradually decrease it.

However, the I can’t get the encoders working. V4.0.0-rc2. No rpm readings appear in MP Tuning screen nor any WHEEL_DISTANCE readings in MAVLink Inspector. Can you look at the parameters and log to help isolate the problem? Right now when switch to the Acro mode it spins up violently.

BalanceBot11-21-2019.param (16.0 KB)

I’ve noticed a similar issue, sometimes I can get the wheel encoder option to show up under Vehicle1 > Comp 1, sometimes I can’t. Did you figure out what causes this?