sergbokh
(Sergey)
May 2, 2019, 9:41am
143
Hi @lucasdemarchi , great work!
I have no Plus to test, but I tried to get work the TFMini i2c (no plus) version, but for some reason with no luck .
The Plus version seems having different protocol, unfortunately.
What is the reason here to do two transfer() calls instead of single call?
void AP_RangeFinder_Benewake_TFMiniPlus::timer()
{ …
ret = _dev->transfer(CMD_READ_MEASUREMENT, sizeof(CMD_READ_MEASUREMENT), nullptr, 0);
if (!ret || !_dev->transfer(nullptr, 0, (uint8_t *)&u, sizeof(u))) {
return;
}
henrik04
(henrik04)
May 2, 2019, 1:32pm
144
Good evening lucasdemarchi.
This is very interesting. Is this for collision avoidance (multiple TFMini plus) or altitude control?
Cheers.
Henri
ppoirier
(ppoirier)
May 2, 2019, 2:20pm
145
Yes, with I2C you can use multiple devices for avoidance and altitude range
@Sergey_Zakhodylo TFmini has another protocol and the sensor that supports uart doesn’t support I2C. You need a TFmini Plus for it to work.
2 transfer calls because the sensor is not an usual I2C sensor with a regmap. Maybe it works with transfer only, but it’s not what is documented
@henrik04 can be used for either or both.
sergbokh
(Sergey)
May 2, 2019, 6:00pm
148
I mean your two lines are equivalent to
_dev->transfer(CMD_READ_MEASUREMENT, sizeof(CMD_READ_MEASUREMENT), (uint8_t *)&u, sizeof(u));
Either the single-line version doesn’t work for some reason or I missed something
if you do a combined r/w you will have only one stop at the end of the transaction in the I2C protocol.
we actually have support for “split-transfer”, but that just moves the double transfer to the lower layer (see the HAL implementation for I2CDevice):
if (_split_transfers && send_len > 0 && recv_len > 0) {
return transfer(send, send_len, nullptr, 0) &&
transfer(nullptr, 0, recv, recv_len);
}
What I may test is if the sensor support the repeated start… It’s not documented as supporting though.
sergbokh
(Sergey)
May 2, 2019, 6:37pm
150
You’re right, just checked TFMini Plus docs. There is a 100ms delay also required between W-stop and R-start.
The i2c protocol between not-plus and plus version is very different. Not-plus instead requires for a restart condition after command sent. Looks like FW for plus and not-plus was developed by different teams))
henrik04
(henrik04)
May 2, 2019, 7:38pm
151
@lucasdemarchi @ppoirier
So as ppoirier described it in another thread: 3 TFmini at the front, one for above in relation to collision avoidance.
Now the bottom one: Can the same unit be used for precision altitude landing and collision avoidance or not?
In regard to the back of a multi rotor: Are three units at the back needed too?
This would make 8 or 9 units for complete collision avoidance!
Would a LeddarVu at the front one at the back and two TFmini for top and bottom would make sense?
(See attached pdf for LeddarVu)
Cheers
Henri
LeddarVu.pdf (1.47 MB)
ppoirier
(ppoirier)
May 3, 2019, 12:36am
152
@henrik04 , you can use whatever configuration you like as long as you provide proper supply and devices adressing. We have only the LeddarTech Leddar One driver for the moment, Rangefinders (landing page) — Copter documentation .
Have you looked at my blog ?
[image]
Ahhh… Winter in Canada …
While the kids play hockey outside with sticks and a puck , I play inside with sticks and a POC !!
A few month ago I started experimenting with the Avoidance Library:
http://ardupilot.org/dev/docs/code-overview-object-avoidance.html
And I designed The POC : Proximity Obstacle Collision avoidance system based on an Arduino Pro Mini and VL50LX0 TOF rangefinders. This unit works pretty well, the only drawback is that it is sh…
henrik04
(henrik04)
May 3, 2019, 6:11pm
153
I certainly did! Thank you for answering.
Cheers
Henri
sergbokh
(Sergey)
May 3, 2019, 6:41pm
154
@lucasdemarchi what FC you used for testing the Plus driver?
ppoirier
(ppoirier)
May 4, 2019, 11:51am
156
Much easier to replicate now with the I2C sensors you can connect directly to the FC
danielh
(Daniel H)
May 5, 2019, 7:17am
157
Hey!
Wonderful work! Any estimate as to when this will be available in a stable release?
@sergbokh I used a Emlid Edge, but should work fine with any other FC we support in ardupilot.
@danielh after merging on master branch I will take a look on backporting it - when a stable release will be done I do not know, and it depends on the vehicle you want.
sergbokh
(Sergey)
May 6, 2019, 6:53pm
160
Thanks,
ordered one Plus to see if it will work with Pixracer.
danielh
(Daniel H)
May 6, 2019, 8:21pm
161
I am interested in ArduCopter.
henrik04
(henrik04)
May 11, 2019, 7:42pm
162
@ppoirier : Is this the unit you are referring to: Tfmini US$ 39.95 ?
How one change the I2C address of these (If you know)?
Thank you in advance.
Henri