How to make the TFMINI rangefinder talk I2C

@DHank01 Good === hit the “like” button :wink:

I fly loiter using optical flow
http://ardupilot.org/copter/docs/common-px4flow-overview.html

1 Like

@ppoirier: Hello Patrick, i’m trying to test the TF mini poc but i’m running into a small issue. Where do you got the mavlink.h library for the teensy? I got one but the distance message is not there. So i ‘stole’ it from the cleanflight code.

Thanks!

Hello Nicolas,
I generated it using the python export script, as showed in this excellent blog: MAVLink Step by Step

1 Like

@ppoirier In testing our copter with a Pixhawk, PX4FLOW, TFMINI Lidar for altitude, with all GPS parameters turned off(Optical Flow Only), we can take off in Loiter mode and hover relatively well but after a few seconds it kicks out of LOITER mode and we get an EKF variance error and looking at the EKF gages, the horizontal position EKF is high and in the orange.
When taking off in Stabilize and trying to switch modes to POSHOLD or LOITER the flight mode change fails. Altitude seems to be fine? These issues go away when we turn the GPS back on.
Do you have any suggestions or guidance? Any log plots you would like to see?

Hello , I answered on your topic

thanks patrick…
That is what i was looking for!
:slight_smile:

After trying a while i still cant compile the project. Getting all sort of errors:

TFMINI_I2C_MAVLINK:74: error: ‘MAV_TYPE_GCS’ was not declared in this scope

‘MAV_COMP_ID_PATHPLANNER’ was not declared in this scope

Any hint?
(i followed the step by step guide)

Seems you are missing somethink in your mavlink library
try substituingthe define by the associated numbers from this http://mavlink.org/messages/common
6 MAV_TYPE_GCS
195 MAV_COMP_ID_PATHPLANNER

The error line is longer than just the PATHPLANNER (too long to put it here without spamming).

I build the mavlink using the step by step guide in a virtualbox linux. (it was impossible run it on windows).

I will upload my mavlink library on gitter tonight :wink:

cool thanks patrick…i don’t know why mine does not work at all.

@nicodh It is too big for github, I did a share drive

I will leave it open until you copy == let me know

1 Like

Thanks downloading right now

Nicolas Grunbaum

Thanks Patrick, it’s done, i downloaded it, and tested it, it works. :slight_smile:

Thanks for the help!

Nicolas Grunbaum

Putting this out to the community. I seem to be in need of assistance. I flashed my pro mini with no issues, its wired up and double checked. I configured the Arducopter per the instructions. But no joy.
At rest the copters altitude reports as .15 meters and if I roll the machine on its side so it measures a longer distance if measures .23 meters. If I run my hand in front of the sensor it changes numbers quickly but only in the range of .15 to .23. I am stumped.
One small change. If I give it more room to measure it gives me higher numbers, I saw it go to 40 at one point. ITs a small room so its hard to get an unobstructed range.

I did sit the machine on the bench with the lidar over the edge. Its 1 meter to the floor and it read .21. No settings for the lidar in mission planner have any effect on the numbers other then to stop it from working.
I thought this may be a symptom of it outputting in say mm over CM…but I am not sure what the results would be like its its wrong.
Any thoughts would be appreciated.

What should it be MM or CM

Hello,
Yes it look like the TFMINI is sending in cm,
here are the commands to:
Modify output unit to mm output: 42 57 02 00 00 00 00 1A
Modify output unit to cm output: 42 57 02 00 00 00 01 1A

Uou migh try to reduce gain as well on line 32

4 Likes

Merci beaucoup Patrick
That was it spot on. It’s working great now.

1 Like

Bienvenue Ricky, happy it works

Hit the like button , that’s how I get paid here :slight_smile:

7 Likes

The button…???
Point me to the button I would be glad to hit it…lol

:heart:️. Button below just push it

8 Likes