Skip to content

Commit

Permalink
support new lidar G5 and G7
Browse files Browse the repository at this point in the history
  • Loading branch information
yangfuyuan committed Mar 31, 2020
1 parent c79bb18 commit fdf7fa7
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 20 deletions.
10 changes: 6 additions & 4 deletions core/common/DriverInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DriverInterface {
* @remarks
<table>
<tr><th>G1/G2/G2A/G2C <td>false
<tr><th>G4/G4B/G4PRO/G6/F4/F4PRO <td>false
<tr><th>G4/G5/G4B/G4PRO/G6/G7/F4/F4PRO <td>false
<tr><th>S4/S4B/X4/R2/G4C <td>false
<tr><th>S2/X2/X2L <td>true
<tr><th>TG15/TG30/TG50 <td>false
Expand All @@ -42,8 +42,8 @@ class DriverInterface {
* @remarks
<table>
<tr><th>G1/G2A/G2/G2C <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>G4/G4B/G4C/G4PRO <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>G6/F4/F4PRO <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>G4/G5/G4B/G4C/G4PRO <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>G6/G7/F4/F4PRO <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>S4/S4B/X4/R2/S2/X2/X2L <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>TG15/TG30/TG50/TX8/TX20 <td>[TYPE_TOF](\ref LidarTypeID::TYPE_TOF)
<tr><th>T5/T15 <td>[TYPE_TOF_NET](\ref LidarTypeID::TYPE_TOF_NET)
Expand Down Expand Up @@ -71,7 +71,7 @@ class DriverInterface {
<table>
<tr><th>S4/S4B/S2/X2/X2L/X4 <td>true
<tr><th>TX8/TX20 <td>true
<tr><th>G4/G4C/G4PRO/F4/F4PRO/G6 <td>false
<tr><th>G4/G5/G4C/G4PRO/F4/F4PRO/G6/G7 <td>false
<tr><th>G1/G2A/G2C/R2/G2/G4B <td>false
<tr><th>TG15/TG30/TG50 <td>false
<tr><th>T5/T15 <td>false
Expand Down Expand Up @@ -354,6 +354,8 @@ class DriverInterface {
YDLIDAR_G4B = 17,/**< G4B LiDAR Model. */
YDLIDAR_G4C = 18,/**< G4C LiDAR Model. */
YDLIDAR_G1 = 19,/**< G1 LiDAR Model. */
YDLIDAR_G5 = 20,/**< G5 LiDAR Model. */
YDLIDAR_G7 = 21,/**< G7 LiDAR Model. */

YDLIDAR_TG15 = 100,/**< TG15 LiDAR Model. */
YDLIDAR_TG30 = 101,/**< T30 LiDAR Model. */
Expand Down
22 changes: 21 additions & 1 deletion core/common/ydlidar_help.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ inline std::string lidarModelToString(int model) {

break;

case DriverInterface::YDLIDAR_G5:
name = "G5";

break;

case DriverInterface::YDLIDAR_G7:
name = "G7";

break;

case DriverInterface::YDLIDAR_TG15:
name = "TG15";

Expand Down Expand Up @@ -265,6 +275,14 @@ inline int lidarModelDefaultSampleRate(int model) {
sample_rate = 9;
break;

case DriverInterface::YDLIDAR_G5:
sample_rate = 9;
break;

case DriverInterface::YDLIDAR_G7:
sample_rate = 18;
break;

case DriverInterface::YDLIDAR_TG15:
sample_rate = 20;
break;
Expand Down Expand Up @@ -312,9 +330,11 @@ inline bool hasSampleRate(int model) {
bool ret = false;

if (model == DriverInterface::YDLIDAR_G4 ||
model == DriverInterface::YDLIDAR_G5 ||
model == DriverInterface::YDLIDAR_G4PRO ||
model == DriverInterface::YDLIDAR_F4PRO ||
model == DriverInterface::YDLIDAR_G6 ||
model == DriverInterface::YDLIDAR_G7 ||
model == DriverInterface::YDLIDAR_TG15 ||
model == DriverInterface::YDLIDAR_TG50 ||
model == DriverInterface::YDLIDAR_TG30) {
Expand Down Expand Up @@ -373,7 +393,7 @@ inline bool isSupportLidar(int model) {
bool ret = true;

if (model < DriverInterface::YDLIDAR_F4 ||
(model > DriverInterface::YDLIDAR_G1 &&
(model > DriverInterface::YDLIDAR_G7 &&
model < DriverInterface::YDLIDAR_TG15) ||
(model > DriverInterface::YDLIDAR_TG50 &&
model < DriverInterface::YDLIDAR_T15)) {
Expand Down
2 changes: 2 additions & 0 deletions doc/Dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
| G4B | 17 | 512000 | 10 | 0.12~16 | 5~12 | true(10) | false | 4.8~5.2 |
| G4C | 18 | 115200 | 4 | 0.1~12 | 5~12 | false | false | 4.8~5.2 |
| G1 | 19 | 230400 | 9 | 0.28~16 | 5~12 | false | false | 4.8~5.2 |
| G5 | 20 | 230400 | 9/8/4 | 0.28/0.26/0.1~16| 5~12 | false | false | 4.8~5.2 |
| G7 | 21 | 512000 | 18/16/8 | 0.28/0.26/0.1~25| 5~12 | false | false | 4.8~5.2 |
| TX8   | 100 | 115200 | 4 | 0.1~8 | 4~8(PWM) | false | true | 4.8~5.2 |
| TX20  | 100 | 115200 | 4 | 0.1~20 | 4~8(PWM) | false | true | 4.8~5.2 |
| TG15  | 100 | 512000 | 20/18/10 | 0.05~30 | 3~16 | false | false | 4.8~5.2 |
Expand Down
2 changes: 0 additions & 2 deletions doc/howto/how_to_build_and_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ We provide the following program options for connecting the specific units :
```
[Please select the lidar baudrate:]: input LiDAR BaudRate.
[Whether the Lidar is one-way communication[yes/no]:]: Whether The Current LiDAR is single-channel.
[Whether the Lidar is a TOF Lidar [yes/no]:]: Whether The Current LiDAR is TOF Type LiDAR.
[Please enter the lidar scan frequency[5-12]:]:input LiDAR Scan Frequency.
```

Expand All @@ -145,7 +144,6 @@ Baudrate:
4. 512000
Please select the lidar baudrate:4
Whether the Lidar is one-way communication[yes/no]:no
Whether the Lidar is a TOF Lidar [yes/no]:yes
Please enter the lidar scan frequency[5-12]:10
```

Expand Down
28 changes: 15 additions & 13 deletions src/CYdLidar.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
<tr><th> G4B <td> 17 <td> 512000 <td> 10 <td> 0.12~16 <td> 5~12 <td> true(10) <td> false <td> 4.8~5.2
<tr><th> G4C <td> 18 <td> 115200 <td> 4 <td> 0.1~12 <td> 5~12 <td> false <td> false <td> 4.8~5.2
<tr><th> G1 <td> 19 <td> 230400 <td> 9 <td> 0.28~16 <td> 5~12 <td> false <td> false <td> 4.8~5.2
<tr><th> G5 <td> 20 <td> 230400 <td> 9/8/4 <td> 0.28/0.26/0.1~16<td> 5~12 <td> false <td> false <td> 4.8~5.2
<tr><th> G7 <td> 21 <td> 512000 <td> 18/16/8 <td> 0.28/0.26/0.1~25<td> 5~12 <td> false <td> false <td> 4.8~5.2
<tr><th> TX8   <td> 100 <td> 115200 <td> 4 <td> 0.05~8 <td> 4~8(PWM) <td> false <td> true <td> 4.8~5.2
<tr><th> TX20  <td> 100 <td> 115200 <td> 4 <td> 0.05~20 <td> 4~8(PWM) <td> false <td> true <td> 4.8~5.2
<tr><th> TG15  <td> 100 <td> 512000 <td> 20/18/10 <td> 0.05~30 <td> 3~16 <td> false <td> false <td> 4.8~5.2
Expand All @@ -81,7 +83,7 @@
*/

/**
* @par example: G4 LiDAR
* @par example: G4/G5 LiDAR
* @code
///< Defining an CYdLidar instance.
CYdLidar laser;
Expand Down Expand Up @@ -483,9 +485,9 @@
* Set the sampling rate to match the LiDAR.
* @remarks unit: kHz/s, Ranges: 2,3,4,5,6,8,9,10,16,18,20\n
<table>
<tr><th>G4/F4 <td>4,8,9
<tr><th>G4/G5/F4 <td>4,8,9
<tr><th>F4PRO <td>4,6
<tr><th>G6 <td>8,16,18
<tr><th>G6/G7 <td>8,16,18
<tr><th>G4B <td>10
<tr><th>G1 <td>9
<tr><th>G2A/G2/R2/X4 <td>5
Expand All @@ -507,8 +509,8 @@
* @remarks unit: Hz\n
<table>
<tr><th>S2/X2/X2L/TX8/TX20 <td>4~8(PWM)
<tr><th>F4/F4PRO/G4/G4PRO/R2 <td>5~12
<tr><th>G6/G2A/G2/G2C/G4B/G4C/G1 <td>5~12
<tr><th>F4/F4PRO/G4/G5/G4PRO/R2 <td>5~12
<tr><th>G6/G7/G2A/G2/G2C/G4B/G4C/G1 <td>5~12
<tr><th>S4/S4B/X4 <td>5~12(PWM)
<tr><th>TG15/TG30/TG50 <td>3~16
<tr><th>T5/T15 <td>5~40
Expand Down Expand Up @@ -541,7 +543,7 @@
<table>
<tr><th>LiDAR <th>reversion
<tr><th>G1/G2/G2A/G2C/F4/F4PRO/R2 <td>true
<tr><th>G4/G4PRO/G4B/G4C/G6 <td>true
<tr><th>G4/G5/G4PRO/G4B/G4C/G6/G7 <td>true
<tr><th>TG15/TG30/TG50 <td>true
<tr><th>T5/T15 <td>true
<tr><th>S2/X2/X2L/X4/S4/S4B <td>false
Expand Down Expand Up @@ -578,9 +580,9 @@
<tr><th>F4/S2/X2/X2L/S4/TX8/TX20/G4C <td>115200
<tr><th>X4 <td>128000
<tr><th>S4B <td>153600
<tr><th>G1/G2/R2/G4/G4PRO/F4PRO <td>230400
<tr><th>G1/G2/R2/G4/G5/G4PRO/F4PRO <td>230400
<tr><th>G2A/G2C <td>230400
<tr><th>G6/G4B/TG15/TG30/TG50 <td>512000
<tr><th>G6/G7/G4B/TG15/TG30/TG50 <td>512000
<tr><th>T5/T15(network) <td>8000
</table>
* @see CYdLidar::lidarSetProp and CYdLidar::lidarGetProp
Expand Down Expand Up @@ -633,7 +635,7 @@
* @remarks
<table>
<tr><th>G1/G2/G2A/G2C <td>false
<tr><th>G4/G4B/G4PRO/G6/F4/F4PRO <td>false
<tr><th>G4/G5/G4B/G4PRO/G6/G7/F4/F4PRO <td>false
<tr><th>S4/S4B/X4/R2/G4C <td>false
<tr><th>S2/X2/X2L <td>true
<tr><th>TG15/TG30/TG50 <td>false
Expand All @@ -652,8 +654,8 @@
* @remarks
<table>
<tr><th>G1/G2A/G2/G2C <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>G4/G4B/G4C/G4PRO <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>G6/F4/F4PRO <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>G4/G5/G4B/G4C/G4PRO <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>G6/G7/F4/F4PRO <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>S4/S4B/X4/R2/S2/X2/X2L <td>[TYPE_TRIANGLE](\ref LidarTypeID::TYPE_TRIANGLE)
<tr><th>TG15/TG30/TG50/TX8/TX20 <td>[TYPE_TOF](\ref LidarTypeID::TYPE_TOF)
<tr><th>T5/T15 <td>[TYPE_TOF_NET](\ref LidarTypeID::TYPE_TOF_NET)
Expand All @@ -672,7 +674,7 @@
* @remarks
<table>
<tr><th>S4B/G2/G4B <td>true
<tr><th>G4/G4C/G4PRO/F4/F4PRO/G6 <td>false
<tr><th>G4/G5/G4C/G4PRO/F4/F4PRO/G6/G7 <td>false
<tr><th>G1/G2A/G2C/R2 <td>false
<tr><th>S2/X2/X2L/X4 <td>false
<tr><th>TG15/TG30/TG50 <td>false
Expand Down Expand Up @@ -707,7 +709,7 @@
<table>
<tr><th>S4/S4B/S2/X2/X2L/X4 <td>true
<tr><th>TX8/TX20 <td>true
<tr><th>G4/G4C/G4PRO/F4/F4PRO/G6 <td>false
<tr><th>G4/G5/G4C/G4PRO/F4/F4PRO/G6/G7 <td>false
<tr><th>G1/G2A/G2C/R2/G2/G4B <td>false
<tr><th>TG15/TG30/TG50 <td>false
<tr><th>T5/T15 <td>false
Expand Down
2 changes: 2 additions & 0 deletions src/ydlidar_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1427,9 +1427,11 @@ void YDlidarDriver::checkTransDelay() {

switch (model) {
case YDLIDAR_G4://g4
case YDLIDAR_G5:
case YDLIDAR_G4PRO:
case YDLIDAR_F4PRO:
case YDLIDAR_G6://g6
case YDLIDAR_G7:
case YDLIDAR_TG15:
case YDLIDAR_TG30:
case YDLIDAR_TG50:
Expand Down

0 comments on commit fdf7fa7

Please sign in to comment.