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?
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]));
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.