HesaiTechnology / HesaiLidar_General_SDK

Development Kit for PandarXT PandarQT Pandar64 Pandar40P Pandar40M Pandar20A Pandar20B
BSD 2-Clause "Simplified" License
72 stars 36 forks source link

Pandar40PUnit.distance of type uint8_t is being compared with a number over 8-bits #3

Open rdelfin opened 3 years ago

rdelfin commented 3 years ago

This line in pandarGeneral_internal.cc seems to be written to do the wrong thing. There's two separate issues:

  1. unit.intensity is of type uint8_t and is being compared against 0x0101 (257 in decimal), a number that takes up more than 8 bits. As such, the entire clause in this line is always being rendered as false. Was this supposed to be 0b0101, a.k.a 0x0005?
  2. unit.distance, a double, is being compared against 0x010101, (65793 in decimal). While this is valid, I get the impression from the comments that this is supposed to be comparing the binary representation stored in unit.distance with either 0x010101 or 0b010101. However, instead it's casting the float to an int and comparing the value (not the representation). Is this intended?

I attempted fixing it, but unfortunately I'm don't have enough context to know what the intent was supposed to be here. Could I get some help getting this fixed? Thanks!

yangfanFred commented 3 years ago

Hi rdelfin,

We will look into this and get back to you.

Thanks, Fred