Servers by jDrones

Terra Ranger Evo Rangefinder I2C Issues


(Mateusz Sadowski) #2

Hi James!

TeraRanger Evo will not work with the default address with ArduCopter < 3.6. In all the previous versions the I2C address of TeraRanger One was hardcoded and I think changing RNGFND_ADDR did not change anything.

I’m surprised about the other issues you see though. I’ll try to reproduce them when I have a free moment.

In the mean time if you want a proper Evo support you have 3 options:

  • Easiest - install the dev version of ArduCopter - in that options the RNGND_ADDR and min and max values are supported and respected
  • Moderately difficult - you can change the Evo i2c address to match the one from TeraRanger One and use 3.5.5. The disadvantage is the minimum and maximum range values will still be the same as TeraRanger One
  • Most difficult depending on your software experience - If you want to remain on 3.5.5 you could pull the code for that version and update it with the driver from the development version.

Feel free to let me know if you have any further questions.

Cheers,
Mat


(Steve79) #3

Hi Mat,

can you confirm that if i buy a Teraranger Evo 60m today i can use it with pixhawk 2.1 and latest version of Copter 3.6? Is it supported in both single operation and with hub (2 or three sensors hooked to it)?

Pls reply asap, i’ve some money to burn :slight_smile:


(Steve79) #4

Hi all

bought the Evo and wired up. I have the exact same problems as James: Unit work alone only, if i unplug the GPS (HERE). If i plug the GPS unit, Pixhawk freezes 10 seconds after powering up. Either i have many EKF errors, but i think they are due to missing gps.

Also, Mission Planner shows distance under “sonar distance” only if RNGFND_ORIENT = 25 (down) otherwise it’s always 0,00

BTW i need to set it to “forward” to provide basic obstacle avoidance functionality

Solutions?


(James Megariotis) #5

Hey steve,

I wrote some serial drivers for this rangefinder which fixed this problem. If you are still interested, let me know and I can send you a firmware file or send you a link to some code with the drivers once i put it up on GitHub. The driver will work on any firmware version if you build it yourself.

Sorry for the late response. I haven’t been on the forums in a while.

-James


(Steve79) #6

for sure i’m interested, github w/code would be ok. If you could build a fw to do some quick&dirty tests, it would be useful too.

Many thanks!


(Paul Atkin) #7

did you test during the normal boot what was the address assigned to the compass? it would print it in the mavproxy or in the usb console during reboot. it is either you have 2 devices that sit on the same address, or, the issue may be with i2c bus itself if it is not communicating.

damn, sorry, i did not pay attention to the last post - you fixed it? what was it?


(James Megariotis) #8

The terraranger evo supports both I2C and Serial comms. I switched from I2C to serial and wrote some serial drivers in arducopter for the terraranger evo. For this to work you would just have to rewire the rangefinder for serial comms.

The biggest problem with this rangefinder is you only get about 6 meters of range outdoors. Indoors, you can get much larger readings. I think i got up to 25 meters in our largest building. Outdoors you can only read a few meters. I spoke to a rep from terraranger, and they are aware that outdoors in direct sunlight, the max range is dramatically decreased.


(Paul Atkin) #9

i see, interesting. i did not use it before - i am set on cheaper tfmini lidar - works up to 12m, indoors or outdoors.

it also exists now in the I2C bus version, but i do not think there is a driver for I2C one yet. serial one is well supported, there are several threads about it here on this board.


(Franz) #10

Hello. I’m from Germany. My question would be:
I have a teraranger EVo with connect it to the pixhawk4 with I2C but it does not work.
I wil test it with Ardupilot 3.6.5 with daily build qgroundcontrol or Missionplaner but it does not work
I have according to the template of Terraranger connected and the manual from teraranger Evo
I can not find when i will analyze with qgroundcontrol the point M1: Distance_sensor.current…
I have teh daily build qgroundcontrol
Can xomeone help me
Thank you
Franz


(Franz) #11

Hello.
I’m from Germany. My question would be:
I have a teraranger EVo with connect it to the pixhawk4 with I2C but it does not work.
I wil test it with Ardupilot 3.6.5 with daily build qgroundcontrol or Missionplaner but it does not work
I have according to the template of Terraranger connected and the manual from teraranger Evo
I can not find when i will analyze with qgroundcontrol the point M1: Distance_sensor.current…
I have teh daily build qgroundcontrol
Can xomeone help me
Thank you
Franz


(Steve79) #12

James, can you provide more instructions on how to cable it on serial port? and drivers as well?


(James Megariotis) #13

@Steve79 Yes I can.

I will post a version of Ardupilot on my GitHub with the drivers described in my previous post. There should be some documentation of terraranger pinout online somewhere. I will try to locate it and post on here. If not I will just create a diagram of how I cabled it. I keep meaning to set up a pull request to get that driver placed into Ardupilot.

@Beginner This should also help you too.

I will try to get this done today for you. I will post with update when ready.

Sorry, I meant to do this back in December when you asked previously, but I got very sidetracked over the holidays and following month. Sorry for the delay.


(Franz) #14

Hallo James
Can you help me about my problem
with teraranger evo, pixhawk 4 and ardupilot 3.6.5
Thank you


(Adolfo Cobo) #15

Hello to all,
We have tested a Teraranger EVO 60m with Arduplane 3.9.5 and a Pixhawk autopilot, using I2C (configure as type=14, address=0x49)
It seems to work ok but more than half of the measurements are zero, that is, the distance jumps from a few meters to zero, there are no two consecutive measurements with the correct range (please see the attached image, it is from dataflash telemetry, rangefinder distance is in green , barometer altitude is the red one, )

According to the closed issue https://github.com/ArduPilot/ardupilot/issues/8246 this rangefinder should be supported in Ardupilot by now. Does anyone know what could be happening?

@Steve79 It would be nice if you could post your drivers.

Thankyou all for your help!
Adolfo.


(Steve79) #16

@Adolfo_Cobo i don’t use any special driver, i only flashed last version of arducopter in my pixhawk (3.6.5), anyway it was functioning ok since 3.6.1 or something, it goes crazy when i connect another device to i2c (in my case, led of the second GPS). Simply disconnecting them, it came back to work


(James Megariotis) #17

@Steve79 So I have pushed the code to my fork of the ardupilot repository. The code is on branch Copter-3.5_TR_Evo_RF. If you want to build from source, use link below and ensure you checkout the correct branch before building.

I have also included the firmware file in this post. Had to upload as a zip since they don’t allow px4 files as attachments. It was built from Copter version 3.5. arducopter.px4.zip (655.8 KB)

In order to set up the rangefinder to work with serial communications, the following parameters must be set:

SERIALx_PROTOCOL = 14
SERIALx_BAUD = 115

RNGFND_TYPE = 16
RNGFND_MAX_CM = 6000
RNGFND_MIN_CM = 50

In order to wire the evo for serial, please refer to the pinout which can be found at the link below:

You will need to use the backboard cable pinout to wire the serial cable. I can provide instructions if needed, but if you were able to wire the i2c cable, you should be able to do the serial cable. I can generate a pinout if you have problems.

I have also attached a link to the user manual as well if anyone needs it:

Let me know if you have problems or questions.

-James


(James Megariotis) #18

@Beginner I had similar problems when using I2c with a gps unit hooked up. They seem to conflict with other devices. I would recommend testing with ardupilot 3.6 if you wish to use I2C. Unplug all other i2c devices and configure it as instructed here.


You should be able to acquire the signal. The other thing is make sure you have a target that is between 1 and 5 meters away from the rangefinder. Since the min alt is 50 cm and it returns 0 if your distance is too close or too far, you have to make sure the rangefinder has a valid target.

It also sounds like you are currently running px4. And this is ardupilot forums.

If after attempting what I suggest, you still have problems, you could follow my instructions on serial connection to the rangefinder.

Let me know how it goes,
-James


(James Megariotis) #19

@Adolfo_Cobo I experienced the same thing. This is an issue with the rangefinder, not the driver. When used in the field, they have an effective range of about 5-6 meters when the sun is out. If you were to use it indoors over a surface that reflects IR better, you could theoretically get better results, but not outdoors over concrete, grass, etc.

I spoke to the terraranger tech support about that and it is an issue they know about. I think it might have something to do with noise from sunlight or a minimum required intensity of returning IR signals. They said its a firmware issue on the terraranger units and they may have a software fix in the near future.

So while advertised at 60m, that would only be in ideal conditions such as indoors over a smooth reflective surface. Realistic field performance you should expect consistent results up to about 5-10 meters at best after which range measurements are sporadic at best. After which you see the intermittent signal like that which you posted in the log image.

Hope this helps,
-James


(Adolfo Cobo) #20

Hello @James_Megariotis, I greatly appreciate your reply. I however don’t think that it is an issue of range. in all conditions (indoor, outdoors, small distances <1m, large distances…) there is always a continous jumping between a correct measurement and a zero value. It is not an intermitent signal, is a correct measurement followed by a zero measurement, and again and again.

This is an indoor measurement this morning with very low distances (about 1 meter). There is not a single pair of two correct consecutive measurements, unless the parameter SONR.Dist is not the one to look for in the log:

tera

I understand that the range can be lower with bright sunlight and/or low reflectivity targests like grass, but why is jumping always to a zero value for every other measurement? The log is registering about 40…60 measurements per second, and It seems that the rangerfinder is not able to cope with so many measurements and return zero or somehing not valid until it is ready again and theit gives a correct measurment. Or there is some kind of interference in the I2C signals… I don’t know. We have tried to remove everything else in the I2C bus but it doesn’t make any difference.

Thankyou again for your message. I am waiting to the response of the Terabee tech support.

Regards,
Adolfo.


(James Megariotis) #21

@Adolfo_Cobo I see. That is a strange issue and not at all what I have seen. You could try following my instructions for serial communications in previous posts. Other than that I have no clue what could be happening with your setup. I have had very good results with the serial driver. I found the i2c driver very unreliable. Good luck! Hope all goes well. If you decide to go with serial comms, feel free to reach out if you need any assistance.

-James