Skip to content

Commit

Permalink
1. add imu sync
Browse files Browse the repository at this point in the history
2. update sdk version to v1.3.6
  • Loading branch information
yangfuyuan committed Jul 17, 2018
1 parent 4a695aa commit 46b7ddf
Show file tree
Hide file tree
Showing 546 changed files with 14,182 additions and 5,691 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rmw REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)

set(SDK_PATH "./sdk/")

Expand All @@ -27,18 +29,23 @@ include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/sdk/include
${PROJECT_SOURCE_DIR}/sdk/src
${PROJECT_SOURCE_DIR}/sdk/matrix
)

add_executable(ydlidar_node src/ydlidar_node.cpp ${SDK_SRC})
ament_target_dependencies(ydlidar_node
"rclcpp"
"sensor_msgs"
"visualization_msgs"
"geometry_msgs"
)

add_executable(ydlidar_client src/ydlidar_client.cpp)
ament_target_dependencies(ydlidar_client
"rclcpp"
"sensor_msgs"
"visualization_msgs"
"geometry_msgs"
)


Expand Down
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
YDLIDAR ROS2 PACKAGE V1.3.1
YDLIDAR ROS2 PACKAGE V1.3.5
=====================================================================

ROS2 node and test application for YDLIDAR
Expand Down Expand Up @@ -65,6 +65,22 @@ resolution_fixed (bool, default: true)

indicated whether the LIDAR has a fixed angular resolution.

auto_reconnect (bool, default: true)

indicated whether the LIDAR auto reconnection.

debug (bool, default: false)

indicated whether the LIDAR save parsing.

reversion (bool, default: false)

indicated whether the LIDAR data rotation 180°.

intensities (bool, default: false)

indicated whether the LIDAR has intensity.

angle_min (double, default: -180)

Min valid angle (°) for LIDAR data.
Expand Down Expand Up @@ -93,11 +109,33 @@ frequency (double, default: 7)

the LIDAR scanning frequency.

sensor_x (double, default: 0)

the LIDAR X axis installation coordinates

sensor_y (double, default: 0)

the LIDAR Y axis installation coordinates

sensor_yaw (double, default: 0)

the LIDAR installation direction







Upgrade Log
=====================================================================

2018-07-16 version:1.3.5

1.Update SDK verison to 1.3.6

2.add imu sync.

2018-04-16 version:1.3.1

1.Update SDK verison to 1.3.1
Expand Down
7 changes: 7 additions & 0 deletions config/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ angle_fixed =TRUE
resolution_fixed =FALSE
heartbeat =FALSE
low_exposure =FALSE
auto_reconnect = TRUE
reversion = FALSE
debug = FALSE
intensities = FALSE
angle_max =180
angle_min =-180
max_range =16.0
min_range =0.08
frequency =7.0
sensor_x =0.0
sensor_y =0.0
sensor_yaw =0.0
12 changes: 0 additions & 12 deletions launch/ydlidar.launch

This file was deleted.

4 changes: 4 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@

<build_depend>rclcpp</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>visualization_msgs</build_depend>
<build_depend>geometry_msgs</build_depend>

<exec_depend>rclcpp</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>visualization_msgs</exec_depend>
<exec_depend>geometry_msgs</exec_depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_lint_auto</test_depend>
Expand Down
7 changes: 6 additions & 1 deletion sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 2.8)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories(include)
include_directories(src)
include_directories(matrix)


IF (WIN32)
FILE(GLOB SDK_SRC
Expand All @@ -11,6 +13,8 @@ FILE(GLOB SDK_SRC
"src/*.h"
"src/impl/windows/*.cpp"
"src/impl/windows/*.h"
"matrix/matrix/*.hpp"

)

ELSE()
Expand All @@ -20,13 +24,14 @@ FILE(GLOB SDK_SRC
"src/*.h"
"src/impl/unix/*.cpp"
"src/impl/unix/*.h"
"matrix/matrix/*.hpp"

)


ENDIF()

add_subdirectory(samples)

add_library(ydlidar_driver SHARED ${SDK_SRC})
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
IF (WIN32)
Expand Down
135 changes: 108 additions & 27 deletions sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
YDLIDAR SDK PACKAGE V1.3.3
YDLIDAR SDK PACKAGE V1.3.6
=====================================================================

SDK [test](https://github.com/yangfuyuan/sdk) application for YDLIDAR
Expand All @@ -7,67 +7,131 @@ Visit EAI Website for more details about [YDLIDAR](http://www.ydlidar.com/) .

How to build YDLIDAR SDK samples
=====================================================================

$ git clone https://github.com/yangfuyuan/sdk

$ cd sdk

$ git checkout master

$ cd ..

$ mkdir build

$ cd build

$ cmake ../sdk

$ make ###linux

$ vs open Project.sln ###windows

How to run YDLIDAR SDK samples
=====================================================================

$ cd samples

linux:

$ ./ydlidar_test
$Please enter the lidar port:/dev/ttyUSB0
$Please enter the lidar baud rate:230400

$ Please enter the lidar port:/dev/ttyUSB0

$ Please enter the lidar baud rate:115200

$ Please enter the lidar intensity:0


windows:

$ ydlidar_test.exe
$Please enter the lidar port:COM3
$Please enter the lidar baud rate:230400

$ Please enter the lidar port:COM3

$ Please enter the lidar baud rate:115200

$ Please enter the lidar intensity:0

=====================================================================

You should see YDLIDAR's scan result in the console:

Yd Lidar running correctly ! The health status: good
[YDLIDAR] Connection established in [/dev/ttyUSB0]:
Firmware version: 2.0.9
Hardware version: 2
Model: G4
Serial: 2018022700000003
[YDLIDAR INFO] Current Sampling Rate : 9K
[YDLIDAR INFO] Current Scan Frequency : 7.400000Hz
[YDLIDAR INFO] Now YDLIDAR is scanning ......
Scan received: 43 ranges
Scan received: 1361 ranges
Scan received: 1412 ranges
YDLIDAR C++ TEST
Please enter the lidar port:/dev/ttyUSB0
Please enter the lidar baud rate:115200
Please enter the lidar intensity:1
fhs_lock: creating lockfile: 25148

Yd Lidar running correctly ! The health status: good
firmware: 273
[YDLIDAR] Connection established in [/dev/ttyUSB0]:
Firmware version: 1.1.7
Hardware version: 1
Model: S4
Serial: 2018022700000003
[YDLIDAR INFO] Current Sampling Rate : 4K
[YDLIDAR INFO] Current Scan Frequency : 7.000000Hz
set EXPOSURE MODEL SUCCESS!!!
[YDLIDAR INFO] Now YDLIDAR is scanning ......
min_angle: -3.141593
max_angle: 3.141593
Scan received: 571 ranges
fit line size: 9
line length: 0.127150, line angle: -1.888069
line length: 0.149980, line angle: -2.520781
line length: 0.149141, line angle: -2.590903
line length: 0.186178, line angle: -2.221969
line length: 0.123318, line angle: -2.354801
line length: 0.086761, line angle: 2.476112
line length: 0.035698, line angle: 2.552944
line length: 0.108063, line angle: 0.907348
line length: 0.115837, line angle: -1.229582



Lidar point data structure
=====================================================================

data structure:

struct odom_info {

uint64_t stamp; ///< 时间戳

double x; ///< x位置

double y; ///< y位置

double phi; ///< 角度方向

double v; ///< 线速度

double w; ///< 角速度

double dx; ///< x位置增量

double dy; ///< y位置增量

double dth; ///< 方向增量

};

struct node_info {

uint8_t sync_quality;//!intensity
uint8_t sync_flag;//new scan flag

uint16_t sync_quality;//!intensity

uint16_t angle_q6_checkbit; //!angle

uint16_t distance_q2; //! distance
uint16_t distance_q; //! distance

uint64_t stamp; //! time stamp

uint8_t scan_frequence;//! current_frequence = scan_frequence/10.0, If the current value equals zero, it is an invalid value


odom_info current_odom; //! current odometry sync pose

} __attribute__((packed)) ;

example:
Expand All @@ -79,18 +143,18 @@ example:

current_time_stamp = data[i].stamp;

current_distance = data[i].distance_q2/4.f;
current_distance = data[i].distance_q; //v1.3.5版本之后距离不用右移2位

current_angle = ((data[i].angle_q6_checkbit>>LIDAR_RESP_MEASUREMENT_ANGLE_SHIFT)/64.0f);

current_intensity = (float)(data[i].sync_quality >> 2);
current_intensity = (float)(data[i].sync_quality);//v1.3.5版本之后信号质量不用右移2位

###note:current_frequence = data[0].scan_frequence/10.0.

###if the current_frequence value equals zero, it is an invalid value.

code:

void ParseScan(node_info* data, const size_t& size) {

double current_frequence, current_distance, current_angle, current_intensity;
Expand All @@ -109,9 +173,9 @@ code:

current_angle = ((data[i].angle_q6_checkbit>>LIDAR_RESP_MEASUREMENT_ANGLE_SHIFT)/64.0f);//LIDAR_RESP_MEASUREMENT_ANGLE_SHIFT equals 8

current_distance = data[i].distance_q2/4.f;
current_distance = data[i].distance_q;

current_intensity = (float)(data[i].sync_quality >> 2);
current_intensity = (float)(data[i].sync_quality );

}

Expand All @@ -132,6 +196,24 @@ code:

Upgrade Log
=====================================================================

2018-07-17 version:1.3.6

1.add fit line.


2018-05-23 version:1.3.5

1.add sync imu or odometry.

2.update scan protocol.

2018-05-23 version:1.3.4

1.add automatic reconnection if there is an exception

2.add serial file lock.

2018-05-14 version:1.3.3

1.add the heart function constraint.
Expand All @@ -145,4 +227,3 @@ Upgrade Log
2018-04-16 version:1.3.1

1.Compensate for each laser point timestamp.

Loading

0 comments on commit 46b7ddf

Please sign in to comment.