ydlidar_protocol.h
#pragma once
#include <v8stdint.h>
#include <vector>
#include <ydlidar_cmd.h>
#define SUNNOISEINTENSITY 0xff
#define GLASSNOISEINTENSITY 0xfe
#if defined(_WIN32)
#pragma pack(1)
#endif
struct node_info {
uint8_t sync_flag; //sync flag
uint16_t sync_quality;
uint16_t angle_q6_checkbit;
uint16_t distance_q2;
uint64_t stamp;
uint8_t scan_frequence;
} __attribute__((packed)) ;
struct PackageNode {
uint8_t PakageSampleQuality;
uint16_t PakageSampleDistance;
} __attribute__((packed));
struct node_package {
uint16_t package_Head;
uint8_t package_CT;
uint8_t nowPackageNum;
uint16_t packageFirstSampleAngle;
uint16_t packageLastSampleAngle;
uint16_t checkSum;
PackageNode packageSample[PackageSampleMaxLngth];
} __attribute__((packed)) ;
struct node_packages {
uint16_t package_Head;
uint8_t package_CT;
uint8_t nowPackageNum;
uint16_t packageFirstSampleAngle;
uint16_t packageLastSampleAngle;
uint16_t checkSum;
uint16_t packageSampleDistance[PackageSampleMaxLngth];
} __attribute__((packed)) ;
struct device_info {
uint8_t model;
uint16_t firmware_version;
uint8_t hardware_version;
uint8_t serialnum[16];
} __attribute__((packed)) ;
struct device_health {
uint8_t status;
uint16_t error_code;
} __attribute__((packed)) ;
struct sampling_rate {
uint8_t rate;
} __attribute__((packed)) ;
struct scan_frequency {
uint32_t frequency;
} __attribute__((packed)) ;
struct scan_rotation {
uint8_t rotation;
} __attribute__((packed)) ;
struct scan_exposure {
uint8_t exposure;
} __attribute__((packed)) ;
struct scan_heart_beat {
uint8_t enable;
} __attribute__((packed));
struct scan_points {
uint8_t flag;
} __attribute__((packed)) ;
struct function_state {
uint8_t state;
} __attribute__((packed)) ;
struct cmd_packet {
uint8_t syncByte;
uint8_t cmd_flag;
uint8_t size;
uint8_t data;
} __attribute__((packed)) ;
struct lidar_ans_header {
uint8_t syncByte1;
uint8_t syncByte2;
uint32_t size: 30;
uint32_t subType: 2;
uint8_t type;
} __attribute__((packed));
#if defined(_WIN32)
#pragma pack()
#endif
struct LaserPoint {
float angle;
float range;
float intensity;
LaserPoint &operator = (const LaserPoint &data) {
angle = data.angle;
range = data.range;
intensity = data.intensity;
return *this;
}
};
struct LaserConfig {
float min_angle;
float max_angle;
float time_increment;
float scan_time;
float min_range;
float max_range;
LaserConfig &operator = (const LaserConfig &data) {
min_angle = data.min_angle;
max_angle = data.max_angle;
time_increment = data.time_increment;
scan_time = data.scan_time;
min_range = data.min_range;
max_range = data.max_range;
return *this;
}
};
struct LaserScan {
std::vector<LaserPoint> data;
uint64_t system_time_stamp;
LaserConfig config;
LaserScan &operator = (const LaserScan &data) {
this->data = data.data;
system_time_stamp = data.system_time_stamp;
config = data.config;
return *this;
}
};
sampling_rate::rate
uint8_t rate
采样频率
Definition: ydlidar_protocol.h:63
node_info::scan_frequence
uint8_t scan_frequence
时间戳
Definition: ydlidar_protocol.h:21
LaserConfig::min_angle
float min_angle
Start angle for the laser scan [rad]. 0 is forward and angles are measured clockwise when viewing YDL...
Definition: ydlidar_protocol.h:125
device_health::status
uint8_t status
健康状体
Definition: ydlidar_protocol.h:58
cmd_packet
Definition: ydlidar_protocol.h:90
device_health
Definition: ydlidar_protocol.h:57
device_health::error_code
uint16_t error_code
错误代码
Definition: ydlidar_protocol.h:59
lidar_ans_header
Definition: ydlidar_protocol.h:97
LaserPoint
Definition: ydlidar_protocol.h:110
LaserConfig
A struct for returning configuration from the YDLIDAR.
Definition: ydlidar_protocol.h:123
LaserScan
Definition: ydlidar_protocol.h:148
LaserScan::system_time_stamp
uint64_t system_time_stamp
System time when first range was measured in nanoseconds.
Definition: ydlidar_protocol.h:152
node_package
Definition: ydlidar_protocol.h:29
scan_heart_beat
Definition: ydlidar_protocol.h:78
scan_heart_beat::enable
uint8_t enable
掉电保护状态
Definition: ydlidar_protocol.h:79
node_info::stamp
uint64_t stamp
当前测距点距离
Definition: ydlidar_protocol.h:20
scan_exposure::exposure
uint8_t exposure
低光功率模式
Definition: ydlidar_protocol.h:75
device_info
Definition: ydlidar_protocol.h:50
sampling_rate
Definition: ydlidar_protocol.h:62
LaserConfig::time_increment
float time_increment
Scan resoltuion [s].
Definition: ydlidar_protocol.h:129
LaserConfig::scan_time
float scan_time
Time between scans.
Definition: ydlidar_protocol.h:131
LaserConfig::max_angle
float max_angle
Stop angle for the laser scan [rad]. 0 is forward and angles are measured clockwise when viewing YDLI...
Definition: ydlidar_protocol.h:127
LaserConfig::max_range
float max_range
Maximum range [m].
Definition: ydlidar_protocol.h:135
device_info::firmware_version
uint16_t firmware_version
固件版本号
Definition: ydlidar_protocol.h:52
node_info::distance_q2
uint16_t distance_q2
测距点角度
Definition: ydlidar_protocol.h:19
node_info::angle_q6_checkbit
uint16_t angle_q6_checkbit
信号质量
Definition: ydlidar_protocol.h:18
scan_exposure
Definition: ydlidar_protocol.h:74
device_info::model
uint8_t model
雷达型号
Definition: ydlidar_protocol.h:51
device_info::hardware_version
uint8_t hardware_version
硬件版本号
Definition: ydlidar_protocol.h:53
scan_points
Definition: ydlidar_protocol.h:82
LaserScan::data
std::vector< LaserPoint > data
Array of laser point.
Definition: ydlidar_protocol.h:150
LaserConfig::min_range
float min_range
Minimum range [m].
Definition: ydlidar_protocol.h:133
scan_rotation
Definition: ydlidar_protocol.h:70
scan_frequency::frequency
uint32_t frequency
扫描频率
Definition: ydlidar_protocol.h:67
LaserScan::config
LaserConfig config
Configuration of scan.
Definition: ydlidar_protocol.h:154
node_info
Definition: ydlidar_protocol.h:15
scan_frequency
Definition: ydlidar_protocol.h:66
PackageNode
Definition: ydlidar_protocol.h:24
function_state
Definition: ydlidar_protocol.h:86
node_packages
Definition: ydlidar_protocol.h:39