Display Distance wheels encoder

At a glance, I don’t see an existing Lua binding for wheel encoder data. I’m sure I could figure out how to write one, but that would mean you’d be stuck with my fork/branch of ArduPilot (at least until that binding is merged with the master branch).

@iampete, is there a better/existing way to access wheel encoder data via Lua?

Can we read through MAvlink message ?

Technically you can read a serial/telemetry port within Lua, but I don’t know of a way to parse the data effectively to capture a specific message without writing a MAVLink library in Lua, which seems like the hard way to do things here.

I’m happy to be proven wrong!

it s unlucky that the developers of Ardurover are not provided for this display because we can display the speed but not the distance traveled (odometry) while this can be read by the Mavlink, to be sent back to the Arupilot developers for the next update day maybe?

sorry for my english, i m french using google translate… :slightly_smiling_face:

I debugged a balance bot with two DC motors with encoders (now unusable with 4.1.x) with a lap to a circuit, looking at WENC,Dist’s on MP on the log:

Since I had that lap as mission waypoints, adding the individual distances between waypoints (haversine’s), when the sum was coincident with WENC.Dist’s, and appeared as above, everything was right.

Note above that inner wheel shows a smaller distance.

To be fair, the value is provided via MAVLink, and it can be displayed in the Inspector that Mission Planner provides.

Your request was to display it on two other platforms not developed or maintained by ArduPilot, so the Lua solution seemed most advantageous. However, there is no binding (at present) for WENC data in Lua.

yes indeed I had mentioned two platforms which are QGC and SOLEX in case someone has a solution with these 2 there.
if I understood correctly we can “visualize” but not display the distance in MP as we can do with the speed then? that’s it ?

thanks Webillo
for what : the Rover must move without GPS and I must be able to see how far from the start I stopped to inspect detect objects at the same time.

You only need the rover to move between known GPS points, so you can compare with haversines the WENC.Dist’s on the log. But, for example if you move between two points with distance measured with a metric tape you would not need GPS at all (compare WENC.Dist’s to a known measure).

I think I explained myself badly:
I want to be able to display the distance from my starting point while I am driving the rover.
the goal being to inspect caves and identify objects.
I pilot manually and not automatically, I watch the video from the camera in streaming and at the same time the odometry is displayed on my radio screen.

Distance from home is available in the MP Quick tab, as is total distance driven.

If you want a periodic MAVLink GCS message with those values, I can help with that.

I thought you specifically wanted each encoder’s discrete output.

yes i saw that in Quick Tab and i can display in Hud but only speed is ok the others (distance driven and distance from home) are always on 0.00, nothing move

and i ve only 1 encodeur Aux 6 et 5

Try right clicking on the map in Mission Planner and using the “set home here” feature. It doesn’t really matter where you set the home position if you aren’t using GPS, but having it defined may help display the values you’re after.

See this video:

an accelerated capture of an above mentioned balance bot long tlog.

DistToHome (DH) and DistTraveled (DT) show reasonable values (BTW, I dont know if they are got from encoders).

Are you sure you have everything OK?

ok for me, but i have to set EKF origin in MP not home (right click on map and “Set here EKF origin”) it s the best thing because when i desarm vehicule Zero is setting distance ground.

however, can i set EKF or Home origin witout MP ?? with QGC for exemple, cause can t have my PC always

I am getting back with scripting… again :slight_smile:
I see there is an example already available:

1 Like

Yes Ok thanks… i’ ll try this tomorrow and tell you what happened…