Lidar lite v3 velocity + Arduino Pro Mini

Hello,

Anyone knows how to use the velocity register on LiDAR Lite v3?
I don't really get the timing/acquisition count, etc
OUTER_LOOP_COUNT register must be modified to 0xff (free running mode)? Why?

"The velocity measurement is the difference between the current measurement
and the previous one, resulting in a signed (2’s complement) 8-bit number in
cm. Positive velocity is away from the device. This can be combined with free
running mode for a constant measurement frequency. The default free running
frequency of 10 Hz therefore results in a velocity measurement in .1 m/s"

The code below will result in constant readings without using the free running mode?

byte myArray[1]; // Array to store bytes from read function
myLidarLite.read(0x09,1,myArray,0,0x62); // velocity measurement
velocity=char(myArray[0]); // Is this the correct conversion?

Thank you.

myLidarLite.read("0x09",1,myArray,0,"0x62"); // velocity measurement

I have no idea what a myLidarLite is, but I can't imagine that it's read() method takes hex values as strings as arguments.

I can't imagine why you need to use a one element array.

myLidarLite is an LIDARLite object, read is a method and the hex values are register addresses.

Thank you for your time, but the topic is addressed to the folks who are familiar with Lidar lite v3 libraries and operation.

If only we knew which LidarLite library we were supposed to be experts on {sigh}.

Maybe the guys over at Snippets'R'Us can help.

I'm sure Paul knows what a method is.

From the library, the read method:

void read(char, int, byte*, bool, char);

There are no strings in those arguments. Char is a signed 8-bit value.

void LIDARLite::read(char myAddress, int numOfBytes, byte arrayToSave[2], bool monitorBusyFlag, char lidarliteAddress)
{

This one perhaps?
Oops.

I'm surprised your code even compiled.

Oops indeed, sorry for the type mismatch PaulS, others. I almost never use char type in DB programming, forgot about its existence. :slight_smile:

Still no luck... Any other ideas? Or char related issues

Rafyram:
Still no luck...

Still no code?

@AWOL: If you have to ask for code, you are probably not the expert that the OP expects to be answering his/her question!

the topic is addressed to the folks who are familiar with Lidar lite v3 libraries and operation.

You're right.
I'll butt-out.

jremington:
@AWOL: If you have to ask for code, you are probably not the expert that the OP expects to be answering his/her question!

I'm sure that most of us are not familiar with the specific library. That does NOT preclude us from looking at the source code and figuring out that the snippet that OP posted is absolute nonsense.

Bit operations and registers beat me and i'm kind of new to this.
There is the LiDAR lite v3 library for Arduino and the 0x09 VELOCITY register.
I'm trying to read its value like this:

byte myArray[1]; // Array to store bytes from read function
myLidarLite.read(0x09,1,myArray,false,0x62);
velocity=float(char(myArray[0]));

or by using Wire library

float velocity;
byte distance1;
Wire.beginTransmission(LIDARLITE_ADDR_DEFAULT);
Wire.write(0x09);
Wire.endTransmission();
Wire.requestFrom(LIDARLITE_ADDR_DEFAULT, 1);
distance1 = Wire.read();
velocity=float(char(distance1));
Serial.println(velocity);

myLidarLite.read(0x09,1,myArray,false,0x62);
velocity=float(char(myArray[0]));

When you read ONE byte, do you REALLY think it makes sense to cast that single character to a float?

Haven't the time to think about this carefully, but...

The velocity measurement is the difference between the current measurement
and the previous one

However, you declare myArray[1] which can hold only a single value.
Looks like you need to read, store in myArray[0], read again, store in myArray[1], then subtract. Which implies myArray should be declared (at least) myArray[2].
--Michael

mjward:
Haven't the time to think about this carefully, but...However, you declare myArray[1] which can hold only a single value.
Looks like you need to read, store in myArray[0], read again, store in myArray[1], then subtract. Which implies myArray should be declared (at least) myArray[2].
--Michael

Thank you, I'll try that. But i think it's only one byte as stated : 'resulting in a signed (2’s complement) 8-bit number in cm.' Converted 2's complement to decimal and still no valid data.